目录

Obsidian中Text-Generate接入智谱清言报错JSON-parse-error

Obsidian中Text Generate接入智谱清言报错:JSON parse error

一、问题描述

双击空格,触发自动建议时报错:error:{message:“JSON parse error: Cannot construct instance of java.util.ArrayList (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (‘.’); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of java.util.ArrayList (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (‘.’)\n at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 142] (through reference chain: com.wd.paas.api.domain.v4.chat.ChatCompletionRequest[“stop”])”,code:‘400’}} https://i-blog.csdnimg.cn/direct/5fb162cec8d844cf86479d6cccbb664b.png

二、原因及解决方案

1、原因:ctrl + shift + i 打开控制台后,再次双击空格触发自动建议时,查看上传的参数,stop中含有报错提示中所说的 英文句号,

https://i-blog.csdnimg.cn/direct/4c9802c61e7c408cb8278f0712e5bebc.png

2、参考智谱清言API开发文档, ,glm-4-flash模型免费;其中请求参数stop为list形式,而上送的为字符串形式,所以导致了解析错误;

https://i-blog.csdnimg.cn/direct/99a6f1cb65c04bd993ba892433972f91.png

https://i-blog.csdnimg.cn/direct/b12d922873ae483aa45e3c5222594f0d.png

3、解决方案:选择设置,将Advance mode 打开,自定义上送参数,将上送body体中的stop改为[“{ {stop}}”]形式,关闭设置,重新双击空格即可;

https://i-blog.csdnimg.cn/direct/4e6a91aae6d246b6978ee18d3d0ebcd6.png

https://i-blog.csdnimg.cn/direct/682a96c8f653473c9ee9492c0e904f19.png

https://i-blog.csdnimg.cn/direct/e8217714673a46bcb8ed5ede1987af7b.png