mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
4.8.10 test (#2601)
* perf: workflow children run params * feat: workflow userId * fix: ui size * perf: Markdown whitespace and ai images split * fix: openai sdk ts
This commit is contained in:
@@ -151,12 +151,23 @@ export const GPTMessages2Chats = (
|
||||
obj === ChatRoleEnum.System &&
|
||||
item.role === ChatCompletionRequestMessageRoleEnum.System
|
||||
) {
|
||||
value.push({
|
||||
type: ChatItemValueTypeEnum.text,
|
||||
text: {
|
||||
content: item.content
|
||||
}
|
||||
});
|
||||
if (Array.isArray(item.content)) {
|
||||
item.content.forEach((item) => [
|
||||
value.push({
|
||||
type: ChatItemValueTypeEnum.text,
|
||||
text: {
|
||||
content: item.text
|
||||
}
|
||||
})
|
||||
]);
|
||||
} else {
|
||||
value.push({
|
||||
type: ChatItemValueTypeEnum.text,
|
||||
text: {
|
||||
content: item.content
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
obj === ChatRoleEnum.Human &&
|
||||
item.role === ChatCompletionRequestMessageRoleEnum.User
|
||||
|
15
packages/global/core/workflow/runtime/type.d.ts
vendored
15
packages/global/core/workflow/runtime/type.d.ts
vendored
@@ -26,10 +26,15 @@ export type ChatDispatchProps = {
|
||||
res?: NextApiResponse;
|
||||
requestOrigin?: string;
|
||||
mode: 'test' | 'chat' | 'debug';
|
||||
teamId: string; // App teamId
|
||||
tmbId: string; // App tmbId
|
||||
user: UserModelSchema;
|
||||
app: AppDetailType | AppSchema;
|
||||
|
||||
runningAppInfo: {
|
||||
id: string; // May be the id of the system plug-in (cannot be used directly to look up the table)
|
||||
teamId: string;
|
||||
tmbId: string; // App tmbId
|
||||
};
|
||||
uid: string; // Who run this workflow
|
||||
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
@@ -50,10 +55,12 @@ export type ModuleDispatchProps<T> = ChatDispatchProps & {
|
||||
};
|
||||
|
||||
export type SystemVariablesType = {
|
||||
userId: string;
|
||||
appId: string;
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
cTime: string;
|
||||
};
|
||||
|
||||
/* node props */
|
||||
@@ -69,7 +76,7 @@ export type RuntimeNodeItemType = {
|
||||
inputs: FlowNodeInputItemType[];
|
||||
outputs: FlowNodeOutputItemType[];
|
||||
|
||||
pluginId?: string;
|
||||
pluginId?: string; // workflow id / plugin id
|
||||
};
|
||||
|
||||
export type PluginRuntimeType = {
|
||||
|
@@ -17,7 +17,7 @@ import { RunAppModule } from './system/abandoned/runApp/index';
|
||||
import { PluginInputModule } from './system/pluginInput';
|
||||
import { PluginOutputModule } from './system/pluginOutput';
|
||||
import { RunPluginModule } from './system/runPlugin';
|
||||
import { RunAppPluginModule } from './system/runAppPlugin';
|
||||
import { RunAppNode } from './system/runApp';
|
||||
import { AiQueryExtension } from './system/queryExtension';
|
||||
|
||||
import type { FlowNodeTemplateType } from '../type/node';
|
||||
@@ -73,6 +73,6 @@ export const moduleTemplatesFlat: FlowNodeTemplateType[] = [
|
||||
),
|
||||
EmptyNode,
|
||||
RunPluginModule,
|
||||
RunAppPluginModule,
|
||||
RunAppNode,
|
||||
RunAppModule
|
||||
];
|
||||
|
@@ -3,7 +3,7 @@ import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const RunAppPluginModule: FlowNodeTemplateType = {
|
||||
export const RunAppNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.appModule,
|
||||
templateType: FlowNodeTemplateTypeEnum.other,
|
||||
flowNodeType: FlowNodeTypeEnum.appModule,
|
@@ -326,27 +326,6 @@ export const updatePluginInputByVariables = (
|
||||
);
|
||||
};
|
||||
|
||||
/* Remove pluginInput variables from global variables
|
||||
(completions api: Plugin input get value from global variables)
|
||||
*/
|
||||
export const removePluginInputVariables = (
|
||||
variables: Record<string, any>,
|
||||
nodes: RuntimeNodeItemType[]
|
||||
) => {
|
||||
const pluginInputNode = nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput);
|
||||
|
||||
if (!pluginInputNode) return variables;
|
||||
return Object.keys(variables).reduce(
|
||||
(acc, key) => {
|
||||
if (!pluginInputNode.inputs.find((input) => input.key === key)) {
|
||||
acc[key] = variables[key];
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
);
|
||||
};
|
||||
|
||||
// replace {{$xx.xx$}} variables for text
|
||||
export function replaceEditorVariable({
|
||||
text,
|
||||
|
Reference in New Issue
Block a user