Spaces:
Runtime error
Runtime error
Update chain_app.py
Browse files- chain_app.py +4 -4
chain_app.py
CHANGED
|
@@ -2060,9 +2060,9 @@ async def on_chat_start():
|
|
| 2060 |
@cl.on_message
|
| 2061 |
async def main(message: cl.Message):
|
| 2062 |
chat_profile = cl.user_session.get("chat_profile")
|
| 2063 |
-
|
| 2064 |
msg = cl.Message(content="")
|
| 2065 |
await msg.send()
|
|
|
|
| 2066 |
if chat_profile == 'neural-brain-AI':
|
| 2067 |
stream = completion = openai_client.chat.completions.create(
|
| 2068 |
model="ft:gpt-3.5-turbo-1106:nb:aria1:9UWDrLJK",
|
|
@@ -2073,9 +2073,9 @@ async def main(message: cl.Message):
|
|
| 2073 |
stream=True
|
| 2074 |
)
|
| 2075 |
|
| 2076 |
-
|
| 2077 |
-
|
| 2078 |
-
|
| 2079 |
|
| 2080 |
elif chat_profile == "Dorna-AI":
|
| 2081 |
result = hf_text_client.predict(
|
|
|
|
| 2060 |
@cl.on_message
|
| 2061 |
async def main(message: cl.Message):
|
| 2062 |
chat_profile = cl.user_session.get("chat_profile")
|
|
|
|
| 2063 |
msg = cl.Message(content="")
|
| 2064 |
await msg.send()
|
| 2065 |
+
|
| 2066 |
if chat_profile == 'neural-brain-AI':
|
| 2067 |
stream = completion = openai_client.chat.completions.create(
|
| 2068 |
model="ft:gpt-3.5-turbo-1106:nb:aria1:9UWDrLJK",
|
|
|
|
| 2073 |
stream=True
|
| 2074 |
)
|
| 2075 |
|
| 2076 |
+
async for part in stream:
|
| 2077 |
+
if token := part.choices[0].delta.content or "":
|
| 2078 |
+
await msg.stream_token(token)
|
| 2079 |
|
| 2080 |
elif chat_profile == "Dorna-AI":
|
| 2081 |
result = hf_text_client.predict(
|