Spaces:
Sleeping
Sleeping
lu sun
commited on
Commit
·
18f9e6e
1
Parent(s):
18752ac
remove debug code
Browse files- blog_class.py +11 -11
blog_class.py
CHANGED
|
@@ -421,22 +421,22 @@ class knowledge_class:
|
|
| 421 |
chat_history=chat_history_str, question=new_query
|
| 422 |
)
|
| 423 |
|
| 424 |
-
if "test" in chat_history[-1]["content"]:
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
print("
|
| 433 |
# prompt = DEFAULT_TEMPLATE.format(chat_history=chat_history, question=query)
|
| 434 |
# get rewrite question
|
| 435 |
# get similar info
|
| 436 |
-
question_vector = get_embedding(
|
| 437 |
info_text, info_title = self.find_top_info(question_vector)
|
| 438 |
user_prompt = QA_chat_Prompt.format(
|
| 439 |
-
h_text=chat_history_str, q_text=
|
| 440 |
)
|
| 441 |
answer_text = generate_item(user_prompt, SYS_Prompt, model="gpt-4o")
|
| 442 |
md_text = user_prompt + "\n 応答: \n" + answer_text
|
|
|
|
| 421 |
chat_history=chat_history_str, question=new_query
|
| 422 |
)
|
| 423 |
|
| 424 |
+
# if "test" in chat_history[-1]["content"]:
|
| 425 |
+
# return (
|
| 426 |
+
# f"test_ui:{chat_history[-1]['content']}",
|
| 427 |
+
# "1. info_text1 \n 2. info_text2 \n",
|
| 428 |
+
# "./resource/2025-03-03-機嫌良く働くと仕事は上手く進む.mp3",
|
| 429 |
+
# )
|
| 430 |
+
|
| 431 |
+
rewrite_question = generate_item(rw_prompt, REWRITE_SYS_Prompt, model="gpt-4o")
|
| 432 |
+
print("rewrite_question:", rewrite_question)
|
| 433 |
# prompt = DEFAULT_TEMPLATE.format(chat_history=chat_history, question=query)
|
| 434 |
# get rewrite question
|
| 435 |
# get similar info
|
| 436 |
+
question_vector = get_embedding(rewrite_question)[0]
|
| 437 |
info_text, info_title = self.find_top_info(question_vector)
|
| 438 |
user_prompt = QA_chat_Prompt.format(
|
| 439 |
+
h_text=chat_history_str, q_text=rewrite_question, r_text=info_text
|
| 440 |
)
|
| 441 |
answer_text = generate_item(user_prompt, SYS_Prompt, model="gpt-4o")
|
| 442 |
md_text = user_prompt + "\n 応答: \n" + answer_text
|