Perf input guide (#1557)

* perf: input guide code

* perf: input guide ui

* Chat input guide api

* Update app chat config store

* perf: app chat config field

* perf: app context

* perf: params

* fix: ts

* perf: filter private config

* perf: filter private config

* perf: import workflow

* perf: limit max tip amount
This commit is contained in:
Archer
2024-05-21 17:52:04 +08:00
committed by GitHub
parent 8e8ceb7439
commit fb368a581c
123 changed files with 2124 additions and 1805 deletions

View File

@@ -1,5 +1,6 @@
import { getUserChatInfoAndAuthTeamPoints } from '@/service/support/permission/auth/team';
import { getNextTimeByCronStringAndTimezone } from '@fastgpt/global/common/string/time';
import { getNanoid } from '@fastgpt/global/common/string/tools';
import { delay } from '@fastgpt/global/common/system/utils';
import { ChatItemValueTypeEnum } from '@fastgpt/global/core/chat/constants';
import {
@@ -28,6 +29,7 @@ export const getScheduleTriggerApp = async () => {
try {
await dispatchWorkFlow({
chatId: getNanoid(),
user,
mode: 'chat',
teamId: String(app.teamId),

View File

@@ -7,7 +7,12 @@ import { addLog } from '@fastgpt/service/common/system/log';
import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils';
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
import { StoreNodeItemType } from '@fastgpt/global/core/workflow/type';
import { getGuideModule, splitGuideModule } from '@fastgpt/global/core/workflow/utils';
import {
getAppChatConfig,
getGuideModule,
splitGuideModule
} from '@fastgpt/global/core/workflow/utils';
import { AppChatConfigType } from '@fastgpt/global/core/app/type';
type Props = {
chatId: string;
@@ -15,6 +20,7 @@ type Props = {
teamId: string;
tmbId: string;
nodes: StoreNodeItemType[];
appChatConfig?: AppChatConfigType;
variables?: Record<string, any>;
isUpdateUseTime: boolean;
source: `${ChatSourceEnum}`;
@@ -30,6 +36,7 @@ export async function saveChat({
teamId,
tmbId,
nodes,
appChatConfig,
variables,
isUpdateUseTime,
source,
@@ -72,7 +79,11 @@ export async function saveChat({
chat.variables = variables || {};
await chat.save({ session });
} else {
const { welcomeText, variableNodes } = splitGuideModule(getGuideModule(nodes));
const { welcomeText, variables: variableList } = getAppChatConfig({
chatConfig: appChatConfig,
systemConfigNode: getGuideModule(nodes),
isPublicFetch: false
});
await MongoChat.create(
[
@@ -81,7 +92,7 @@ export async function saveChat({
teamId,
tmbId,
appId,
variableList: variableNodes,
variableList,
welcomeText,
variables,
title,