Spaces:
Running
Running
Update app-backup.py
Browse files- app-backup.py +4 -10
app-backup.py
CHANGED
@@ -89,16 +89,10 @@ async def generate_response(message):
|
|
89 |
response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(
|
90 |
messages, max_tokens=1000, stream=True, temperature=0.7, top_p=0.85))
|
91 |
|
92 |
-
full_response_text = ''
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
full_response_text += str(part.choices[0].delta.content)
|
97 |
-
else:
|
98 |
-
logging.debug(f'Invalid part: {part}')
|
99 |
-
except Exception as e:
|
100 |
-
logging.error(f'Error processing part: {e}')
|
101 |
-
|
102 |
conversation_history.append({"role": "assistant", "content": full_response_text})
|
103 |
return full_response_text # ์ง์ ์ ์ธ ๋ต๋ณ๋ง ๋ฐํ
|
104 |
|
|
|
89 |
response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(
|
90 |
messages, max_tokens=1000, stream=True, temperature=0.7, top_p=0.85))
|
91 |
|
92 |
+
full_response_text = ''.join(
|
93 |
+
str(part.choices[0].delta.content) for part in response
|
94 |
+
if part.choices and part.choices[0].delta and part.choices[0].delta.content
|
95 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
conversation_history.append({"role": "assistant", "content": full_response_text})
|
97 |
return full_response_text # ์ง์ ์ ์ธ ๋ต๋ณ๋ง ๋ฐํ
|
98 |
|