mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-30 10:28:42 +00:00
perf: response key
This commit is contained in:
@@ -3,7 +3,7 @@ import { getErrText } from '@/utils/tools';
|
||||
import { parseStreamChunk } from '@/utils/adapt';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { sseResponse } from '../utils/tools';
|
||||
import { SpecificInputEnum } from '@/constants/app';
|
||||
import { TaskResponseKeyEnum } from '@/constants/app';
|
||||
|
||||
interface Props {
|
||||
res: NextApiResponse; // 用于流转发
|
||||
@@ -45,7 +45,7 @@ export const moduleFetch = ({ url, data, res }: Props) =>
|
||||
const reader = response.body?.getReader();
|
||||
|
||||
let chatResponse: Record<string, any> = {
|
||||
[SpecificInputEnum.answerText]: ''
|
||||
[TaskResponseKeyEnum.answerText]: ''
|
||||
};
|
||||
|
||||
const read = async () => {
|
||||
@@ -85,8 +85,8 @@ export const moduleFetch = ({ url, data, res }: Props) =>
|
||||
if (answer) {
|
||||
chatResponse = {
|
||||
...chatResponse,
|
||||
[SpecificInputEnum.answerText]:
|
||||
chatResponse[SpecificInputEnum.answerText] + answer
|
||||
[TaskResponseKeyEnum.answerText]:
|
||||
chatResponse[TaskResponseKeyEnum.answerText] + answer
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { Schema, model, models, Model } from 'mongoose';
|
||||
import { ChatSchema as ChatType } from '@/types/mongoSchema';
|
||||
import { ChatRoleMap } from '@/constants/chat';
|
||||
import { ChatSourceEnum, ChatSourceMap } from '@/constants/chat';
|
||||
|
||||
const ChatSchema = new Schema({
|
||||
userId: {
|
||||
@@ -32,6 +33,14 @@ const ChatSchema = new Schema({
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
// source: {
|
||||
// type: String,
|
||||
// enum: Object.keys(ChatSourceMap),
|
||||
// required: true
|
||||
// },
|
||||
// shareId: {
|
||||
// type: String
|
||||
// },
|
||||
content: {
|
||||
type: [
|
||||
{
|
||||
|
Reference in New Issue
Block a user