Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -46,17 +46,13 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
46 |
for chunk in stream:
|
47 |
print("[DEBUG] chunk:", chunk)
|
48 |
delta = chunk.choices[0].delta
|
49 |
-
if delta:
|
50 |
-
# 忽略第一次出現的特定內容
|
51 |
-
if not first_chunk_processed:
|
52 |
-
first_chunk_processed = True
|
53 |
-
# 檢查並跳過不需要的內容
|
54 |
-
if hasattr(delta, 'content') and delta.content:
|
55 |
-
if delta.content in ['<|channel|>', 'analysis']:
|
56 |
-
continue
|
57 |
-
|
58 |
# 安全取得 content
|
59 |
if delta.content:
|
|
|
|
|
|
|
|
|
60 |
output += delta.content
|
61 |
# 安全取得 reasoning_content,如果不存在就跳過 印出思維練
|
62 |
#reasoning = getattr(delta, "reasoning_content", None)
|
|
|
46 |
for chunk in stream:
|
47 |
print("[DEBUG] chunk:", chunk)
|
48 |
delta = chunk.choices[0].delta
|
49 |
+
if delta:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# 安全取得 content
|
51 |
if delta.content:
|
52 |
+
if not first_chunk_processed:
|
53 |
+
first_chunk_processed = True
|
54 |
+
if delta.content in ['<|channel|>', 'analysis']:
|
55 |
+
continue
|
56 |
output += delta.content
|
57 |
# 安全取得 reasoning_content,如果不存在就跳過 印出思維練
|
58 |
#reasoning = getattr(delta, "reasoning_content", None)
|