mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 21:05:19 +00:00
refac
This commit is contained in:
parent
f19d5b05a8
commit
92c9068369
1 changed files with 8 additions and 4 deletions
|
|
@ -488,8 +488,12 @@ def get_sources_from_items(
|
||||||
if item.get("file"):
|
if item.get("file"):
|
||||||
# if item has file data, use it
|
# if item has file data, use it
|
||||||
query_result = {
|
query_result = {
|
||||||
"documents": [[item.get("file").get("data", {}).get("content")]],
|
"documents": [
|
||||||
"metadatas": [[item.get("file").get("data", {}).get("meta", {})]],
|
[item.get("file", {}).get("data", {}).get("content")]
|
||||||
|
],
|
||||||
|
"metadatas": [
|
||||||
|
[item.get("file", {}).get("data", {}).get("meta", {})]
|
||||||
|
],
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
# Fallback to item content
|
# Fallback to item content
|
||||||
|
|
@ -516,12 +520,12 @@ def get_sources_from_items(
|
||||||
item.get("context") == "full"
|
item.get("context") == "full"
|
||||||
or request.app.state.config.BYPASS_EMBEDDING_AND_RETRIEVAL
|
or request.app.state.config.BYPASS_EMBEDDING_AND_RETRIEVAL
|
||||||
):
|
):
|
||||||
if item.get("file").get("data", {}):
|
if item.get("file", {}).get("data", {}).get("content", ""):
|
||||||
# Manual Full Mode Toggle
|
# Manual Full Mode Toggle
|
||||||
# Used from chat file modal, we can assume that the file content will be available from item.get("file").get("data", {}).get("content")
|
# Used from chat file modal, we can assume that the file content will be available from item.get("file").get("data", {}).get("content")
|
||||||
query_result = {
|
query_result = {
|
||||||
"documents": [
|
"documents": [
|
||||||
[item.get("file").get("data", {}).get("content", "")]
|
[item.get("file", {}).get("data", {}).get("content", "")]
|
||||||
],
|
],
|
||||||
"metadatas": [
|
"metadatas": [
|
||||||
[
|
[
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue