终于解决了,json deserialization failed的主要问 就是json的格式没有对其 国内帖子找了半天找不出来解决办法,我直接去找rimtalk作者的回复。 其中原文 2) Reiterate the format at the very end of the prompt Local models tend to obey the last instruction best. For example: IMPORTANT: Output JSON only. Return an array of dialogue objects. Each object must include "name" and "text". Only include "act" and "target" if there is social interaction. Do not include null or extra fields. 翻译: 本地模型倾向于最好地遵守最后一条指令。例如:重要事项:仅输出JSON。返回一个对话框对象的数组。每个对象必须包括“名称”和“文本”。如果有社会交往,只包括“行为”和“目标”。不要包含空字段或额外字段。 也就是说需要在提示词后面添加这一句话 本地模型倾向于最好地遵守最后一条指令。例如: 重要事项: 仅输出JSON。 返回一个对话框对象的数组。 每个对象必须包括“name”和“text”。 如果有社会交往,只包括“act”和“target”。 不要包含空字段或额外字段。 如果还是不行的话有最终处理办法 原文: Best solution: use LM Studio (instead of Ollama) structured output LM Studio can force the model to follow a schema like this, so it can’t break format. Paste below in structured output section in LMStudio {"type":"array","items":{"type":"object","required":["name","text"],"properties":{"name":{"type":"string"},"text":{"type":"string"},"act":{"type":"string","enum":["Insult","Slight","Chat","Kind"]},"target":{"type":"string"}},"additionalProperties":false}} 这是他主要的请求得到的json处理的格式。需要按照上面的格式来进行处理。