Charles Chan
commited on
Commit
·
430a3e3
1
Parent(s):
4020981
dbg
Browse files
app.py
CHANGED
|
@@ -33,15 +33,16 @@ def answer_question(question):
|
|
| 33 |
question_embedding = embeddings.embed_query(question)
|
| 34 |
docs_and_scores = db.similarity_search_with_score(question_embedding)
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
-
prompt = f"请根据以下知识库回答问题:\n{context}\n问题:{question}"
|
| 41 |
-
print(prompt)
|
| 42 |
|
| 43 |
-
answer =
|
| 44 |
-
return answer
|
| 45 |
except Exception as e:
|
| 46 |
st.error(f"问答过程出错:{e}")
|
| 47 |
return "An error occurred during the answering process."
|
|
|
|
| 33 |
question_embedding = embeddings.embed_query(question)
|
| 34 |
docs_and_scores = db.similarity_search_with_score(question_embedding)
|
| 35 |
|
| 36 |
+
return ""
|
| 37 |
+
# # 正确处理 docs_and_scores 列表
|
| 38 |
+
# context = "\n".join([doc.page_content for doc, _ in docs_and_scores]) # 使用 join() 方法
|
| 39 |
+
# print(context)
|
| 40 |
|
| 41 |
+
# prompt = f"请根据以下知识库回答问题:\n{context}\n问题:{question}"
|
| 42 |
+
# print(prompt)
|
| 43 |
|
| 44 |
+
# answer = llm(prompt)
|
| 45 |
+
# return answer
|
| 46 |
except Exception as e:
|
| 47 |
st.error(f"问答过程出错:{e}")
|
| 48 |
return "An error occurred during the answering process."
|