Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -220,9 +220,11 @@ def call_llm(messages: List[dict], model: str, logs: List[str]) -> dict:
|
|
| 220 |
print("torch.no_grad")
|
| 221 |
# 解碼生成內容後
|
| 222 |
full_text = _hf_tok.decode(out_ids[0], skip_special_tokens=True)
|
| 223 |
-
gen_text = full_text
|
| 224 |
logs.append(f"[LOCAL LLM] raw_len={len(gen_text)}")
|
| 225 |
-
logs.append(f"[LOCAL LLM]
|
|
|
|
|
|
|
| 226 |
|
| 227 |
# ★ 強韌解析:剝掉前置描述,只取第一個 {...}
|
| 228 |
data = safe_parse_json(full_text)
|
|
|
|
| 220 |
print("torch.no_grad")
|
| 221 |
# 解碼生成內容後
|
| 222 |
full_text = _hf_tok.decode(out_ids[0], skip_special_tokens=True)
|
| 223 |
+
gen_text = full_text.replace(prompt,"",1).strip()
|
| 224 |
logs.append(f"[LOCAL LLM] raw_len={len(gen_text)}")
|
| 225 |
+
logs.append(f"[LOCAL LLM] gen_text={gen_text}")
|
| 226 |
+
logs.append(f"[LOCAL LLM] prompt={prompt)}")
|
| 227 |
+
logs.append(f"[LOCAL LLM] full_text={full_text)}")
|
| 228 |
|
| 229 |
# ★ 強韌解析:剝掉前置描述,只取第一個 {...}
|
| 230 |
data = safe_parse_json(full_text)
|