This commit is contained in:
xunbu
2025-08-05 09:39:05 +08:00
parent fb99ed78e3
commit 58a85965a2
2 changed files with 1 additions and 5 deletions

View File

@@ -36,10 +36,6 @@ class SegmentsTranslateAgent(Agent):
{r'{"0":"hello","1":"apple","2":true,"3":"false"}'}
## 输出
{r'{"0":"你好","1":"苹果","2":true,"3":"错误"}'}
# 错误输出示例
"{r'"{\"0\":\"你好\",\"1\":\"苹果\"}"'}"
# 正确输出示例
{r'{"0":"你好","1":"苹果"}'}
警告绝不要将整个JSON对象用引号包裹成一个字符串。
"""
if config.custom_prompt:

View File

@@ -14,7 +14,7 @@ def flat_json_split(js: dict, chunk_size_max: int) -> list[dict]:
if chunk_size <= chunk_size_max:
chunk[key] = val
else:
chunks.append(json.dumps(chunk,ensure_ascii=False))
chunks.append(chunk)
chunk = {key:val}
chunks.append(chunk)
return chunks