Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
eb217504
Commit
eb217504
authored
Jun 18, 2024
by
Timothy J. Baek
Browse files
fix: files
parent
d9316079
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
backend/main.py
backend/main.py
+3
-5
No files found.
backend/main.py
View file @
eb217504
...
@@ -354,10 +354,10 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -354,10 +354,10 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
print
(
f
"tool_context:
{
context
}
"
)
print
(
f
"tool_context:
{
context
}
"
)
# If docs field is present, generate RAG completions
# If docs field is present, generate RAG completions
if
"
doc
s"
in
data
:
if
"
file
s"
in
data
:
data
=
{
**
data
}
data
=
{
**
data
}
rag_context
,
citations
=
get_rag_context
(
rag_context
,
citations
=
get_rag_context
(
docs
=
data
[
"
doc
s"
],
docs
=
data
[
"
file
s"
],
messages
=
data
[
"messages"
],
messages
=
data
[
"messages"
],
embedding_function
=
rag_app
.
state
.
EMBEDDING_FUNCTION
,
embedding_function
=
rag_app
.
state
.
EMBEDDING_FUNCTION
,
k
=
rag_app
.
state
.
config
.
TOP_K
,
k
=
rag_app
.
state
.
config
.
TOP_K
,
...
@@ -369,8 +369,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -369,8 +369,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
if
rag_context
:
if
rag_context
:
context
+=
(
"
\n
"
if
context
!=
""
else
""
)
+
rag_context
context
+=
(
"
\n
"
if
context
!=
""
else
""
)
+
rag_context
del
data
[
"docs"
]
del
data
[
"files"
]
log
.
debug
(
f
"rag_context:
{
rag_context
}
, citations:
{
citations
}
"
)
log
.
debug
(
f
"rag_context:
{
rag_context
}
, citations:
{
citations
}
"
)
if
context
!=
""
:
if
context
!=
""
:
...
@@ -1380,7 +1379,6 @@ async def update_pipeline_valves(
...
@@ -1380,7 +1379,6 @@ async def update_pipeline_valves(
)
)
@
app
.
get
(
"/api/config"
)
@
app
.
get
(
"/api/config"
)
async
def
get_app_config
():
async
def
get_app_config
():
# Checking and Handling the Absence of 'ui' in CONFIG_DATA
# Checking and Handling the Absence of 'ui' in CONFIG_DATA
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment