mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 00:17:31 +00:00
perf: tool promot and reg slice;query extension prompt (#1576)
This commit is contained in:
@@ -64,4 +64,22 @@ export const getNanoid = (size = 12) => {
|
||||
return `${firstChar}${randomsStr}`;
|
||||
};
|
||||
|
||||
/* Custom text to reg, need to replace special chats */
|
||||
export const replaceRegChars = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
|
||||
/* slice json str */
|
||||
export const sliceJsonStr = (str: string) => {
|
||||
str = str.replace(/(\\n|\\)/g, '').replace(/ /g, '');
|
||||
|
||||
const jsonRegex = /{[^{}]*}/g;
|
||||
const matches = str.match(jsonRegex);
|
||||
|
||||
if (!matches) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// 找到第一个完整的 JSON 字符串
|
||||
const jsonStr = matches[0];
|
||||
|
||||
return jsonStr;
|
||||
};
|
||||
|
@@ -24,6 +24,7 @@ export const RunAppModule: FlowNodeTemplateType = {
|
||||
intro: '可以选择一个其他应用进行调用',
|
||||
showStatus: true,
|
||||
version: '481',
|
||||
isTool: true,
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.runAppSelectApp,
|
||||
|
Reference in New Issue
Block a user