mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
4.8.12 test (#3006)
* perf: oneapi error tip * fix: qps limit condition error * perf: Plan tip * fix: permission modal ui * perf: dataset slider ui * perf: api key auth tmbId problem * perf: dataset upload i18n * fix: http json path check
This commit is contained in:
@@ -45,6 +45,7 @@ import { computedMaxToken, llmCompletionsBodyFormat } from '../../../ai/utils';
|
||||
import { WorkflowResponseType } from '../type';
|
||||
import { formatTime2YMDHM } from '@fastgpt/global/common/string/time';
|
||||
import { AiChatQuoteRoleType } from '@fastgpt/global/core/workflow/template/system/aiChat/type';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
|
||||
export type ChatProps = ModuleDispatchProps<
|
||||
AIChatNodeProps & {
|
||||
@@ -262,7 +263,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
});
|
||||
|
||||
if (user.openaiAccount?.baseUrl) {
|
||||
return Promise.reject(`您的 OpenAI key 出错了: ${JSON.stringify(requestBody)}`);
|
||||
return Promise.reject(`您的 OpenAI key 出错了: ${getErrText(error)}`);
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
|
@@ -240,13 +240,22 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
|
||||
.forEach((item) => {
|
||||
const key = item.key.startsWith('$') ? item.key : `$.${item.key}`;
|
||||
results[item.key] = (() => {
|
||||
// 检查是否是简单的属性访问或单一索引访问
|
||||
if (/^\$(\.[a-zA-Z_][a-zA-Z0-9_]*)+$/.test(key) || /^\$(\[\d+\])+$/.test(key)) {
|
||||
return JSONPath({ path: key, json: formatResponse })[0];
|
||||
const result = JSONPath({ path: key, json: formatResponse });
|
||||
|
||||
// 如果结果为空,返回 undefined
|
||||
if (!result || result.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// 如果无法确定,默认返回数组
|
||||
return JSONPath({ path: key, json: formatResponse });
|
||||
// 以下情况返回数组:
|
||||
// 1. 使用通配符 *
|
||||
// 2. 使用数组切片 [start:end]
|
||||
// 3. 使用过滤表达式 [?(...)]
|
||||
// 4. 使用递归下降 ..
|
||||
// 5. 使用多个结果运算符 ,
|
||||
const needArrayResult = /[*]|[\[][:?]|\.\.|\,/.test(key);
|
||||
|
||||
return needArrayResult ? result : result[0];
|
||||
})();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user