fantaxy commited on
Commit
5ad91c8
โ€ข
1 Parent(s): 07e70da

Update app-backup.py

Browse files
Files changed (1) hide show
  1. 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
- for part in response:
94
- try:
95
- if part.choices and part.choices[0].delta and part.choices[0].delta.content:
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