Spaces:
Runtime error
Runtime error
:recycle: [Refactor] Console output for prompt and suggested questions
Browse files- apis/chat_api.py +2 -0
- networks/message_parser.py +3 -1
- utils/enver.py +1 -1
apis/chat_api.py
CHANGED
@@ -7,6 +7,7 @@ from conversations import (
|
|
7 |
ConversationCreator,
|
8 |
MessageComposer,
|
9 |
)
|
|
|
10 |
|
11 |
|
12 |
class ChatAPIApp:
|
@@ -128,6 +129,7 @@ class ChatAPIApp:
|
|
128 |
|
129 |
message_composer = MessageComposer()
|
130 |
prompt = message_composer.merge(item.messages)
|
|
|
131 |
system_prompt = message_composer.system_prompt
|
132 |
|
133 |
return EventSourceResponse(
|
|
|
7 |
ConversationCreator,
|
8 |
MessageComposer,
|
9 |
)
|
10 |
+
from utils.logger import logger
|
11 |
|
12 |
|
13 |
class ChatAPIApp:
|
|
|
129 |
|
130 |
message_composer = MessageComposer()
|
131 |
prompt = message_composer.merge(item.messages)
|
132 |
+
logger.mesg(item.messages[-1]["content"])
|
133 |
system_prompt = message_composer.system_prompt
|
134 |
|
135 |
return EventSourceResponse(
|
networks/message_parser.py
CHANGED
@@ -35,7 +35,9 @@ class MessageParser:
|
|
35 |
delta_content, content_type="Completions"
|
36 |
)
|
37 |
if message.get("suggestedResponses"):
|
38 |
-
suggestion_texts_str =
|
|
|
|
|
39 |
suggestion_texts_str += "\n".join(
|
40 |
f"- {item}" for item in suggestion_texts
|
41 |
)
|
|
|
35 |
delta_content, content_type="Completions"
|
36 |
)
|
37 |
if message.get("suggestedResponses"):
|
38 |
+
suggestion_texts_str = (
|
39 |
+
"\n\n---\n\n**Suggested Questions:**\n"
|
40 |
+
)
|
41 |
suggestion_texts_str += "\n".join(
|
42 |
f"- {item}" for item in suggestion_texts
|
43 |
)
|
utils/enver.py
CHANGED
@@ -42,7 +42,7 @@ class OSEnver:
|
|
42 |
self.envs[proxy_env] = os.getenv("http_proxy")
|
43 |
else:
|
44 |
continue
|
45 |
-
|
46 |
|
47 |
self.proxy = (
|
48 |
self.envs.get("all_proxy")
|
|
|
42 |
self.envs[proxy_env] = os.getenv("http_proxy")
|
43 |
else:
|
44 |
continue
|
45 |
+
print(f"Using proxy: [{self.envs.get(proxy_env)}]")
|
46 |
|
47 |
self.proxy = (
|
48 |
self.envs.get("all_proxy")
|