mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
fix: delete dataset field error (#3925)
* fix: collection list count * fix: collection list count * update doc * perf: tts selector ui * fix: delete dataset field error * doc
This commit is contained in:
@@ -75,7 +75,7 @@ const TTSSelect = ({
|
||||
{voice ? (
|
||||
<Flex alignItems={'center'}>
|
||||
<Box>{provider.label}</Box>
|
||||
<Box>-</Box>
|
||||
<Box>/</Box>
|
||||
<Box>{voice.label}</Box>
|
||||
</Flex>
|
||||
) : (
|
||||
@@ -83,7 +83,7 @@ const TTSSelect = ({
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}, [formatValue, selectorList, t]);
|
||||
}, [formatValue, selectorList]);
|
||||
|
||||
const { playAudioByText, cancelAudio, audioLoading, audioPlaying } = useAudioPlay({
|
||||
appId,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { MongoMemoryReplSet } from 'mongodb-memory-server';
|
||||
import mongoose from 'mongoose';
|
||||
import { parseHeaderCertMock } from '@/test/utils';
|
||||
import { parseHeaderCertMock } from '@fastgpt/service/test/utils';
|
||||
import { initMockData, root } from './db/init';
|
||||
import { faker } from '@faker-js/faker/locale/zh_CN';
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import '@/pages/api/__mocks__/base';
|
||||
import { parseReasoningStreamContent } from '@fastgpt/global/core/workflow/runtime/utils';
|
||||
import { parseReasoningStreamContent } from '@fastgpt/service/core/ai/utils';
|
||||
|
||||
test('Parse reasoning stream content test', async () => {
|
||||
const partList = [
|
||||
|
@@ -17,7 +17,10 @@ import {
|
||||
} from '@fastgpt/service/common/string/tiktoken/index';
|
||||
import { pushDataListToTrainingQueueByCollectionId } from '@fastgpt/service/core/dataset/training/controller';
|
||||
import { loadRequestMessages } from '@fastgpt/service/core/chat/utils';
|
||||
import { llmCompletionsBodyFormat, llmStreamResponseToText } from '@fastgpt/service/core/ai/utils';
|
||||
import {
|
||||
llmCompletionsBodyFormat,
|
||||
llmStreamResponseToAnswerText
|
||||
} from '@fastgpt/service/core/ai/utils';
|
||||
|
||||
const reduceQueue = () => {
|
||||
global.qaQueueLen = global.qaQueueLen > 0 ? global.qaQueueLen - 1 : 0;
|
||||
@@ -124,7 +127,7 @@ ${replaceVariable(Prompt_AgentQA.fixedText, { text })}`;
|
||||
modelData
|
||||
)
|
||||
});
|
||||
const answer = await llmStreamResponseToText(chatResponse);
|
||||
const answer = await llmStreamResponseToAnswerText(chatResponse);
|
||||
|
||||
const qaArr = formatSplitText(answer, text); // 格式化后的QA对
|
||||
|
||||
|
@@ -1,94 +0,0 @@
|
||||
import { ERROR_ENUM } from '@fastgpt/global/common/error/errorCode';
|
||||
|
||||
export type TestTokenType = {
|
||||
userId: string;
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
isRoot: boolean;
|
||||
};
|
||||
|
||||
export type TestRequest = {
|
||||
headers: {
|
||||
cookie?: {
|
||||
token?: TestTokenType;
|
||||
};
|
||||
authorization?: string; // testkey
|
||||
rootkey?: string; // rootkey
|
||||
};
|
||||
query: {
|
||||
[key: string]: string;
|
||||
};
|
||||
body: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
|
||||
export function getTestRequest<Q = any, B = any>({
|
||||
query = {},
|
||||
body = {},
|
||||
authToken = true,
|
||||
// authRoot = false,
|
||||
// authApiKey = false,
|
||||
user
|
||||
}: {
|
||||
query?: Partial<Q>;
|
||||
body?: Partial<B>;
|
||||
authToken?: boolean;
|
||||
authRoot?: boolean;
|
||||
authApiKey?: boolean;
|
||||
user?: {
|
||||
uid: string;
|
||||
tmbId: string;
|
||||
teamId: string;
|
||||
isRoot: boolean;
|
||||
};
|
||||
}): [any, any] {
|
||||
const headers: TestRequest['headers'] = {};
|
||||
if (authToken) {
|
||||
headers.cookie = {
|
||||
token: {
|
||||
userId: String(user?.uid || ''),
|
||||
teamId: String(user?.teamId || ''),
|
||||
tmbId: String(user?.tmbId || ''),
|
||||
isRoot: user?.isRoot || false
|
||||
}
|
||||
};
|
||||
}
|
||||
return [
|
||||
{
|
||||
headers,
|
||||
query,
|
||||
body
|
||||
},
|
||||
{}
|
||||
];
|
||||
}
|
||||
|
||||
export const parseHeaderCertMock = async ({
|
||||
req,
|
||||
authToken = true,
|
||||
authRoot = false,
|
||||
authApiKey = false
|
||||
}: {
|
||||
req: TestRequest;
|
||||
authToken?: boolean;
|
||||
authRoot?: boolean;
|
||||
authApiKey?: boolean;
|
||||
}): Promise<TestTokenType> => {
|
||||
if (authToken) {
|
||||
const token = req.headers?.cookie?.token;
|
||||
if (!token) {
|
||||
return Promise.reject(ERROR_ENUM.unAuthorization);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
// if (authRoot) {
|
||||
// // TODO: unfinished
|
||||
// return req.headers.rootkey;
|
||||
// }
|
||||
// if (authApiKey) {
|
||||
// // TODO: unfinished
|
||||
// return req.headers.authorization;
|
||||
// }
|
||||
return {} as any;
|
||||
};
|
Reference in New Issue
Block a user