Spaces:
Running
Running
misc: Updated prompt and temp removed question limit
Browse files- chat_template.py +2 -0
- chatbot.py +4 -6
chat_template.py
CHANGED
@@ -23,6 +23,8 @@ TEXT_QA_SYSTEM_PROMPT = ChatMessage(
|
|
23 |
"If the user ask sth related to health or emergency, say the following:"
|
24 |
"如遇到任何生命威脅或緊急事故,請立即聯絡當地緊急部門處理。香港本地緊急求助電話:999"
|
25 |
"In case of any life-threatening situations or emergencies, please contact your local emergency services immediately. For Hong Kong local emergency services, call: 999\n"
|
|
|
|
|
26 |
),
|
27 |
role=MessageRole.SYSTEM,
|
28 |
)
|
|
|
23 |
"If the user ask sth related to health or emergency, say the following:"
|
24 |
"如遇到任何生命威脅或緊急事故,請立即聯絡當地緊急部門處理。香港本地緊急求助電話:999"
|
25 |
"In case of any life-threatening situations or emergencies, please contact your local emergency services immediately. For Hong Kong local emergency services, call: 999\n"
|
26 |
+
"If the questions is not related to documents like '平安紙' i.e. 'Will', '持久授權書' i.e. 'Enduring Power of Attorney', and '預設醫療指示' i.e. 'Advance Medical Directive', say exactly the following:"
|
27 |
+
"很抱歉,身為安心三寶人工智能,我無法回答與安心三寶無關的內容。"
|
28 |
),
|
29 |
role=MessageRole.SYSTEM,
|
30 |
)
|
chatbot.py
CHANGED
@@ -116,12 +116,10 @@ class Chatbot:
|
|
116 |
def stream_chat(self, message, history):
|
117 |
self.logger.info(history)
|
118 |
self.logger.info(self.convert_to_chat_messages(history))
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
"""
|
124 |
-
return
|
125 |
response = self.chat_engine.stream_chat(
|
126 |
message, chat_history=self.convert_to_chat_messages(history)
|
127 |
)
|
|
|
116 |
def stream_chat(self, message, history):
|
117 |
self.logger.info(history)
|
118 |
self.logger.info(self.convert_to_chat_messages(history))
|
119 |
+
# Temporarily disable the question limit.
|
120 |
+
# if len(history) > 10:
|
121 |
+
# yield "Thank you for using AweSumCare. I'm sorry I can't answer your question now, but I'm still learning. Please try to ask me something else.\n感謝使用安心三寶。現時未能回答你的問題,請稍後再試。"
|
122 |
+
# return
|
|
|
|
|
123 |
response = self.chat_engine.stream_chat(
|
124 |
message, chat_history=self.convert_to_chat_messages(history)
|
125 |
)
|