Update app.py
Browse files
app.py
CHANGED
|
@@ -104,6 +104,7 @@ def infer(message:str, history: list):
|
|
| 104 |
if message["text"].startswith("http://") or message["text"].startswith("https://"):
|
| 105 |
documents, option = extract_web(message["text"])
|
| 106 |
db_path = create_col(documents)
|
|
|
|
| 107 |
elif not message["text"].startswith("http://") and not message["text"].startswith("https://") and len(history) == 0:
|
| 108 |
raise gr.Error("请先输入网址或上传文档。")
|
| 109 |
|
|
@@ -135,7 +136,7 @@ def infer(message:str, history: list):
|
|
| 135 |
"Use the following context to answer the question:\n"
|
| 136 |
"{context_str}"
|
| 137 |
"\nIf you don't know the answer, just say that you don't know."
|
| 138 |
-
"Use five sentences maximum and keep the answer concise
|
| 139 |
"\nInstruction: Use the previous chat history, or the context above, to interact and help the user."
|
| 140 |
),
|
| 141 |
verbose=True,
|
|
|
|
| 104 |
if message["text"].startswith("http://") or message["text"].startswith("https://"):
|
| 105 |
documents, option = extract_web(message["text"])
|
| 106 |
db_path = create_col(documents)
|
| 107 |
+
memory = ChatMemoryBuffer.from_defaults(token_limit=3900)
|
| 108 |
elif not message["text"].startswith("http://") and not message["text"].startswith("https://") and len(history) == 0:
|
| 109 |
raise gr.Error("请先输入网址或上传文档。")
|
| 110 |
|
|
|
|
| 136 |
"Use the following context to answer the question:\n"
|
| 137 |
"{context_str}"
|
| 138 |
"\nIf you don't know the answer, just say that you don't know."
|
| 139 |
+
"Use five sentences maximum and keep the answer concise."
|
| 140 |
"\nInstruction: Use the previous chat history, or the context above, to interact and help the user."
|
| 141 |
),
|
| 142 |
verbose=True,
|