labring / FastGPT

FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, and visual AI workflow orchestration, letting you easily develop and deploy complex question-answering systems without the need for extensive setup or configuration.
https://fastgpt.in
Other
15.23k stars 3.97k forks source link

js输出总是取不到要取的字段 #1909

Closed ppkitty closed 1 day ago

ppkitty commented 3 days ago

例行检查

你的版本

问题描述, 日志截图 用js模块取json里面的值,输出为: { "codeReturn": { "result": "pending" }, "log": "" } js模块中自定义输出放了2个:codeReturn(any类型),result(string类型),codeReturn可以拿到结果,结果为: { "result": "pending" } 但result总是取不到

复现步骤

预期结果

相关截图

c121914yu commented 3 days ago

这是个啥?

ppkitty commented 3 days ago

找到原因了,result要在js代码中赋值,打扰了

c121914yu commented 3 days ago

~ok,,下次麻烦直接贴图和代码,这表述看着怪怪的。

ppkitty commented 3 days ago

不好意思,刚看错了,还是有问题。以下是js代码: function main({ json }) { let statusValue = "";
try { const json1 = JSON.parse(json); if (json && json1.results && json1.results.length > 0) { statusValue = json1.results[0].status; } else { statusValue = "Invalid JSON structure"; } } catch (error) { statusValue = "Error processing JSON:" + error.message; } return { result: statusValue }; } js模块自定义输出为:

c121914yu commented 3 days ago

return { result: statusValue }; 不就只有一个输出么~ codeReturn是啥乱七八糟的

ppkitty commented 3 days ago

在调试中看输出结果就长这样: { "codeReturn": { "result": "pending" }, "log": "" } 也不知道哪里出了问题。之前都可以取出来,唯一变化是中间我们尝试装了npm的2个库,装了之后输出就变成这样了: npm install es6-promise npm install compromise

c121914yu commented 3 days ago

直接写 result 就能提了

ppkitty commented 2 days ago

如果是自定义输出字段就是提不出来result(始终为空),只能提出codeReturn。尝试再加一个js模块从codeReturn提取result,给我的结果依然是这个格式: { "codeReturn": { "result": "pending" }, "log": "" }

c121914yu commented 2 days ago

没看懂,我写个 result 就能提出来了

image image
ppkitty commented 1 day ago

今天升级到4.8.5就好了,之前输出格式一直有问题

c121914yu commented 1 day ago

今天升级到4.8.5就好了,之前输出格式一直有问题

严重怀疑,是不是你 sandbox 和 fastgpt 版本不一致

ppkitty commented 1 day ago

是的,后来跟负责搭建系统的同事确认了