mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
rename variables
This commit is contained in:
parent
0e7af38c85
commit
e20ee81d62
|
|
@ -7,7 +7,7 @@ const PlaygroundVisibilityConfigFieldsSchema = z.object({
|
|||
example: true,
|
||||
description: '是否显示运行状态'
|
||||
}),
|
||||
showQuote: z.boolean().meta({
|
||||
showCite: z.boolean().meta({
|
||||
example: true,
|
||||
description: '是否显示引用'
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export type OutLinkSchema<T extends OutlinkAppType = undefined> = {
|
|||
type: PublishChannelEnum;
|
||||
|
||||
// whether to show the quote
|
||||
showQuote: boolean;
|
||||
showCite: boolean;
|
||||
// whether to show the running status
|
||||
showRunningStatus?: boolean;
|
||||
// whether to show the full text reader
|
||||
|
|
@ -94,7 +94,7 @@ export type OutLinkSchema<T extends OutlinkAppType = undefined> = {
|
|||
export type OutLinkEditType<T = undefined> = {
|
||||
_id?: string;
|
||||
name: string;
|
||||
showQuote?: OutLinkSchema<T>['showQuote'];
|
||||
showCite?: OutLinkSchema<T>['showCite'];
|
||||
showRunningStatus?: OutLinkSchema<T>['showRunningStatus'];
|
||||
showFullText?: OutLinkSchema<T>['showFullText'];
|
||||
canDownloadSource?: OutLinkSchema<T>['canDownloadSource'];
|
||||
|
|
@ -110,7 +110,7 @@ export type OutLinkEditType<T = undefined> = {
|
|||
|
||||
export const PlaygroundVisibilityConfigSchema = z.object({
|
||||
showRunningStatus: z.boolean(),
|
||||
showQuote: z.boolean(),
|
||||
showCite: z.boolean(),
|
||||
showFullText: z.boolean(),
|
||||
canDownloadSource: z.boolean()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const OutLinkSchema = new Schema({
|
|||
type: Date
|
||||
},
|
||||
|
||||
showQuote: {
|
||||
showCite: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ const DingTalk = ({ appId }: { appId: string }) => {
|
|||
name: item.name,
|
||||
limit: item.limit,
|
||||
app: item.app,
|
||||
showQuote: item.showQuote,
|
||||
showCite: item.showCite,
|
||||
defaultResponse: item.defaultResponse,
|
||||
immediateResponse: item.immediateResponse
|
||||
});
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ const FeiShu = ({ appId }: { appId: string }) => {
|
|||
name: item.name,
|
||||
limit: item.limit,
|
||||
app: item.app,
|
||||
showQuote: item.showQuote,
|
||||
showCite: item.showCite,
|
||||
defaultResponse: item.defaultResponse,
|
||||
immediateResponse: item.immediateResponse
|
||||
});
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ const Share = ({ appId }: { appId: string; type: PublishChannelEnum }) => {
|
|||
}`
|
||||
: ''}
|
||||
</Td>
|
||||
<Td>{item.showQuote ? '✔' : '✖'}</Td>
|
||||
<Td>{item.showCite ? '✔' : '✖'}</Td>
|
||||
{feConfigs?.isPlus && (
|
||||
<>
|
||||
<Td>{item?.limit?.QPM || '-'}</Td>
|
||||
|
|
@ -182,7 +182,7 @@ const Share = ({ appId }: { appId: string; type: PublishChannelEnum }) => {
|
|||
setEditLinkData({
|
||||
_id: item._id,
|
||||
name: item.name,
|
||||
showQuote: item.showQuote ?? false,
|
||||
showCite: item.showCite ?? false,
|
||||
canDownloadSource: item.canDownloadSource ?? false,
|
||||
showFullText: item.showFullText ?? true,
|
||||
showRunningStatus: item.showRunningStatus ?? false,
|
||||
|
|
@ -281,7 +281,7 @@ function EditLinkModal({
|
|||
defaultValues: defaultData
|
||||
});
|
||||
|
||||
const showQuote = watch('showQuote');
|
||||
const showCite = watch('showCite');
|
||||
const showFullText = watch('showFullText');
|
||||
const canDownloadSource = watch('canDownloadSource');
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ function EditLinkModal({
|
|||
></QuestionTip>
|
||||
</Flex>
|
||||
<Switch
|
||||
{...register('showQuote', {
|
||||
{...register('showCite', {
|
||||
onChange(e) {
|
||||
if (!e.target.checked) {
|
||||
setValue('showFullText', false);
|
||||
|
|
@ -432,7 +432,7 @@ function EditLinkModal({
|
|||
}
|
||||
}
|
||||
})}
|
||||
isChecked={showQuote}
|
||||
isChecked={showCite}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} mt={4} justify={'space-between'} height={'36px'}>
|
||||
|
|
@ -449,7 +449,7 @@ function EditLinkModal({
|
|||
if (!e.target.checked) {
|
||||
setValue('canDownloadSource', false);
|
||||
} else {
|
||||
setValue('showQuote', true);
|
||||
setValue('showCite', true);
|
||||
}
|
||||
}
|
||||
})}
|
||||
|
|
@ -469,7 +469,7 @@ function EditLinkModal({
|
|||
onChange(e) {
|
||||
if (e.target.checked) {
|
||||
setValue('showFullText', true);
|
||||
setValue('showQuote', true);
|
||||
setValue('showCite', true);
|
||||
}
|
||||
}
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ const OffiAccount = ({ appId }: { appId: string }) => {
|
|||
name: item.name,
|
||||
limit: item.limit,
|
||||
app: item.app,
|
||||
showQuote: item.showQuote,
|
||||
showCite: item.showCite,
|
||||
defaultResponse: item.defaultResponse,
|
||||
immediateResponse: item.immediateResponse
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
|
|||
|
||||
const defaultPlaygroundVisibilityForm: PlaygroundVisibilityConfigType = {
|
||||
showRunningStatus: true,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true
|
||||
};
|
||||
|
|
@ -28,7 +28,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
defaultValues: defaultPlaygroundVisibilityForm
|
||||
});
|
||||
|
||||
const showQuote = watch('showQuote');
|
||||
const showCite = watch('showCite');
|
||||
const showFullText = watch('showFullText');
|
||||
const canDownloadSource = watch('canDownloadSource');
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
onSuccess: (data) => {
|
||||
reset({
|
||||
showRunningStatus: data.showRunningStatus,
|
||||
showQuote: data.showQuote,
|
||||
showCite: data.showCite,
|
||||
showFullText: data.showFullText,
|
||||
canDownloadSource: data.canDownloadSource
|
||||
});
|
||||
|
|
@ -123,7 +123,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
<QuestionTip ml={1} label={t('common:support.outlink.share.Response Quote tips')} />
|
||||
</Flex>
|
||||
<Switch
|
||||
{...register('showQuote', {
|
||||
{...register('showCite', {
|
||||
onChange(e) {
|
||||
if (!e.target.checked) {
|
||||
setValue('showFullText', false);
|
||||
|
|
@ -132,7 +132,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
autoSave();
|
||||
}
|
||||
})}
|
||||
isChecked={showQuote}
|
||||
isChecked={showCite}
|
||||
/>
|
||||
</Flex>
|
||||
</Grid>
|
||||
|
|
@ -149,7 +149,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
if (!e.target.checked) {
|
||||
setValue('canDownloadSource', false);
|
||||
} else {
|
||||
setValue('showQuote', true);
|
||||
setValue('showCite', true);
|
||||
}
|
||||
autoSave();
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
onChange(e) {
|
||||
if (e.target.checked) {
|
||||
setValue('showFullText', true);
|
||||
setValue('showQuote', true);
|
||||
setValue('showCite', true);
|
||||
}
|
||||
autoSave();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ const Wecom = ({ appId }: { appId: string }) => {
|
|||
name: item.name,
|
||||
limit: item.limit,
|
||||
app: item.app,
|
||||
showQuote: item.showQuote,
|
||||
showCite: item.showCite,
|
||||
defaultResponse: item.defaultResponse,
|
||||
immediateResponse: item.immediateResponse
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export type ResponseType = {
|
|||
* 2. 为所有 share 类型的 OutLink 记录添加 showFullText 字段
|
||||
* 3. 重命名字段:
|
||||
* - showNodeStatus -> showRunningStatus
|
||||
* - responseDetail -> showQuote
|
||||
* - responseDetail -> showCite
|
||||
* - showRawSource -> canDownloadSource
|
||||
*/
|
||||
|
||||
|
|
@ -171,11 +171,11 @@ async function migrateOutLinkData(): Promise<{
|
|||
);
|
||||
}
|
||||
|
||||
// 3. 重命名字段:responseDetail -> showQuote
|
||||
// 3. 重命名字段:responseDetail -> showCite
|
||||
const responseDetailLinks = await outLinkCollection
|
||||
.find({
|
||||
responseDetail: { $exists: true },
|
||||
showQuote: { $exists: false }
|
||||
showCite: { $exists: false }
|
||||
})
|
||||
.toArray();
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ async function migrateOutLinkData(): Promise<{
|
|||
filter: { _id: link._id },
|
||||
update: [
|
||||
{
|
||||
$set: { showQuote: '$responseDetail' }
|
||||
$set: { showCite: '$responseDetail' }
|
||||
},
|
||||
{
|
||||
$unset: 'responseDetail'
|
||||
|
|
@ -197,12 +197,12 @@ async function migrateOutLinkData(): Promise<{
|
|||
const renameResponseDetailResult = await outLinkCollection.bulkWrite(renameResponseDetailOps);
|
||||
totalUpdated += renameResponseDetailResult.modifiedCount;
|
||||
updateResults.push({
|
||||
operation: 'Rename responseDetail to showQuote',
|
||||
operation: 'Rename responseDetail to showCite',
|
||||
updated: renameResponseDetailResult.modifiedCount
|
||||
});
|
||||
|
||||
console.log(
|
||||
`Renamed responseDetail to showQuote for ${renameResponseDetailResult.modifiedCount} links`
|
||||
`Renamed responseDetail to showCite for ${renameResponseDetailResult.modifiedCount} links`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ async function handler(
|
|||
};
|
||||
}
|
||||
|
||||
const [app, { showQuote, showRunningStatus, authType }] = await Promise.all([
|
||||
const [app, { showCite, showRunningStatus, authType }] = await Promise.all([
|
||||
MongoApp.findById(appId, 'type').lean(),
|
||||
authChatCrud({
|
||||
req,
|
||||
|
|
@ -81,7 +81,7 @@ async function handler(
|
|||
if (item.obj === ChatRoleEnum.AI) {
|
||||
item.responseData = filterPublicNodeResponseData({
|
||||
nodeRespones: item.responseData,
|
||||
responseDetail: showQuote
|
||||
responseDetail: showCite
|
||||
});
|
||||
|
||||
if (showRunningStatus === false) {
|
||||
|
|
@ -90,7 +90,7 @@ async function handler(
|
|||
}
|
||||
});
|
||||
}
|
||||
if (!showQuote) {
|
||||
if (!showCite) {
|
||||
histories.forEach((item) => {
|
||||
if (item.obj === ChatRoleEnum.AI) {
|
||||
item.value = removeAIResponseCite(item.value, false);
|
||||
|
|
@ -99,7 +99,7 @@ async function handler(
|
|||
}
|
||||
|
||||
return {
|
||||
list: isPlugin ? histories : transformPreviewHistories(histories, showQuote),
|
||||
list: isPlugin ? histories : transformPreviewHistories(histories, showCite),
|
||||
total
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ async function handler(
|
|||
};
|
||||
}
|
||||
|
||||
const [app, { showQuote, showRunningStatus, authType }] = await Promise.all([
|
||||
const [app, { showCite, showRunningStatus, authType }] = await Promise.all([
|
||||
MongoApp.findById(appId, 'type').lean(),
|
||||
authChatCrud({
|
||||
req,
|
||||
|
|
@ -93,7 +93,7 @@ async function handler(
|
|||
if (item.obj === ChatRoleEnum.AI) {
|
||||
item.responseData = filterPublicNodeResponseData({
|
||||
nodeRespones: item.responseData,
|
||||
responseDetail: showQuote
|
||||
responseDetail: showCite
|
||||
});
|
||||
|
||||
if (showRunningStatus === false) {
|
||||
|
|
@ -102,7 +102,7 @@ async function handler(
|
|||
}
|
||||
});
|
||||
}
|
||||
if (!showQuote) {
|
||||
if (!showCite) {
|
||||
result.histories.forEach((item) => {
|
||||
if (item.obj === ChatRoleEnum.AI) {
|
||||
item.value = removeAIResponseCite(item.value, false);
|
||||
|
|
@ -110,7 +110,7 @@ async function handler(
|
|||
});
|
||||
}
|
||||
|
||||
const list = isPlugin ? result.histories : transformPreviewHistories(result.histories, showQuote);
|
||||
const list = isPlugin ? result.histories : transformPreviewHistories(result.histories, showCite);
|
||||
|
||||
return {
|
||||
list: list.map((item) => ({
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ async function handler(
|
|||
return [];
|
||||
}
|
||||
|
||||
const [{ showQuote }, chatData, nodeResponses] = await Promise.all([
|
||||
const [{ showCite }, chatData, nodeResponses] = await Promise.all([
|
||||
authChatCrud({
|
||||
req,
|
||||
authToken: true,
|
||||
|
|
@ -57,7 +57,7 @@ async function handler(
|
|||
const flowResponses = chatData.responseData?.length ? chatData.responseData : nodeResponses;
|
||||
return req.query.shareId
|
||||
? filterPublicNodeResponseData({
|
||||
responseDetail: showQuote,
|
||||
responseDetail: showCite,
|
||||
nodeRespones: flowResponses
|
||||
})
|
||||
: flowResponses;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ async function handler(req: ApiRequestProps<GetQuoteProps>): Promise<GetQuotesRe
|
|||
datasetDataIdList
|
||||
} = req.body;
|
||||
|
||||
const [{ chat, showQuote }, chatItem] = await Promise.all([
|
||||
const [{ chat, showCite }, chatItem] = await Promise.all([
|
||||
authChatCrud({
|
||||
req,
|
||||
authToken: true,
|
||||
|
|
@ -53,7 +53,7 @@ async function handler(req: ApiRequestProps<GetQuoteProps>): Promise<GetQuotesRe
|
|||
MongoChatItem.findOne({ appId, chatId, dataId: chatItemDataId }, 'time').lean(),
|
||||
authCollectionInChat({ appId, chatId, chatItemDataId, collectionIds: collectionIdList })
|
||||
]);
|
||||
if (!chat || !chatItem || !showQuote) return Promise.reject(ChatErrEnum.unAuthChat);
|
||||
if (!chat || !chatItem || !showCite) return Promise.reject(ChatErrEnum.unAuthChat);
|
||||
|
||||
const list = await MongoDatasetData.find(
|
||||
{ _id: { $in: datasetDataIdList }, collectionId: { $in: collectionIdList } },
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ async function handler(req: ApiRequestProps<GetQuoteDataProps>): Promise<GetQuot
|
|||
return Promise.reject(i18nT('common:data_not_found'));
|
||||
}
|
||||
|
||||
const [collection, { showQuote }] = await Promise.all([
|
||||
const [collection, { showCite }] = await Promise.all([
|
||||
MongoDatasetCollection.findById(datasetData.collectionId).lean(),
|
||||
authChatCrud({
|
||||
req,
|
||||
|
|
@ -73,7 +73,7 @@ async function handler(req: ApiRequestProps<GetQuoteDataProps>): Promise<GetQuot
|
|||
if (!collection) {
|
||||
return Promise.reject('Can not find the collection');
|
||||
}
|
||||
if (!showQuote) {
|
||||
if (!showCite) {
|
||||
return Promise.reject(ChatErrEnum.unAuthChat);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ async function handler(
|
|||
appId,
|
||||
type: PublishChannelEnum.playground
|
||||
},
|
||||
'showRunningStatus showQuote showFullText canDownloadSource'
|
||||
'showRunningStatus showCite showFullText canDownloadSource'
|
||||
).lean();
|
||||
|
||||
return PlaygroundVisibilityConfigResponseSchema.parse({
|
||||
showRunningStatus: existingConfig?.showRunningStatus ?? true,
|
||||
showQuote: existingConfig?.showQuote ?? true,
|
||||
showCite: existingConfig?.showCite ?? true,
|
||||
showFullText: existingConfig?.showFullText ?? true,
|
||||
canDownloadSource: existingConfig?.canDownloadSource ?? true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
} from '@fastgpt/global/support/outLink/api.d';
|
||||
|
||||
async function handler(req: ApiRequestProps<UpdatePlaygroundVisibilityConfigBody, {}>) {
|
||||
const { appId, showRunningStatus, showQuote, showFullText, canDownloadSource } =
|
||||
const { appId, showRunningStatus, showCite, showFullText, canDownloadSource } =
|
||||
UpdatePlaygroundVisibilityConfigBodySchema.parse(req.body);
|
||||
|
||||
const { teamId, tmbId } = await authApp({
|
||||
|
|
@ -33,7 +33,7 @@ async function handler(req: ApiRequestProps<UpdatePlaygroundVisibilityConfigBody
|
|||
appId,
|
||||
type: PublishChannelEnum.playground,
|
||||
showRunningStatus: showRunningStatus ?? true,
|
||||
showQuote: showQuote ?? true,
|
||||
showCite: showCite ?? true,
|
||||
showFullText: showFullText ?? true,
|
||||
canDownloadSource: canDownloadSource ?? true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export type OutLinkUpdateResponse = string;
|
|||
async function handler(
|
||||
req: ApiRequestProps<OutLinkUpdateBody, OutLinkUpdateQuery>
|
||||
): Promise<OutLinkUpdateResponse> {
|
||||
const { _id, name, showQuote, limit, app, canDownloadSource, showRunningStatus, showFullText } =
|
||||
const { _id, name, showCite, limit, app, canDownloadSource, showRunningStatus, showFullText } =
|
||||
req.body;
|
||||
|
||||
if (!_id) {
|
||||
|
|
@ -47,7 +47,7 @@ async function handler(
|
|||
|
||||
const doc = await MongoOutLink.findByIdAndUpdate(_id, {
|
||||
name,
|
||||
showQuote,
|
||||
showCite,
|
||||
canDownloadSource,
|
||||
showRunningStatus,
|
||||
showFullText,
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ type AuthResponseType = {
|
|||
teamId: string;
|
||||
tmbId: string;
|
||||
app: AppSchema;
|
||||
showQuote?: boolean;
|
||||
showCite?: boolean;
|
||||
showRunningStatus?: boolean;
|
||||
authType: `${AuthUserTypeEnum}`;
|
||||
apikey?: string;
|
||||
|
|
@ -157,7 +157,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
teamId,
|
||||
tmbId,
|
||||
app,
|
||||
showQuote,
|
||||
showCite,
|
||||
authType,
|
||||
sourceName,
|
||||
apikey,
|
||||
|
|
@ -205,7 +205,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
|
||||
pushTrack.teamChatQPM({ teamId });
|
||||
|
||||
retainDatasetCite = retainDatasetCite && !!showQuote;
|
||||
retainDatasetCite = retainDatasetCite && !!showCite;
|
||||
const isPlugin = app.type === AppTypeEnum.workflowTool;
|
||||
|
||||
// Check message type
|
||||
|
|
@ -388,7 +388,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
/* select fe response field */
|
||||
const feResponseData = responseAllData
|
||||
? flowResponses
|
||||
: filterPublicNodeResponseData({ nodeRespones: flowResponses, responseDetail: showQuote });
|
||||
: filterPublicNodeResponseData({ nodeRespones: flowResponses, responseDetail: showCite });
|
||||
|
||||
if (stream) {
|
||||
workflowResponseWrite({
|
||||
|
|
@ -508,7 +508,7 @@ const authShareChat = async ({
|
|||
shareId: string;
|
||||
chatId?: string;
|
||||
}): Promise<AuthResponseType> => {
|
||||
const { teamId, tmbId, appId, authType, showQuote, showRunningStatus, uid, sourceName } =
|
||||
const { teamId, tmbId, appId, authType, showCite, showRunningStatus, uid, sourceName } =
|
||||
await authOutLinkChatStart(data);
|
||||
const app = await MongoApp.findById(appId).lean();
|
||||
|
||||
|
|
@ -530,7 +530,7 @@ const authShareChat = async ({
|
|||
apikey: '',
|
||||
authType,
|
||||
responseAllData: false,
|
||||
showQuote,
|
||||
showCite,
|
||||
outLinkUserId: uid,
|
||||
showRunningStatus
|
||||
};
|
||||
|
|
@ -569,7 +569,7 @@ const authTeamSpaceChat = async ({
|
|||
authType: AuthUserTypeEnum.outLink,
|
||||
apikey: '',
|
||||
responseAllData: false,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
outLinkUserId: uid
|
||||
};
|
||||
};
|
||||
|
|
@ -651,7 +651,7 @@ const authHeaderRequest = async ({
|
|||
authType,
|
||||
sourceName,
|
||||
responseAllData: true,
|
||||
showQuote: true
|
||||
showCite: true
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ type AuthResponseType = {
|
|||
teamId: string;
|
||||
tmbId: string;
|
||||
app: AppSchema;
|
||||
showQuote?: boolean;
|
||||
showCite?: boolean;
|
||||
showRunningStatus?: boolean;
|
||||
authType: `${AuthUserTypeEnum}`;
|
||||
apikey?: string;
|
||||
|
|
@ -158,7 +158,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
teamId,
|
||||
tmbId,
|
||||
app,
|
||||
showQuote,
|
||||
showCite,
|
||||
authType,
|
||||
sourceName,
|
||||
apikey,
|
||||
|
|
@ -206,7 +206,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
|
||||
pushTrack.teamChatQPM({ teamId });
|
||||
|
||||
retainDatasetCite = retainDatasetCite && !!showQuote;
|
||||
retainDatasetCite = retainDatasetCite && !!showCite;
|
||||
const isPlugin = app.type === AppTypeEnum.workflowTool;
|
||||
|
||||
// Check message type
|
||||
|
|
@ -321,7 +321,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
maxRunTimes: WORKFLOW_MAX_RUN_TIMES,
|
||||
workflowStreamResponse: workflowResponseWrite,
|
||||
responseAllData,
|
||||
responseDetail: showQuote
|
||||
responseDetail: showCite
|
||||
});
|
||||
}
|
||||
return Promise.reject('您的工作流版本过低,请重新发布一次');
|
||||
|
|
@ -390,7 +390,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
/* select fe response field */
|
||||
const feResponseData = responseAllData
|
||||
? flowResponses
|
||||
: filterPublicNodeResponseData({ nodeRespones: flowResponses, responseDetail: showQuote });
|
||||
: filterPublicNodeResponseData({ nodeRespones: flowResponses, responseDetail: showCite });
|
||||
|
||||
if (stream) {
|
||||
workflowResponseWrite({
|
||||
|
|
@ -503,7 +503,7 @@ const authShareChat = async ({
|
|||
shareId: string;
|
||||
chatId?: string;
|
||||
}): Promise<AuthResponseType> => {
|
||||
const { teamId, tmbId, appId, authType, showQuote, showRunningStatus, uid, sourceName } =
|
||||
const { teamId, tmbId, appId, authType, showCite, showRunningStatus, uid, sourceName } =
|
||||
await authOutLinkChatStart(data);
|
||||
const app = await MongoApp.findById(appId).lean();
|
||||
|
||||
|
|
@ -525,7 +525,7 @@ const authShareChat = async ({
|
|||
apikey: '',
|
||||
authType,
|
||||
responseAllData: false,
|
||||
showQuote,
|
||||
showCite,
|
||||
outLinkUserId: uid,
|
||||
showRunningStatus
|
||||
};
|
||||
|
|
@ -564,7 +564,7 @@ const authTeamSpaceChat = async ({
|
|||
authType: AuthUserTypeEnum.outLink,
|
||||
apikey: '',
|
||||
responseAllData: false,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
outLinkUserId: uid
|
||||
};
|
||||
};
|
||||
|
|
@ -646,7 +646,7 @@ const authHeaderRequest = async ({
|
|||
authType,
|
||||
sourceName,
|
||||
responseAllData: true,
|
||||
showQuote: true
|
||||
showCite: true
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ const Render = (props: {
|
|||
appId: string;
|
||||
isStandalone?: string;
|
||||
showRunningStatus: boolean;
|
||||
showQuote: boolean;
|
||||
showCite: boolean;
|
||||
showFullText: boolean;
|
||||
canDownloadSource: boolean;
|
||||
}) => {
|
||||
|
|
@ -150,7 +150,7 @@ const Render = (props: {
|
|||
showRouteToDatasetDetail={isStandalone !== '1'}
|
||||
showRunningStatus={props.showRunningStatus}
|
||||
canDownloadSource={props.canDownloadSource}
|
||||
isShowQuote={props.showQuote}
|
||||
isShowQuote={props.showCite}
|
||||
isShowFullText={props.showFullText}
|
||||
>
|
||||
<ChatRecordContextProvider params={chatRecordProviderParams}>
|
||||
|
|
@ -176,7 +176,7 @@ export async function getServerSideProps(context: any) {
|
|||
appId,
|
||||
type: PublishChannelEnum.playground
|
||||
},
|
||||
'showRunningStatus showQuote showFullText canDownloadSource'
|
||||
'showRunningStatus showCite showFullText canDownloadSource'
|
||||
).lean();
|
||||
|
||||
return config;
|
||||
|
|
@ -190,7 +190,7 @@ export async function getServerSideProps(context: any) {
|
|||
props: {
|
||||
appId,
|
||||
showRunningStatus: chatQuoteReaderConfig?.showRunningStatus ?? true,
|
||||
showQuote: chatQuoteReaderConfig?.showQuote ?? true,
|
||||
showCite: chatQuoteReaderConfig?.showCite ?? true,
|
||||
showFullText: chatQuoteReaderConfig?.showFullText ?? true,
|
||||
canDownloadSource: chatQuoteReaderConfig?.canDownloadSource ?? true,
|
||||
...(await serviceSideProps(context, ['file', 'app', 'chat', 'workflow']))
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ export async function getServerSideProps(context: any) {
|
|||
{
|
||||
shareId
|
||||
},
|
||||
'appId canDownloadSource showQuote showFullText showRunningStatus'
|
||||
'appId canDownloadSource showCite showFullText showRunningStatus'
|
||||
)
|
||||
.populate<{ associatedApp: AppSchema }>('associatedApp', 'name avatar intro')
|
||||
.lean();
|
||||
|
|
@ -433,7 +433,7 @@ export async function getServerSideProps(context: any) {
|
|||
appAvatar: app?.associatedApp?.avatar ?? '',
|
||||
appIntro: app?.associatedApp?.intro ?? 'AI',
|
||||
canDownloadSource: app?.canDownloadSource ?? false,
|
||||
isShowQuote: app?.showQuote ?? false,
|
||||
isShowQuote: app?.showCite ?? false,
|
||||
isShowFullText: app?.showFullText ?? false,
|
||||
showRunningStatus: app?.showRunningStatus ?? false,
|
||||
shareId: shareId ?? '',
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
|
|||
Chat没有读写的权限之分,鉴权过了,都可以操作。
|
||||
*/
|
||||
export const defaultResponseShow = {
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true
|
||||
|
|
@ -55,7 +55,7 @@ export async function authChatCrud({
|
|||
tmbId: string;
|
||||
uid: string;
|
||||
chat?: ChatSchemaType;
|
||||
showQuote: boolean;
|
||||
showCite: boolean;
|
||||
showRunningStatus: boolean;
|
||||
showFullText: boolean;
|
||||
canDownloadSource: boolean;
|
||||
|
|
@ -111,7 +111,7 @@ export async function authChatCrud({
|
|||
teamId: String(outLinkConfig.teamId),
|
||||
tmbId: String(outLinkConfig.tmbId),
|
||||
uid,
|
||||
showQuote: outLinkConfig.showQuote,
|
||||
showCite: outLinkConfig.showCite,
|
||||
showRunningStatus: outLinkConfig.showRunningStatus ?? true,
|
||||
showFullText: outLinkConfig.showFullText ?? false,
|
||||
canDownloadSource: outLinkConfig.canDownloadSource ?? false,
|
||||
|
|
@ -126,7 +126,7 @@ export async function authChatCrud({
|
|||
teamId: String(outLinkConfig.teamId),
|
||||
tmbId: String(outLinkConfig.tmbId),
|
||||
uid,
|
||||
showQuote: outLinkConfig.showQuote,
|
||||
showCite: outLinkConfig.showCite,
|
||||
showRunningStatus: outLinkConfig.showRunningStatus ?? true,
|
||||
showFullText: outLinkConfig.showFullText ?? false,
|
||||
canDownloadSource: outLinkConfig.canDownloadSource ?? false,
|
||||
|
|
@ -139,7 +139,7 @@ export async function authChatCrud({
|
|||
tmbId: String(outLinkConfig.tmbId),
|
||||
chat,
|
||||
uid,
|
||||
showQuote: outLinkConfig.showQuote,
|
||||
showCite: outLinkConfig.showCite,
|
||||
showRunningStatus: outLinkConfig.showRunningStatus ?? true,
|
||||
showFullText: outLinkConfig.showFullText ?? false,
|
||||
canDownloadSource: outLinkConfig.canDownloadSource ?? false,
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export async function authOutLinkChatStart({
|
|||
teamId: outLinkConfig.teamId,
|
||||
tmbId: outLinkConfig.tmbId,
|
||||
authType: AuthUserTypeEnum.token,
|
||||
showQuote: outLinkConfig.showQuote,
|
||||
showCite: outLinkConfig.showCite,
|
||||
showRunningStatus: outLinkConfig.showRunningStatus,
|
||||
showFullText: outLinkConfig.showFullText,
|
||||
canDownloadSource: outLinkConfig.canDownloadSource,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export const defaultApp: AppDetailType = {
|
|||
export const defaultOutLinkForm: OutLinkEditType = {
|
||||
name: '',
|
||||
showRunningStatus: true,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: false,
|
||||
canDownloadSource: false,
|
||||
limit: {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ describe('Playground Visibility Config API', () => {
|
|||
expect(res.error).toBeUndefined();
|
||||
expect(res.data).toEqual({
|
||||
showRunningStatus: true,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true
|
||||
});
|
||||
|
|
@ -70,7 +70,7 @@ describe('Playground Visibility Config API', () => {
|
|||
name: 'Playground Chat',
|
||||
type: PublishChannelEnum.playground,
|
||||
showRunningStatus: false,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: false,
|
||||
canDownloadSource: false,
|
||||
usagePoints: 0,
|
||||
|
|
@ -89,7 +89,7 @@ describe('Playground Visibility Config API', () => {
|
|||
expect(res.error).toBeUndefined();
|
||||
expect(res.data).toEqual({
|
||||
showRunningStatus: false,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: false,
|
||||
canDownloadSource: false
|
||||
});
|
||||
|
|
@ -132,7 +132,7 @@ describe('Playground Visibility Config API', () => {
|
|||
name: 'Playground Chat',
|
||||
type: PublishChannelEnum.playground,
|
||||
showRunningStatus: true,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: true,
|
||||
canDownloadSource: false,
|
||||
usagePoints: 0,
|
||||
|
|
@ -151,7 +151,7 @@ describe('Playground Visibility Config API', () => {
|
|||
expect(res.error).toBeUndefined();
|
||||
expect(res.data).toEqual({
|
||||
showRunningStatus: true,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: true,
|
||||
canDownloadSource: false
|
||||
});
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ describe('Playground Visibility Update API', () => {
|
|||
const updateData: UpdatePlaygroundVisibilityConfigBody = {
|
||||
appId: testApp._id,
|
||||
showRunningStatus: false,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: false,
|
||||
canDownloadSource: false
|
||||
};
|
||||
|
|
@ -64,7 +64,7 @@ describe('Playground Visibility Update API', () => {
|
|||
expect(createdConfig.appId).toBe(testApp._id);
|
||||
expect(createdConfig.type).toBe(PublishChannelEnum.playground);
|
||||
expect(createdConfig.showRunningStatus).toBe(false);
|
||||
expect(createdConfig.showQuote).toBe(false);
|
||||
expect(createdConfig.showCite).toBe(false);
|
||||
expect(createdConfig.showFullText).toBe(false);
|
||||
expect(createdConfig.canDownloadSource).toBe(false);
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ describe('Playground Visibility Update API', () => {
|
|||
const updateData: UpdatePlaygroundVisibilityConfigBody = {
|
||||
appId: testApp._id,
|
||||
showRunningStatus: true,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true
|
||||
};
|
||||
|
|
@ -101,7 +101,7 @@ describe('Playground Visibility Update API', () => {
|
|||
|
||||
if (createdConfig) {
|
||||
expect(createdConfig.showRunningStatus).toBe(true);
|
||||
expect(createdConfig.showQuote).toBe(true);
|
||||
expect(createdConfig.showCite).toBe(true);
|
||||
expect(createdConfig.showFullText).toBe(true);
|
||||
expect(createdConfig.canDownloadSource).toBe(true);
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ describe('Playground Visibility Update API', () => {
|
|||
const updateData: UpdatePlaygroundVisibilityConfigBody = {
|
||||
appId: testApp._id,
|
||||
showRunningStatus: false,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showFullText: false,
|
||||
canDownloadSource: true
|
||||
};
|
||||
|
|
@ -138,7 +138,7 @@ describe('Playground Visibility Update API', () => {
|
|||
|
||||
if (createdConfig) {
|
||||
expect(createdConfig.showRunningStatus).toBe(false);
|
||||
expect(createdConfig.showQuote).toBe(true);
|
||||
expect(createdConfig.showCite).toBe(true);
|
||||
expect(createdConfig.showFullText).toBe(false);
|
||||
expect(createdConfig.canDownloadSource).toBe(true);
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ describe('Playground Visibility Update API', () => {
|
|||
const updateData: UpdatePlaygroundVisibilityConfigBody = {
|
||||
appId: '',
|
||||
showRunningStatus: false,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: false,
|
||||
canDownloadSource: false
|
||||
};
|
||||
|
|
@ -185,7 +185,7 @@ describe('Playground Visibility Update API', () => {
|
|||
const updateData: UpdatePlaygroundVisibilityConfigBody = {
|
||||
appId: testApp._id,
|
||||
showRunningStatus: false,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: false,
|
||||
canDownloadSource: false
|
||||
};
|
||||
|
|
@ -233,7 +233,7 @@ describe('Playground Visibility Update API', () => {
|
|||
name: 'Playground Chat',
|
||||
type: PublishChannelEnum.playground,
|
||||
showRunningStatus: true,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
usagePoints: 0,
|
||||
|
|
@ -244,7 +244,7 @@ describe('Playground Visibility Update API', () => {
|
|||
const updateData: UpdatePlaygroundVisibilityConfigBody = {
|
||||
appId: testApp2._id,
|
||||
showRunningStatus: false,
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showFullText: true,
|
||||
canDownloadSource: true
|
||||
};
|
||||
|
|
@ -266,7 +266,7 @@ describe('Playground Visibility Update API', () => {
|
|||
|
||||
if (config1) {
|
||||
expect(config1.showRunningStatus).toBe(true);
|
||||
expect(config1.showQuote).toBe(true);
|
||||
expect(config1.showCite).toBe(true);
|
||||
}
|
||||
|
||||
// Verify second app config was created with new values
|
||||
|
|
@ -277,7 +277,7 @@ describe('Playground Visibility Update API', () => {
|
|||
|
||||
if (config2) {
|
||||
expect(config2.showRunningStatus).toBe(false);
|
||||
expect(config2.showQuote).toBe(false);
|
||||
expect(config2.showCite).toBe(false);
|
||||
expect(config2.showFullText).toBe(true);
|
||||
expect(config2.canDownloadSource).toBe(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ describe('authChatCrud', () => {
|
|||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
uid: 'user1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -117,7 +117,7 @@ describe('authChatCrud', () => {
|
|||
tmbId: 'tmb1',
|
||||
uid: 'user1',
|
||||
chat: mockChat,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -147,7 +147,7 @@ describe('authChatCrud', () => {
|
|||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
uid: 'user1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -189,7 +189,7 @@ describe('authChatCrud', () => {
|
|||
outLinkConfig: {
|
||||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
canDownloadSource: true
|
||||
},
|
||||
|
|
@ -209,7 +209,7 @@ describe('authChatCrud', () => {
|
|||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
uid: 'user1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: false,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -222,7 +222,7 @@ describe('authChatCrud', () => {
|
|||
outLinkConfig: {
|
||||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
shareId: 'share1',
|
||||
outLinkUid: 'user1'
|
||||
},
|
||||
|
|
@ -242,7 +242,7 @@ describe('authChatCrud', () => {
|
|||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
uid: 'user1',
|
||||
showQuote: false,
|
||||
showCite: false,
|
||||
showRunningStatus: true, // default
|
||||
canDownloadSource: false, // default
|
||||
authType: AuthUserTypeEnum.outLink
|
||||
|
|
@ -259,7 +259,7 @@ describe('authChatCrud', () => {
|
|||
outLinkConfig: {
|
||||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
canDownloadSource: true
|
||||
},
|
||||
|
|
@ -285,7 +285,7 @@ describe('authChatCrud', () => {
|
|||
tmbId: 'tmb1',
|
||||
uid: 'user1',
|
||||
chat: mockChat,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: false,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -298,7 +298,7 @@ describe('authChatCrud', () => {
|
|||
outLinkConfig: {
|
||||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: false,
|
||||
canDownloadSource: true
|
||||
},
|
||||
|
|
@ -323,7 +323,7 @@ describe('authChatCrud', () => {
|
|||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
uid: 'user1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: false,
|
||||
showFullText: false,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -341,7 +341,7 @@ describe('authChatCrud', () => {
|
|||
outLinkConfig: {
|
||||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showFullText: true,
|
||||
showRunningStatus: true,
|
||||
canDownloadSource: true
|
||||
|
|
@ -437,7 +437,7 @@ describe('authChatCrud', () => {
|
|||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
uid: 'tmb1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -477,7 +477,7 @@ describe('authChatCrud', () => {
|
|||
tmbId: 'tmb1',
|
||||
uid: 'tmb1',
|
||||
chat: mockChat,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -518,7 +518,7 @@ describe('authChatCrud', () => {
|
|||
tmbId: 'tmb1',
|
||||
uid: 'tmb1',
|
||||
chat: mockChat,
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
|
|
@ -551,7 +551,7 @@ describe('authChatCrud', () => {
|
|||
teamId: 'team1',
|
||||
tmbId: 'tmb1',
|
||||
uid: 'tmb1',
|
||||
showQuote: true,
|
||||
showCite: true,
|
||||
showRunningStatus: true,
|
||||
showFullText: true,
|
||||
canDownloadSource: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue