mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 20:58:12 +00:00
v4.5.1 (#417)
This commit is contained in:
2
projects/app/src/global/core/api/aiReq.d.ts
vendored
2
projects/app/src/global/core/api/aiReq.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { ChatCompletionRequestMessage } from '@fastgpt/core/ai/type';
|
||||
import { ChatCompletionRequestMessage } from '@fastgpt/global/core/ai/type.d';
|
||||
|
||||
export type CreateQuestionGuideParams = {
|
||||
messages: ChatCompletionRequestMessage[];
|
||||
|
@@ -1,6 +1,5 @@
|
||||
export type AdminUpdateFeedbackParams = {
|
||||
import { MarkDataType } from '../dataset/type';
|
||||
|
||||
export type AdminUpdateFeedbackParams = MarkDataType & {
|
||||
chatItemId: string;
|
||||
kbId: string;
|
||||
dataId: string;
|
||||
content: string;
|
||||
};
|
||||
|
61
projects/app/src/global/core/api/datasetReq.d.ts
vendored
61
projects/app/src/global/core/api/datasetReq.d.ts
vendored
@@ -1,8 +1,9 @@
|
||||
import { DatasetTypeEnum } from '@fastgpt/core/dataset/constant';
|
||||
import { DatasetCollectionTypeEnum, DatasetTypeEnum } from '@fastgpt/global/core/dataset/constant';
|
||||
import type { RequestPaging } from '@/types';
|
||||
import { TrainingModeEnum } from '@/constants/plugin';
|
||||
import { TrainingModeEnum } from '@fastgpt/global/core/dataset/constant';
|
||||
import type { SearchTestItemType } from '@/types/core/dataset';
|
||||
import { DatasetDataItemType } from '@/types/core/dataset/data';
|
||||
import { DatasetChunkItemType, UploadChunkItemType } from '@fastgpt/global/core/dataset/type';
|
||||
import { DatasetCollectionSchemaType } from '@fastgpt/global/core/dataset/type';
|
||||
|
||||
/* ===== dataset ===== */
|
||||
export type DatasetUpdateParams = {
|
||||
@@ -22,38 +23,50 @@ export type CreateDatasetParams = {
|
||||
};
|
||||
|
||||
export type SearchTestProps = {
|
||||
kbId: string;
|
||||
datasetId: string;
|
||||
text: string;
|
||||
};
|
||||
|
||||
/* ======= file =========== */
|
||||
export type GetFileListProps = RequestPaging & {
|
||||
kbId: string;
|
||||
searchText: string;
|
||||
/* ======= collections =========== */
|
||||
export type GetDatasetCollectionsProps = RequestPaging & {
|
||||
datasetId: string;
|
||||
parentId?: string;
|
||||
searchText?: string;
|
||||
simple?: boolean;
|
||||
selectFolder?: boolean;
|
||||
};
|
||||
export type CreateDatasetCollectionParams = {
|
||||
datasetId: string;
|
||||
parentId?: string;
|
||||
name: string;
|
||||
type: `${DatasetCollectionTypeEnum}`;
|
||||
metadata?: DatasetCollectionSchemaType['metadata'];
|
||||
updateTime?: string;
|
||||
};
|
||||
export type UpdateDatasetCollectionParams = {
|
||||
id: string;
|
||||
parentId?: string;
|
||||
name?: string;
|
||||
metadata?: DatasetCollectionSchemaType['metadata'];
|
||||
};
|
||||
|
||||
export type UpdateFileProps = { id: string; name?: string; datasetUsed?: boolean };
|
||||
|
||||
export type MarkFileUsedProps = { fileIds: string[] };
|
||||
|
||||
/* ==== data ===== */
|
||||
export type SetOneDatasetDataProps = {
|
||||
id?: string;
|
||||
datasetId: string;
|
||||
collectionId: string;
|
||||
q?: string; // embedding content
|
||||
a?: string; // bonus content
|
||||
};
|
||||
export type PushDataProps = {
|
||||
kbId: string;
|
||||
data: DatasetDataItemType[];
|
||||
collectionId: string;
|
||||
data: DatasetChunkItemType[];
|
||||
mode: `${TrainingModeEnum}`;
|
||||
prompt?: string;
|
||||
billId?: string;
|
||||
};
|
||||
|
||||
export type UpdateDatasetDataPrams = {
|
||||
dataId: string;
|
||||
kbId: string;
|
||||
a?: string;
|
||||
q?: string;
|
||||
};
|
||||
|
||||
export type GetDatasetDataListProps = RequestPaging & {
|
||||
kbId: string;
|
||||
searchText: string;
|
||||
fileId: string;
|
||||
searchText?: string;
|
||||
collectionId: string;
|
||||
};
|
||||
|
@@ -2,11 +2,11 @@ import type { RequestPaging } from '@/types';
|
||||
import { TrainingModeEnum } from '@/constants/plugin';
|
||||
import type { SearchTestItemType } from '@/types/core/dataset';
|
||||
import { DatasetDataItemType } from '@/types/core/dataset/data';
|
||||
import { DatasetCollectionSchemaType } from '@fastgpt/global/core/dataset/type';
|
||||
|
||||
/* ===== dataset ===== */
|
||||
export type SearchTestResponseType = SearchTestItemType['results'];
|
||||
|
||||
/* ======= file =========== */
|
||||
/* ======= collection =========== */
|
||||
|
||||
/* ==== data ===== */
|
||||
export type PushDataResponse = {
|
||||
|
24
projects/app/src/global/core/app/modules/utils.ts
Normal file
24
projects/app/src/global/core/app/modules/utils.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { SystemInputEnum } from '@/constants/app';
|
||||
import { FlowModuleTypeEnum } from '@/constants/flow';
|
||||
import { AppModuleItemType, VariableItemType } from '@/types/app';
|
||||
|
||||
export const getGuideModule = (modules: AppModuleItemType[]) =>
|
||||
modules.find((item) => item.flowType === FlowModuleTypeEnum.userGuide);
|
||||
|
||||
export const splitGuideModule = (guideModules?: AppModuleItemType) => {
|
||||
const welcomeText: string =
|
||||
guideModules?.inputs?.find((item) => item.key === SystemInputEnum.welcomeText)?.value || '';
|
||||
|
||||
const variableModules: VariableItemType[] =
|
||||
guideModules?.inputs.find((item) => item.key === SystemInputEnum.variables)?.value || [];
|
||||
|
||||
const questionGuide: boolean =
|
||||
guideModules?.inputs?.find((item) => item.key === SystemInputEnum.questionGuide)?.value ||
|
||||
false;
|
||||
|
||||
return {
|
||||
welcomeText,
|
||||
variableModules,
|
||||
questionGuide
|
||||
};
|
||||
};
|
5
projects/app/src/global/core/dataset/request.d.ts
vendored
Normal file
5
projects/app/src/global/core/dataset/request.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/* ================= dataset ===================== */
|
||||
|
||||
/* ================= collection ===================== */
|
||||
|
||||
/* ================= data ===================== */
|
23
projects/app/src/global/core/dataset/response.d.ts
vendored
Normal file
23
projects/app/src/global/core/dataset/response.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import { DatasetCollectionSchemaType } from '@fastgpt/global/core/dataset/type.d';
|
||||
|
||||
/* ================= dataset ===================== */
|
||||
|
||||
/* ================= collection ===================== */
|
||||
export type DatasetCollectionsListItemType = {
|
||||
_id: string;
|
||||
parentId?: string;
|
||||
name: string;
|
||||
type: DatasetCollectionSchemaType['type'];
|
||||
updateTime: Date;
|
||||
dataAmount?: number;
|
||||
trainingAmount: number;
|
||||
metadata: DatasetCollectionSchemaType['metadata'];
|
||||
};
|
||||
|
||||
/* ================= data ===================== */
|
||||
export type DatasetDataListItemType = {
|
||||
id: string;
|
||||
q: string; // embedding content
|
||||
a: string; // bonus content
|
||||
};
|
7
projects/app/src/global/core/dataset/type.d.ts
vendored
Normal file
7
projects/app/src/global/core/dataset/type.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export type MarkDataType = {
|
||||
dataId: string;
|
||||
datasetId: string;
|
||||
collectionId: string;
|
||||
q: string;
|
||||
a?: string;
|
||||
};
|
@@ -1,4 +1,4 @@
|
||||
import { PromptTemplateItem } from '@fastgpt/core/ai/type.d';
|
||||
import { PromptTemplateItem } from '@fastgpt/global/core/ai/type.d';
|
||||
|
||||
export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
||||
{
|
||||
@@ -9,7 +9,7 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
||||
{
|
||||
title: '全部变量',
|
||||
desc: '包含 q 和 a 两个变量的标准模板',
|
||||
value: `{instruction:"{{q}}",output:"{{a}}",source:"{{source}}",file_id:"{{file_id}}",index:"{{index}}"}`
|
||||
value: `{instruction:"{{q}}",output:"{{a}}",source:"{{source}}",sourceId:"{{sourceId}}",index:"{{index}}"}`
|
||||
}
|
||||
];
|
||||
|
||||
@@ -24,7 +24,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
||||
对话要求:
|
||||
1. 背景知识是最新的,其中 instruction 是相关介绍,output 是预期回答或补充。
|
||||
2. 使用背景知识回答问题。
|
||||
3. 背景知识无法满足问题时,你需严谨的回答问题。
|
||||
3. 使用对话的风格回答我的问题,答案要和背景知识表述一致。
|
||||
我的问题是:"{{question}}"`
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user