Compare commits
6 Commits
v4.8-previ
...
v4.8-previ
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6247fe11d | ||
|
|
613699fe59 | ||
|
|
c56c28be23 | ||
|
|
89ab17ea2e | ||
|
|
c608f86146 | ||
|
|
0a8b104bd7 |
2
.github/workflows/fastgpt-image.yml
vendored
2
.github/workflows/fastgpt-image.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
- 'projects/app/**'
|
- 'projects/app/**'
|
||||||
- 'packages/**'
|
- 'packages/**'
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*'
|
||||||
jobs:
|
jobs:
|
||||||
build-fastgpt-images:
|
build-fastgpt-images:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
|||||||
|
|
||||||
wx 扫一下加入:
|
wx 扫一下加入:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<a href="#readme">
|
<a href="#readme">
|
||||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export const runToolWithFunctionCall = async (
|
|||||||
> = {};
|
> = {};
|
||||||
item.toolParams.forEach((item) => {
|
item.toolParams.forEach((item) => {
|
||||||
properties[item.key] = {
|
properties[item.key] = {
|
||||||
type: 'string',
|
type: item.valueType || 'string',
|
||||||
description: item.toolDescription || ''
|
description: item.toolDescription || ''
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -76,6 +76,18 @@ export const runToolWithFunctionCall = async (
|
|||||||
messages,
|
messages,
|
||||||
maxTokens: toolModel.maxContext - 500 // filter token. not response maxToken
|
maxTokens: toolModel.maxContext - 500 // filter token. not response maxToken
|
||||||
});
|
});
|
||||||
|
const formativeMessages = filterMessages.map((item) => {
|
||||||
|
if (item.role === ChatCompletionRequestMessageRoleEnum.Assistant && item.function_call) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
function_call: {
|
||||||
|
name: item.function_call?.name,
|
||||||
|
arguments: item.function_call?.arguments
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
|
||||||
/* Run llm */
|
/* Run llm */
|
||||||
const ai = getAIApi({
|
const ai = getAIApi({
|
||||||
@@ -87,7 +99,7 @@ export const runToolWithFunctionCall = async (
|
|||||||
model: toolModel.model,
|
model: toolModel.model,
|
||||||
temperature: 0,
|
temperature: 0,
|
||||||
stream,
|
stream,
|
||||||
messages: filterMessages,
|
messages: formativeMessages,
|
||||||
functions,
|
functions,
|
||||||
function_call: 'auto'
|
function_call: 'auto'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export const runToolWithToolChoice = async (
|
|||||||
> = {};
|
> = {};
|
||||||
item.toolParams.forEach((item) => {
|
item.toolParams.forEach((item) => {
|
||||||
properties[item.key] = {
|
properties[item.key] = {
|
||||||
type: 'string',
|
type: item.valueType || 'string',
|
||||||
description: item.toolDescription || ''
|
description: item.toolDescription || ''
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -86,7 +86,34 @@ export const runToolWithToolChoice = async (
|
|||||||
messages,
|
messages,
|
||||||
maxTokens: toolModel.maxContext - 300 // filter token. not response maxToken
|
maxTokens: toolModel.maxContext - 300 // filter token. not response maxToken
|
||||||
});
|
});
|
||||||
|
const formativeMessages = filterMessages.map((item) => {
|
||||||
|
if (item.role === 'assistant' && item.tool_calls) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
tool_calls: item.tool_calls.map((tool) => ({
|
||||||
|
id: tool.id,
|
||||||
|
type: tool.type,
|
||||||
|
function: tool.function
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
// console.log(
|
||||||
|
// JSON.stringify(
|
||||||
|
// {
|
||||||
|
// ...toolModel?.defaultConfig,
|
||||||
|
// model: toolModel.model,
|
||||||
|
// temperature: 0,
|
||||||
|
// stream,
|
||||||
|
// messages: formativeMessages,
|
||||||
|
// tools,
|
||||||
|
// tool_choice: 'auto'
|
||||||
|
// },
|
||||||
|
// null,
|
||||||
|
// 2
|
||||||
|
// )
|
||||||
|
// );
|
||||||
/* Run llm */
|
/* Run llm */
|
||||||
const ai = getAIApi({
|
const ai = getAIApi({
|
||||||
timeout: 480000
|
timeout: 480000
|
||||||
@@ -97,7 +124,7 @@ export const runToolWithToolChoice = async (
|
|||||||
model: toolModel.model,
|
model: toolModel.model,
|
||||||
temperature: 0,
|
temperature: 0,
|
||||||
stream,
|
stream,
|
||||||
messages: filterMessages,
|
messages: formativeMessages,
|
||||||
tools,
|
tools,
|
||||||
tool_choice: 'auto'
|
tool_choice: 'auto'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
import { addLog } from '../../../../common/system/log';
|
// import { addLog } from '../../../../common/system/log';
|
||||||
const ivm = require('isolated-vm');
|
// const ivm = require('isolated-vm');
|
||||||
|
|
||||||
export const runJsCode = ({
|
// export const runJsCode = ({
|
||||||
code,
|
// code,
|
||||||
variables
|
// variables
|
||||||
}: {
|
// }: {
|
||||||
code: string;
|
// code: string;
|
||||||
variables: Record<string, any>;
|
// variables: Record<string, any>;
|
||||||
}) => {
|
// }) => {
|
||||||
const isolate = new ivm.Isolate({ memoryLimit: 16 });
|
// const isolate = new ivm.Isolate({ memoryLimit: 16 });
|
||||||
const context = isolate.createContextSync();
|
// const context = isolate.createContextSync();
|
||||||
const jail = context.global;
|
// const jail = context.global;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
// custom log function
|
// // custom log function
|
||||||
jail.setSync('responseData', function (args: any): any {
|
// jail.setSync('responseData', function (args: any): any {
|
||||||
if (typeof args === 'object') {
|
// if (typeof args === 'object') {
|
||||||
resolve(args);
|
// resolve(args);
|
||||||
} else {
|
// } else {
|
||||||
reject('Not an invalid response');
|
// reject('Not an invalid response');
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Add global variables
|
// // Add global variables
|
||||||
jail.setSync('variables', new ivm.ExternalCopy(variables).copyInto());
|
// jail.setSync('variables', new ivm.ExternalCopy(variables).copyInto());
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
const scriptCode = `
|
// const scriptCode = `
|
||||||
${code}
|
// ${code}
|
||||||
responseData(main(variables))`;
|
// responseData(main(variables))`;
|
||||||
context.evalSync(scriptCode, { timeout: 2000 });
|
// context.evalSync(scriptCode, { timeout: 2000 });
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
addLog.error('Error during script execution:', err);
|
// addLog.error('Error during script execution:', err);
|
||||||
reject(err);
|
// reject(err);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
|
|||||||
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
||||||
httpResult: rawResponse
|
httpResult: rawResponse
|
||||||
},
|
},
|
||||||
[DispatchNodeResponseKeyEnum.toolResponses]: results,
|
[DispatchNodeResponseKeyEnum.toolResponses]:
|
||||||
|
Object.keys(results).length > 0 ? results : rawResponse,
|
||||||
[NodeOutputKeyEnum.httpRawResponse]: rawResponse,
|
[NodeOutputKeyEnum.httpRawResponse]: rawResponse,
|
||||||
...results
|
...results
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"encoding": "^0.1.13",
|
"encoding": "^0.1.13",
|
||||||
"file-type": "^19.0.0",
|
"file-type": "^19.0.0",
|
||||||
"iconv-lite": "^0.6.3",
|
"iconv-lite": "^0.6.3",
|
||||||
"isolated-vm": "4.7.2",
|
|
||||||
"joplin-turndown-plugin-gfm": "^1.0.12",
|
"joplin-turndown-plugin-gfm": "^1.0.12",
|
||||||
"js-tiktoken": "^1.0.7",
|
"js-tiktoken": "^1.0.7",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
|
|||||||
147
pnpm-lock.yaml
generated
147
pnpm-lock.yaml
generated
@@ -132,9 +132,6 @@ importers:
|
|||||||
iconv-lite:
|
iconv-lite:
|
||||||
specifier: ^0.6.3
|
specifier: ^0.6.3
|
||||||
version: 0.6.3
|
version: 0.6.3
|
||||||
isolated-vm:
|
|
||||||
specifier: 4.7.2
|
|
||||||
version: 4.7.2
|
|
||||||
joplin-turndown-plugin-gfm:
|
joplin-turndown-plugin-gfm:
|
||||||
specifier: ^1.0.12
|
specifier: ^1.0.12
|
||||||
version: 1.0.12
|
version: 1.0.12
|
||||||
@@ -408,7 +405,7 @@ importers:
|
|||||||
specifier: ^4.17.21
|
specifier: ^4.17.21
|
||||||
version: 4.17.21
|
version: 4.17.21
|
||||||
mermaid:
|
mermaid:
|
||||||
specifier: ^10.2.3
|
specifier: 10.2.3
|
||||||
version: 10.2.3
|
version: 10.2.3
|
||||||
nanoid:
|
nanoid:
|
||||||
specifier: ^4.0.1
|
specifier: ^4.0.1
|
||||||
@@ -5267,14 +5264,6 @@ packages:
|
|||||||
safe-buffer: 5.2.1
|
safe-buffer: 5.2.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/bl@4.1.0:
|
|
||||||
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
|
|
||||||
dependencies:
|
|
||||||
buffer: 5.7.1
|
|
||||||
inherits: 2.0.4
|
|
||||||
readable-stream: 3.6.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/bluebird@3.4.7:
|
/bluebird@3.4.7:
|
||||||
resolution: {integrity: sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==}
|
resolution: {integrity: sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -5608,10 +5597,6 @@ packages:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents: 2.3.3
|
fsevents: 2.3.3
|
||||||
|
|
||||||
/chownr@1.1.4:
|
|
||||||
resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/chownr@2.0.0:
|
/chownr@2.0.0:
|
||||||
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
|
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -6364,13 +6349,6 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/decompress-response@6.0.0:
|
|
||||||
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dependencies:
|
|
||||||
mimic-response: 3.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/decompress-tar@4.1.1:
|
/decompress-tar@4.1.1:
|
||||||
resolution: {integrity: sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==}
|
resolution: {integrity: sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
@@ -6431,11 +6409,6 @@ packages:
|
|||||||
type-detect: 4.0.8
|
type-detect: 4.0.8
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/deep-extend@0.6.0:
|
|
||||||
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
|
|
||||||
engines: {node: '>=4.0.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/deep-is@0.1.4:
|
/deep-is@0.1.4:
|
||||||
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
|
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -6503,6 +6476,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==}
|
resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: false
|
dev: false
|
||||||
|
optional: true
|
||||||
|
|
||||||
/detect-node-es@1.1.0:
|
/detect-node-es@1.1.0:
|
||||||
resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==}
|
resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==}
|
||||||
@@ -7437,11 +7411,6 @@ packages:
|
|||||||
strip-final-newline: 3.0.0
|
strip-final-newline: 3.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/expand-template@2.0.3:
|
|
||||||
resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==}
|
|
||||||
engines: {node: '>=6'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/express@4.18.2:
|
/express@4.18.2:
|
||||||
resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==}
|
resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==}
|
||||||
engines: {node: '>= 0.10.0'}
|
engines: {node: '>= 0.10.0'}
|
||||||
@@ -7794,10 +7763,6 @@ packages:
|
|||||||
resolve-pkg-maps: 1.0.0
|
resolve-pkg-maps: 1.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/github-from-package@0.0.0:
|
|
||||||
resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/glob-parent@5.1.2:
|
/glob-parent@5.1.2:
|
||||||
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
|
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
|
||||||
engines: {node: '>= 6'}
|
engines: {node: '>= 6'}
|
||||||
@@ -8165,10 +8130,6 @@ packages:
|
|||||||
/inherits@2.0.4:
|
/inherits@2.0.4:
|
||||||
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
||||||
|
|
||||||
/ini@1.3.8:
|
|
||||||
resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/inline-style-parser@0.1.1:
|
/inline-style-parser@0.1.1:
|
||||||
resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==}
|
resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -8468,14 +8429,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/isolated-vm@4.7.2:
|
|
||||||
resolution: {integrity: sha512-JVEs5gzWObzZK5+OlBplCdYSpokMcdhLSs/xWYYxmYWVfOOFF4oZJsYh7E/FmfX8e7gMioXMpMMeEyX1afuKrg==}
|
|
||||||
engines: {node: '>=16.0.0'}
|
|
||||||
requiresBuild: true
|
|
||||||
dependencies:
|
|
||||||
prebuild-install: 7.1.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/isomorphic-timers-promises@1.0.1:
|
/isomorphic-timers-promises@1.0.1:
|
||||||
resolution: {integrity: sha512-u4sej9B1LPSxTGKB/HiuzvEQnXH0ECYkSVQU39koSwmFAxhlEAFl9RdTvLv4TOTQUgBS5O3O5fwUxk6byBZ+IQ==}
|
resolution: {integrity: sha512-u4sej9B1LPSxTGKB/HiuzvEQnXH0ECYkSVQU39koSwmFAxhlEAFl9RdTvLv4TOTQUgBS5O3O5fwUxk6byBZ+IQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -9456,11 +9409,6 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/mimic-response@3.1.0:
|
|
||||||
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/minimalistic-assert@1.0.1:
|
/minimalistic-assert@1.0.1:
|
||||||
resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==}
|
resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -9500,10 +9448,6 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/mkdirp-classic@0.5.3:
|
|
||||||
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/mkdirp@0.5.6:
|
/mkdirp@0.5.6:
|
||||||
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
|
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@@ -9628,10 +9572,6 @@ packages:
|
|||||||
hasBin: true
|
hasBin: true
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/napi-build-utils@1.0.2:
|
|
||||||
resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/natural-compare@1.4.0:
|
/natural-compare@1.4.0:
|
||||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -9709,13 +9649,6 @@ packages:
|
|||||||
next: 13.5.2(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3)
|
next: 13.5.2(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3)
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/node-abi@3.59.0:
|
|
||||||
resolution: {integrity: sha512-HyyfzvTLCE8b1SX2nWimlra8cibEsypcSu/Az4SXMhWhtuctkwAX7qsEYNjUOIoYtPV884oN3wtYTN+iZKBtvw==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dependencies:
|
|
||||||
semver: 7.6.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/node-cron@3.0.3:
|
/node-cron@3.0.3:
|
||||||
resolution: {integrity: sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==}
|
resolution: {integrity: sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
@@ -10294,25 +10227,6 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
xtend: 4.0.2
|
xtend: 4.0.2
|
||||||
|
|
||||||
/prebuild-install@7.1.2:
|
|
||||||
resolution: {integrity: sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
detect-libc: 2.0.3
|
|
||||||
expand-template: 2.0.3
|
|
||||||
github-from-package: 0.0.0
|
|
||||||
minimist: 1.2.8
|
|
||||||
mkdirp-classic: 0.5.3
|
|
||||||
napi-build-utils: 1.0.2
|
|
||||||
node-abi: 3.59.0
|
|
||||||
pump: 3.0.0
|
|
||||||
rc: 1.2.8
|
|
||||||
simple-get: 4.0.1
|
|
||||||
tar-fs: 2.1.1
|
|
||||||
tunnel-agent: 0.6.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/prelude-ls@1.2.1:
|
/prelude-ls@1.2.1:
|
||||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
@@ -10388,13 +10302,6 @@ packages:
|
|||||||
safe-buffer: 5.2.1
|
safe-buffer: 5.2.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/pump@3.0.0:
|
|
||||||
resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==}
|
|
||||||
dependencies:
|
|
||||||
end-of-stream: 1.4.4
|
|
||||||
once: 1.4.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/punycode@1.4.1:
|
/punycode@1.4.1:
|
||||||
resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==}
|
resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -10453,16 +10360,6 @@ packages:
|
|||||||
unpipe: 1.0.0
|
unpipe: 1.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/rc@1.2.8:
|
|
||||||
resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
deep-extend: 0.6.0
|
|
||||||
ini: 1.3.8
|
|
||||||
minimist: 1.2.8
|
|
||||||
strip-json-comments: 2.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/react-clientside-effect@1.2.6(react@18.2.0):
|
/react-clientside-effect@1.2.6(react@18.2.0):
|
||||||
resolution: {integrity: sha512-XGGGRQAKY+q25Lz9a/4EPqom7WRjz3z9R2k4jhVKA/puQFH/5Nt27vFZYql4m4NVNdUvX8PS3O7r/Zzm7cjUlg==}
|
resolution: {integrity: sha512-XGGGRQAKY+q25Lz9a/4EPqom7WRjz3z9R2k4jhVKA/puQFH/5Nt27vFZYql4m4NVNdUvX8PS3O7r/Zzm7cjUlg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -11157,6 +11054,7 @@ packages:
|
|||||||
/simple-concat@1.0.1:
|
/simple-concat@1.0.1:
|
||||||
resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
|
resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
|
||||||
dev: false
|
dev: false
|
||||||
|
optional: true
|
||||||
|
|
||||||
/simple-get@3.1.1:
|
/simple-get@3.1.1:
|
||||||
resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==}
|
resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==}
|
||||||
@@ -11167,14 +11065,6 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/simple-get@4.0.1:
|
|
||||||
resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==}
|
|
||||||
dependencies:
|
|
||||||
decompress-response: 6.0.0
|
|
||||||
once: 1.4.0
|
|
||||||
simple-concat: 1.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/slash@3.0.0:
|
/slash@3.0.0:
|
||||||
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
|
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@@ -11405,11 +11295,6 @@ packages:
|
|||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/strip-json-comments@2.0.1:
|
|
||||||
resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/strip-json-comments@3.1.1:
|
/strip-json-comments@3.1.1:
|
||||||
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
|
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@@ -11494,15 +11379,6 @@ packages:
|
|||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/tar-fs@2.1.1:
|
|
||||||
resolution: {integrity: sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==}
|
|
||||||
dependencies:
|
|
||||||
chownr: 1.1.4
|
|
||||||
mkdirp-classic: 0.5.3
|
|
||||||
pump: 3.0.0
|
|
||||||
tar-stream: 2.2.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/tar-stream@1.6.2:
|
/tar-stream@1.6.2:
|
||||||
resolution: {integrity: sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==}
|
resolution: {integrity: sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
@@ -11516,17 +11392,6 @@ packages:
|
|||||||
xtend: 4.0.2
|
xtend: 4.0.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/tar-stream@2.2.0:
|
|
||||||
resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==}
|
|
||||||
engines: {node: '>=6'}
|
|
||||||
dependencies:
|
|
||||||
bl: 4.1.0
|
|
||||||
end-of-stream: 1.4.4
|
|
||||||
fs-constants: 1.0.0
|
|
||||||
inherits: 2.0.4
|
|
||||||
readable-stream: 3.6.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/tar@6.2.1:
|
/tar@6.2.1:
|
||||||
resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==}
|
resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -11678,12 +11543,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==}
|
resolution: {integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/tunnel-agent@0.6.0:
|
|
||||||
resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}
|
|
||||||
dependencies:
|
|
||||||
safe-buffer: 5.2.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/tunnel@0.0.6:
|
/tunnel@0.0.6:
|
||||||
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
||||||
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mermaid": "^10.2.3",
|
"mermaid": "10.2.3",
|
||||||
"nanoid": "^4.0.1",
|
"nanoid": "^4.0.1",
|
||||||
"next": "13.5.2",
|
"next": "13.5.2",
|
||||||
"next-i18next": "15.2.0",
|
"next-i18next": "15.2.0",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { useEffect, useRef, memo, useCallback, useState, useMemo } from 'react';
|
import React, { useEffect, useRef, useCallback, useState } from 'react';
|
||||||
import { Box } from '@chakra-ui/react';
|
import { Box } from '@chakra-ui/react';
|
||||||
// @ts-ignore
|
|
||||||
import mermaid from 'mermaid';
|
import mermaid from 'mermaid';
|
||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
api: {
|
api: {
|
||||||
|
sizeLimit: '10mb',
|
||||||
bodyParser: {
|
bodyParser: {
|
||||||
sizeLimit: '16mb'
|
sizeLimit: '16mb'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,17 @@ const OutLink = ({
|
|||||||
const prompts = messages.slice(-2);
|
const prompts = messages.slice(-2);
|
||||||
const completionChatId = chatId ? chatId : nanoid();
|
const completionChatId = chatId ? chatId : nanoid();
|
||||||
|
|
||||||
|
//post message to report chat start
|
||||||
|
window.top?.postMessage(
|
||||||
|
{
|
||||||
|
type: 'shareChatStart',
|
||||||
|
data: {
|
||||||
|
question: prompts[0]?.content
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'*'
|
||||||
|
);
|
||||||
|
|
||||||
const { responseText, responseData } = await streamFetch({
|
const { responseText, responseData } = await streamFetch({
|
||||||
data: {
|
data: {
|
||||||
messages: prompts,
|
messages: prompts,
|
||||||
|
|||||||
Reference in New Issue
Block a user