Revert "sub plan page (#885)" (#886)

This reverts commit 443ad37b6a.
This commit is contained in:
Archer
2024-02-23 17:48:15 +08:00
committed by GitHub
parent 443ad37b6a
commit fd9b6291af
246 changed files with 4281 additions and 6286 deletions

View File

@@ -1,8 +1,5 @@
import type { moduleDispatchResType, ChatItemType } from '@fastgpt/global/core/chat/type.d';
import type {
ModuleDispatchProps,
ModuleDispatchResponse
} from '@fastgpt/global/core/module/type.d';
import type { ModuleDispatchProps } from '@fastgpt/global/core/module/type.d';
import { SelectAppItemType } from '@fastgpt/global/core/module/type';
import { dispatchModules } from '../index';
import { MongoApp } from '@fastgpt/service/core/app/schema';
@@ -18,10 +15,11 @@ type Props = ModuleDispatchProps<{
[ModuleInputKeyEnum.history]?: ChatItemType[] | number;
app: SelectAppItemType;
}>;
type Response = ModuleDispatchResponse<{
type Response = {
[ModuleOutputKeyEnum.responseData]: moduleDispatchResType[];
[ModuleOutputKeyEnum.answerText]: string;
[ModuleOutputKeyEnum.history]: ChatItemType[];
}>;
};
export const dispatchAppRequest = async (props: Props): Promise<Response> => {
const {
@@ -32,7 +30,6 @@ export const dispatchAppRequest = async (props: Props): Promise<Response> => {
histories,
params: { userChatInput, history, app }
} = props;
let start = Date.now();
if (!userChatInput) {
return Promise.reject('Input is empty');
@@ -59,7 +56,7 @@ export const dispatchAppRequest = async (props: Props): Promise<Response> => {
const chatHistories = getHistories(history, histories);
const { responseData, moduleDispatchBills, answerText } = await dispatchModules({
const { responseData, answerText } = await dispatchModules({
...props,
appId: app.id,
modules: appData.modules,
@@ -81,20 +78,7 @@ export const dispatchAppRequest = async (props: Props): Promise<Response> => {
]);
return {
[ModuleOutputKeyEnum.responseData]: {
moduleLogo: appData.avatar,
query: userChatInput,
textOutput: answerText,
totalPoints: responseData.reduce((sum, item) => sum + (item.totalPoints || 0), 0)
},
[ModuleOutputKeyEnum.moduleDispatchBills]: [
{
moduleName: appData.name,
totalPoints: responseData.reduce((sum, item) => sum + (item.totalPoints || 0), 0),
charsLength: 0,
model: appData.name
}
],
responseData,
answerText: answerText,
history: completeMessages
};