V4.9.1 feature (#4206)
* fix: remove DefaultTeam (#4037) * fix :Get application bound knowledge base information logical rewrite (#4057) * fix :Get application bound knowledge base information logical rewrite * fix :Get application bound knowledge base information logical rewrite * fix :Get application bound knowledge base information logical rewrite * fix :Get application bound knowledge base information logical rewrite * update package * fix: import dataset step error;perf: ai proxy avatar (#4074) * perf: pg config params * perf: ai proxy avatar * fix: import dataset step error * feat: data input ux * perf: app dataset rewite * fix: 文本提取不支持arrayString,arrayNumber等jsonSchema (#4079) * update doc ;perf: model test (#4098) * perf: extract array * update doc * perf: model test * perf: model test * perf: think tag parse (#4102) * chat quote reader (#3912) * init chat quote full text reader * linked structure * dataset data linked * optimize code * fix ts build * test finish * delete log * fix * fix ts * fix ts * remove nextId * initial scroll * fix * fix * perf: chunk read (#4109) * package * perf: chunk read * feat: api dataset support pdf parse;fix: chunk reader auth (#4117) * feat: api dataset support pdf parse * fix: chunk reader auth * feat: invitation link (#3979) * feat: invitation link schema and apis * feat: add invitation link * feat: member status: active, leave, forbidden * fix: expires show hours and minutes * feat: invalid invitation link hint * fix: typo * chore: fix typo & i18n * fix * pref: fe * feat: add ttl index for 30-day-clean-up * perf: invite member code (#4118) * perf: invite member code * fix: ts * fix: model test channel id;fix: quote reader (#4123) * fix: model test channel id * fix: quote reader * fix chat quote reader (#4125) * perf: model test;perf: sidebar trigger (#4127) * fix: import dataset step error;perf: ai proxy avatar (#4074) * perf: pg config params * perf: ai proxy avatar * fix: import dataset step error * feat: data input ux * perf: app dataset rewite * perf: model test * perf: sidebar trigger * lock * update nanoid version * fix: select component ux * fix: ts * fix: vitest * remove test * fix: prompt toolcall ui (#4139) * load log error adapt * fix: prompt toolcall ui * perf: commercial function tip * update package * pref: copy link (#4147) * fix(i18n): namespace (#4143) * hiden dataset source (#4152) * hiden dataset source * perf: reader * chore: move all tests into a single folder (#4160) * fix modal close scroll (#4162) * fix modal close scroll * update refresh * feat: rerank modal select and weight (#4164) * fix loadInitData refresh (#4169) * fix * fix * form input number default & api dataset max token * feat: mix search weight (#4170) * feat: mix search weight * feat: svg render * fix: avatar error remove (#4173) * fix: avatar error remove * fix: index * fix: guide * fix: auth * update package;fix: input data model ui (#4181) * update package * fix: ts * update config * update jieba package * add type sign * fix: input data ui * fix: page title refresh (#4186) * fix: ts * update jieba package * fix: page title refresh * fix: remove member length check when opening invite create modal (#4193) * add env to check internal ip (#4187) * fix: ts * update jieba package * add env to check internal ip * package * fix: jieba * reset package * update config * fix: jieba package * init shell * init version * change team reload * update jieba package (#4200) * update jieba package * package * update package * remove invalid code * action * package (#4201) * package * update package * remove invalid code * package * remove i18n tip (#4202) * doc (#4205) * fix: i18n (#4208) * fix: next config (#4207) * reset package * i18n * update config * i18n * remove log --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com> Co-authored-by: gggaaallleee <91131304+gggaaallleee@users.noreply.github.com> Co-authored-by: shilin <39396378+shilin66@users.noreply.github.com> Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
15
projects/app/src/web/common/i18n/utils.ts
Normal file
15
projects/app/src/web/common/i18n/utils.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { I18nNsType } from '@fastgpt/web/types/i18next';
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
||||
|
||||
export const serviceSideProps = async (content: any, ns: I18nNsType = []) => {
|
||||
const lang = content.req?.cookies?.NEXT_LOCALE || content.locale;
|
||||
const extraLng = content.req?.cookies?.NEXT_LOCALE ? undefined : content.locales;
|
||||
|
||||
// Device size
|
||||
const deviceSize = content.req?.cookies?.NEXT_DEVICE_SIZE || null;
|
||||
|
||||
return {
|
||||
...(await serverSideTranslations(lang, ['common', ...ns], undefined, extraLng)),
|
||||
deviceSize
|
||||
};
|
||||
};
|
||||
@@ -6,7 +6,7 @@ import { OAuthEnum } from '@fastgpt/global/support/user/constant';
|
||||
import type {
|
||||
TTSModelType,
|
||||
LLMModelItemType,
|
||||
ReRankModelItemType,
|
||||
RerankModelItemType,
|
||||
EmbeddingModelItemType,
|
||||
STTModelType
|
||||
} from '@fastgpt/global/core/ai/model.d';
|
||||
@@ -56,7 +56,7 @@ type State = {
|
||||
getVlmModelList: () => LLMModelItemType[];
|
||||
embeddingModelList: EmbeddingModelItemType[];
|
||||
ttsModelList: TTSModelType[];
|
||||
reRankModelList: ReRankModelItemType[];
|
||||
reRankModelList: RerankModelItemType[];
|
||||
sttModelList: STTModelType[];
|
||||
initStaticData: (e: InitDateResponse) => void;
|
||||
appType?: string;
|
||||
|
||||
@@ -4,13 +4,8 @@ import { TFunction } from 'i18next';
|
||||
|
||||
type I18nContextType = {
|
||||
commonT: TFunction<['common'], undefined>;
|
||||
appT: TFunction<['app'], undefined>;
|
||||
datasetT: TFunction<['dataset'], undefined>;
|
||||
fileT: TFunction<['file'], undefined>;
|
||||
publishT: TFunction<['publish'], undefined>;
|
||||
workflowT: TFunction<['workflow'], undefined>;
|
||||
userT: TFunction<['user'], undefined>;
|
||||
chatT: TFunction<['chat'], undefined>;
|
||||
};
|
||||
|
||||
export const I18nContext = createContext<I18nContextType>({
|
||||
@@ -20,25 +15,15 @@ export const I18nContext = createContext<I18nContextType>({
|
||||
|
||||
const I18nContextProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const { t: commonT } = useTranslation('common');
|
||||
const { t: appT } = useTranslation('app');
|
||||
const { t: datasetT } = useTranslation('dataset');
|
||||
const { t: fileT } = useTranslation('file');
|
||||
const { t: publishT } = useTranslation('publish');
|
||||
const { t: workflowT } = useTranslation('workflow');
|
||||
const { t: userT } = useTranslation('user');
|
||||
const { t: chatT } = useTranslation('chat');
|
||||
|
||||
return (
|
||||
<I18nContext.Provider
|
||||
value={{
|
||||
commonT,
|
||||
appT,
|
||||
datasetT,
|
||||
fileT,
|
||||
publishT,
|
||||
workflowT,
|
||||
userT,
|
||||
chatT
|
||||
workflowT
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { deleteQuery } from '@/pages/api/core/ai/model/delete';
|
||||
import type { SystemModelItemType } from '@fastgpt/service/core/ai/type';
|
||||
import type { updateWithJsonBody } from '@/pages/api/core/ai/model/updateWithJson';
|
||||
import type { updateDefaultBody } from '@/pages/api/core/ai/model/updateDefault';
|
||||
import type { testQuery } from '@/pages/api/core/ai/model/test';
|
||||
|
||||
export const getSystemModelList = () => GET<listResponse>('/core/ai/model/list');
|
||||
export const getSystemModelDetail = (model: string) =>
|
||||
@@ -21,7 +22,7 @@ export const getModelConfigJson = () => GET<string>('/core/ai/model/getConfigJso
|
||||
export const putUpdateWithJson = (data: updateWithJsonBody) =>
|
||||
PUT('/core/ai/model/updateWithJson', data);
|
||||
|
||||
export const getTestModel = (model: String) => GET('/core/ai/model/test', { model });
|
||||
export const getTestModel = (data: testQuery) => GET('/core/ai/model/test', data);
|
||||
|
||||
export const putUpdateDefaultModels = (data: updateDefaultBody) =>
|
||||
PUT('/core/ai/model/updateDefault', data);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { GET, POST, DELETE, PUT } from '@/web/common/api/request';
|
||||
import type { AppDetailType, AppListItemType } from '@fastgpt/global/core/app/type.d';
|
||||
import type { GetAppChatLogsParams } from '@/global/core/api/appReq.d';
|
||||
import { AppUpdateParams, AppChangeOwnerBody } from '@/global/core/app/api';
|
||||
import type { AppUpdateParams, AppChangeOwnerBody } from '@/global/core/app/api';
|
||||
import type { CreateAppBody } from '@/pages/api/core/app/create';
|
||||
import type { ListAppBody } from '@/pages/api/core/app/list';
|
||||
import { AppLogsListItemType } from '@/types/app';
|
||||
import { PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { AppLogsListItemType } from '@/types/app';
|
||||
import type { PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
|
||||
/**
|
||||
* 获取应用列表
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DELETE, GET, POST } from '@/web/common/api/request';
|
||||
import type { CreateAppFolderBody } from '@/pages/api/core/app/folder/create';
|
||||
import { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import type { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import type { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import type {
|
||||
transitionWorkflowBody,
|
||||
transitionWorkflowResponse
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
UpdateAppCollaboratorBody,
|
||||
AppCollaboratorDeleteParams
|
||||
} from '@fastgpt/global/core/app/collaborator';
|
||||
import { DELETE, GET, POST } from '@/web/common/api/request';
|
||||
import { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator';
|
||||
import type { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator';
|
||||
|
||||
export const getCollaboratorList = (appId: string) =>
|
||||
GET<CollaboratorItemType[]>('/proApi/core/app/collaborator/list', { appId });
|
||||
|
||||
@@ -11,9 +11,12 @@ import { defaultNodeVersion, FlowNodeTypeEnum } from '@fastgpt/global/core/workf
|
||||
import { FlowNodeTemplateTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import type { GetPreviewNodeQuery } from '@/pages/api/core/app/plugin/getPreviewNode';
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import { ParentIdType, ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import { GetSystemPluginTemplatesBody } from '@/pages/api/core/app/plugin/getSystemPluginTemplates';
|
||||
import { PluginGroupSchemaType } from '@fastgpt/service/core/app/plugin/type';
|
||||
import type {
|
||||
ParentIdType,
|
||||
ParentTreePathItemType
|
||||
} from '@fastgpt/global/common/parentFolder/type';
|
||||
import type { GetSystemPluginTemplatesBody } from '@/pages/api/core/app/plugin/getSystemPluginTemplates';
|
||||
import type { PluginGroupSchemaType } from '@fastgpt/service/core/app/plugin/type';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { defaultGroup } from '@fastgpt/web/core/workflow/constants';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ListParams } from '@/pages/api/core/app/template/list';
|
||||
import type { ListParams } from '@/pages/api/core/app/template/list';
|
||||
import { GET } from '@/web/common/api/request';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { AppTemplateSchemaType, TemplateTypeSchemaType } from '@fastgpt/global/core/app/type';
|
||||
import type { AppTemplateSchemaType, TemplateTypeSchemaType } from '@fastgpt/global/core/app/type';
|
||||
import { defaultTemplateTypes } from '@fastgpt/web/core/workflow/constants';
|
||||
|
||||
export const getTemplateMarketItemList = (data: ListParams) =>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PostPublishAppProps } from '@/global/core/app/api';
|
||||
import type { PostPublishAppProps } from '@/global/core/app/api';
|
||||
import { GET, POST } from '@/web/common/api/request';
|
||||
import type { AppVersionSchemaType } from '@fastgpt/global/core/app/version';
|
||||
import { PaginationProps } from '@fastgpt/web/common/fetch/type';
|
||||
import type { PaginationProps } from '@fastgpt/web/common/fetch/type';
|
||||
import type {
|
||||
getLatestVersionQuery,
|
||||
getLatestVersionResponse
|
||||
|
||||
@@ -28,6 +28,7 @@ export const defaultOutLinkForm: OutLinkEditType = {
|
||||
name: '',
|
||||
showNodeStatus: true,
|
||||
responseDetail: false,
|
||||
// showFullText: false,
|
||||
showRawSource: false,
|
||||
limit: {
|
||||
QPM: 100,
|
||||
|
||||
@@ -21,7 +21,6 @@ import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
|
||||
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
|
||||
import { ToolModule } from '@fastgpt/global/core/workflow/template/system/tools';
|
||||
import { useDatasetStore } from '../dataset/store/dataset';
|
||||
import {
|
||||
WorkflowStart,
|
||||
userFilesInput
|
||||
@@ -54,12 +53,7 @@ export function form2AppWorkflow(
|
||||
} {
|
||||
const datasetNodeId = 'iKBoX2vIzETU';
|
||||
const aiChatNodeId = '7BdojPlukIQw';
|
||||
|
||||
const allDatasets = useDatasetStore.getState().allDatasets;
|
||||
const selectedDatasets = data.dataset.datasets.filter((item) =>
|
||||
allDatasets.some((ds) => ds._id === item.datasetId)
|
||||
);
|
||||
|
||||
const selectedDatasets = data.dataset.datasets;
|
||||
function systemConfigTemplate(): StoreNodeItemType {
|
||||
return {
|
||||
nodeId: SystemConfigNode.id,
|
||||
@@ -245,58 +239,79 @@ export function form2AppWorkflow(
|
||||
version: DatasetSearchModule.version,
|
||||
inputs: [
|
||||
{
|
||||
key: 'datasets',
|
||||
key: NodeInputKeyEnum.datasetSelectList,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.selectDataset, FlowNodeInputTypeEnum.reference],
|
||||
label: 'core.module.input.label.Select dataset',
|
||||
label: i18nT('common:core.module.input.label.Select dataset'),
|
||||
value: selectedDatasets,
|
||||
valueType: WorkflowIOValueTypeEnum.selectDataset,
|
||||
list: [],
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'similarity',
|
||||
key: NodeInputKeyEnum.datasetSimilarity,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.selectDatasetParamsModal],
|
||||
label: '',
|
||||
value: formData.dataset.similarity,
|
||||
valueType: WorkflowIOValueTypeEnum.number
|
||||
},
|
||||
{
|
||||
key: 'limit',
|
||||
key: NodeInputKeyEnum.datasetMaxTokens,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
value: formData.dataset.limit,
|
||||
valueType: WorkflowIOValueTypeEnum.number
|
||||
},
|
||||
{
|
||||
key: 'searchMode',
|
||||
key: NodeInputKeyEnum.datasetSearchMode,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
value: formData.dataset.searchMode
|
||||
},
|
||||
{
|
||||
key: 'usingReRank',
|
||||
key: NodeInputKeyEnum.datasetSearchEmbeddingWeight,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.number,
|
||||
value: formData.dataset.embeddingWeight
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.datasetSearchUsingReRank,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.boolean,
|
||||
value: formData.dataset.usingReRank
|
||||
},
|
||||
{
|
||||
key: 'datasetSearchUsingExtensionQuery',
|
||||
key: NodeInputKeyEnum.datasetSearchRerankModel,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
value: formData.dataset.rerankModel
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.datasetSearchRerankWeight,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.number,
|
||||
value: formData.dataset.rerankWeight
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.datasetSearchUsingExtensionQuery,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.boolean,
|
||||
value: formData.dataset.datasetSearchUsingExtensionQuery
|
||||
},
|
||||
{
|
||||
key: 'datasetSearchExtensionModel',
|
||||
key: NodeInputKeyEnum.datasetSearchExtensionModel,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
value: formData.dataset.datasetSearchExtensionModel
|
||||
},
|
||||
{
|
||||
key: 'datasetSearchExtensionBg',
|
||||
key: NodeInputKeyEnum.datasetSearchExtensionBg,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { GET, POST, DELETE, PUT } from '@/web/common/api/request';
|
||||
import type {
|
||||
ChatHistoryItemType,
|
||||
ChatHistoryItemResType,
|
||||
ChatSiteItemType,
|
||||
ChatItemType
|
||||
} from '@fastgpt/global/core/chat/type.d';
|
||||
import { getResDataQuery } from '@/pages/api/core/chat/getResData';
|
||||
import type { ChatHistoryItemType, ChatHistoryItemResType } from '@fastgpt/global/core/chat/type.d';
|
||||
import type { getResDataQuery } from '@/pages/api/core/chat/getResData';
|
||||
import type {
|
||||
CloseCustomFeedbackParams,
|
||||
InitChatProps,
|
||||
@@ -22,14 +17,19 @@ import type {
|
||||
DeleteChatItemProps,
|
||||
UpdateHistoryProps
|
||||
} from '@/global/core/chat/api.d';
|
||||
import { UpdateChatFeedbackProps } from '@fastgpt/global/core/chat/api';
|
||||
import { AuthTeamTagTokenProps } from '@fastgpt/global/support/user/team/tag';
|
||||
import { AppListItemType } from '@fastgpt/global/core/app/type';
|
||||
import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { UpdateChatFeedbackProps } from '@fastgpt/global/core/chat/api';
|
||||
import type { AuthTeamTagTokenProps } from '@fastgpt/global/support/user/team/tag';
|
||||
import type { AppListItemType } from '@fastgpt/global/core/app/type';
|
||||
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type {
|
||||
getPaginationRecordsBody,
|
||||
getPaginationRecordsResponse
|
||||
} from '@/pages/api/core/chat/getPaginationRecords';
|
||||
import type { GetQuoteDataProps, GetQuoteDataRes } from '@/pages/api/core/chat/quote/getQuote';
|
||||
import type {
|
||||
GetCollectionQuoteProps,
|
||||
GetCollectionQuoteRes
|
||||
} from '@/pages/api/core/chat/quote/getCollectionQuote';
|
||||
|
||||
/**
|
||||
* 获取初始化聊天内容
|
||||
@@ -100,3 +100,9 @@ export const getMyTokensApps = (data: AuthTeamTagTokenProps) =>
|
||||
*/
|
||||
export const getinitTeamChat = (data: { teamId: string; authToken: string; appId: string }) =>
|
||||
GET(`/proApi/core/chat/initTeamChat`, data);
|
||||
|
||||
export const getQuoteDataList = (data: GetQuoteDataProps) =>
|
||||
POST<GetQuoteDataRes>(`/core/chat/quote/getQuote`, data);
|
||||
|
||||
export const getCollectionQuote = (data: GetCollectionQuoteProps) =>
|
||||
POST<GetCollectionQuoteRes>(`/core/chat/quote/getCollectionQuote`, data);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ChatBoxInputFormType } from '@/components/core/chat/ChatContainer/ChatBox/type';
|
||||
import { PluginRunBoxTabEnum } from '@/components/core/chat/ChatContainer/PluginRunBox/constants';
|
||||
import React, { ReactNode, useCallback, useMemo, useRef, useState } from 'react';
|
||||
import React, { ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { createContext } from 'use-context-selector';
|
||||
import { ComponentRef as ChatComponentRef } from '@/components/core/chat/ChatContainer/ChatBox/type';
|
||||
import { useForm, UseFormReturn } from 'react-hook-form';
|
||||
@@ -8,11 +8,14 @@ import { defaultChatData } from '@/global/core/chat/constants';
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import { AppChatConfigType, VariableItemType } from '@fastgpt/global/core/app/type';
|
||||
import { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io';
|
||||
import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
||||
import { OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
||||
|
||||
type ContextProps = {
|
||||
showRouteToAppDetail: boolean;
|
||||
showRouteToDatasetDetail: boolean;
|
||||
isShowReadRawSource: boolean;
|
||||
// isShowFullText: boolean;
|
||||
showNodeStatus: boolean;
|
||||
};
|
||||
type ChatBoxDataType = {
|
||||
@@ -30,6 +33,31 @@ type ChatBoxDataType = {
|
||||
};
|
||||
};
|
||||
|
||||
export type GetQuoteDataBasicProps = {
|
||||
appId: string;
|
||||
chatId: string;
|
||||
chatItemDataId: string;
|
||||
outLinkAuthData?: OutLinkChatAuthProps;
|
||||
};
|
||||
// 获取单个集合引用
|
||||
export type GetCollectionQuoteDataProps = GetQuoteDataBasicProps & {
|
||||
collectionId: string;
|
||||
sourceId: string;
|
||||
sourceName: string;
|
||||
datasetId: string;
|
||||
};
|
||||
export type GetAllQuoteDataProps = GetQuoteDataBasicProps & {
|
||||
collectionIdList: string[];
|
||||
sourceId?: string;
|
||||
sourceName?: string;
|
||||
};
|
||||
export type GetQuoteProps = GetAllQuoteDataProps | GetCollectionQuoteDataProps;
|
||||
|
||||
export type QuoteDataType = {
|
||||
rawSearch: SearchDataResponseItemType[];
|
||||
metadata: GetQuoteProps;
|
||||
};
|
||||
|
||||
type ChatItemContextType = {
|
||||
ChatBoxRef: React.RefObject<ChatComponentRef> | null;
|
||||
variablesForm: UseFormReturn<ChatBoxInputFormType, any>;
|
||||
@@ -43,6 +71,9 @@ type ChatItemContextType = {
|
||||
chatBoxData: ChatBoxDataType;
|
||||
setChatBoxData: React.Dispatch<React.SetStateAction<ChatBoxDataType>>;
|
||||
isPlugin: boolean;
|
||||
|
||||
quoteData?: QuoteDataType;
|
||||
setQuoteData: React.Dispatch<React.SetStateAction<QuoteDataType | undefined>>;
|
||||
} & ContextProps;
|
||||
|
||||
export const ChatItemContext = createContext<ChatItemContextType>({
|
||||
@@ -61,6 +92,11 @@ export const ChatItemContext = createContext<ChatItemContextType>({
|
||||
},
|
||||
clearChatRecords: function (): void {
|
||||
throw new Error('Function not implemented.');
|
||||
},
|
||||
|
||||
quoteData: undefined,
|
||||
setQuoteData: function (value: React.SetStateAction<QuoteDataType | undefined>): void {
|
||||
throw new Error('Function not implemented.');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -72,13 +108,14 @@ const ChatItemContextProvider = ({
|
||||
showRouteToAppDetail,
|
||||
showRouteToDatasetDetail,
|
||||
isShowReadRawSource,
|
||||
// isShowFullText,
|
||||
showNodeStatus
|
||||
}: {
|
||||
children: ReactNode;
|
||||
} & ContextProps) => {
|
||||
const ChatBoxRef = useRef<ChatComponentRef>(null);
|
||||
const variablesForm = useForm<ChatBoxInputFormType>();
|
||||
|
||||
const [quoteData, setQuoteData] = useState<QuoteDataType>();
|
||||
const [chatBoxData, setChatBoxData] = useState<ChatBoxDataType>({
|
||||
...defaultChatData
|
||||
});
|
||||
@@ -131,7 +168,11 @@ const ChatItemContextProvider = ({
|
||||
showRouteToAppDetail,
|
||||
showRouteToDatasetDetail,
|
||||
isShowReadRawSource,
|
||||
showNodeStatus
|
||||
// isShowFullText,
|
||||
showNodeStatus,
|
||||
|
||||
quoteData,
|
||||
setQuoteData
|
||||
};
|
||||
}, [
|
||||
chatBoxData,
|
||||
@@ -143,7 +184,10 @@ const ChatItemContextProvider = ({
|
||||
showRouteToAppDetail,
|
||||
showRouteToDatasetDetail,
|
||||
isShowReadRawSource,
|
||||
showNodeStatus
|
||||
// isShowFullText,
|
||||
showNodeStatus,
|
||||
quoteData,
|
||||
setQuoteData
|
||||
]);
|
||||
|
||||
return <ChatItemContext.Provider value={contextValue}>{children}</ChatItemContext.Provider>;
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {
|
||||
QueryChatInputGuideBody,
|
||||
QueryChatInputGuideResponse
|
||||
} from '@/pages/api/core/chat/inputGuide/query';
|
||||
import { deleteAllInputGuideBody } from '@/pages/api/core/chat/inputGuide/deleteAll';
|
||||
import type { deleteAllInputGuideBody } from '@/pages/api/core/chat/inputGuide/deleteAll';
|
||||
|
||||
export const getCountChatInputGuideTotal = (data: countChatInputGuideTotalQuery) =>
|
||||
GET<countChatInputGuideTotalResponse>(`/core/chat/inputGuide/countTotal`, data);
|
||||
|
||||
@@ -64,16 +64,18 @@ import type {
|
||||
listExistIdQuery,
|
||||
listExistIdResponse
|
||||
} from '@/pages/api/core/dataset/apiDataset/listExistId';
|
||||
import { GetQuoteDataResponse } from '@/pages/api/core/dataset/data/getQuoteData';
|
||||
import type { GetQuoteDataResponse } from '@/pages/api/core/dataset/data/getQuoteData';
|
||||
import type { GetQuotePermissionResponse } from '@/pages/api/core/dataset/data/getPermission';
|
||||
|
||||
/* ======================== dataset ======================= */
|
||||
export const getDatasets = (data: GetDatasetListBody) =>
|
||||
POST<DatasetListItemType[]>(`/core/dataset/list`, data);
|
||||
|
||||
export const getDatasetsByAppIdAndDatasetIds = (data: { appId: string; datasetIdList: string[] }) =>
|
||||
POST<DatasetSimpleItemType[]>(`/core/dataset/listByAppIdAndDatasetIds`, data);
|
||||
/**
|
||||
* get type=dataset list
|
||||
*/
|
||||
export const getAllDataset = () => GET<DatasetSimpleItemType[]>(`/core/dataset/allDataset`);
|
||||
|
||||
export const getDatasetPaths = (parentId: ParentIdType) =>
|
||||
GET<ParentTreePathItemType[]>('/core/dataset/paths', { parentId });
|
||||
@@ -178,6 +180,9 @@ export const getAllTags = (datasetId: string) =>
|
||||
export const getDatasetDataList = (data: GetDatasetDataListProps) =>
|
||||
POST<GetDatasetDataListRes>(`/core/dataset/data/v2/list`, data);
|
||||
|
||||
export const getDatasetDataPermission = (id?: string) =>
|
||||
GET<GetQuotePermissionResponse>(`/core/dataset/data/getPermission`, { id });
|
||||
|
||||
export const getDatasetDataItemById = (id: string) =>
|
||||
GET<DatasetDataItemType>(`/core/dataset/data/detail`, { id });
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
UpdateDatasetCollaboratorBody,
|
||||
DatasetCollaboratorDeleteParams
|
||||
} from '@fastgpt/global/core/dataset/collaborator';
|
||||
import { DELETE, GET, POST } from '@/web/common/api/request';
|
||||
import { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator';
|
||||
import type { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator';
|
||||
|
||||
export const getCollaboratorList = (datasetId: string) =>
|
||||
GET<CollaboratorItemType[]>('/proApi/core/dataset/collaborator/list', { datasetId });
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { create } from 'zustand';
|
||||
import { devtools, persist } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
import type {
|
||||
DatasetListItemType,
|
||||
DatasetSimpleItemType
|
||||
} from '@fastgpt/global/core/dataset/type.d';
|
||||
import { getAllDataset, getDatasets } from '@/web/core/dataset/api';
|
||||
import type { DatasetListItemType } from '@fastgpt/global/core/dataset/type.d';
|
||||
import { getDatasets } from '@/web/core/dataset/api';
|
||||
|
||||
type State = {
|
||||
allDatasets: DatasetSimpleItemType[];
|
||||
loadAllDatasets: () => Promise<DatasetSimpleItemType[]>;
|
||||
myDatasets: DatasetListItemType[];
|
||||
loadMyDatasets: (parentId?: string) => Promise<DatasetListItemType[]>;
|
||||
};
|
||||
@@ -18,14 +13,6 @@ export const useDatasetStore = create<State>()(
|
||||
devtools(
|
||||
persist(
|
||||
immer((set, get) => ({
|
||||
allDatasets: [],
|
||||
async loadAllDatasets() {
|
||||
const res = await getAllDataset();
|
||||
set((state) => {
|
||||
state.allDatasets = res;
|
||||
});
|
||||
return res;
|
||||
},
|
||||
myDatasets: [],
|
||||
async loadMyDatasets(parentId = '') {
|
||||
const res = await getDatasets({ parentId });
|
||||
|
||||
@@ -10,20 +10,20 @@ import {
|
||||
FlowNodeTypeEnum
|
||||
} from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { getHandleConfig } from '@fastgpt/global/core/workflow/template/utils';
|
||||
import { FlowNodeItemType, StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node';
|
||||
import type { FlowNodeItemType, StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node';
|
||||
import type { FlowNodeTemplateType } from '@fastgpt/global/core/workflow/type/node';
|
||||
import { VARIABLE_NODE_ID } from '@fastgpt/global/core/workflow/constants';
|
||||
import { getHandleId } from '@fastgpt/global/core/workflow/utils';
|
||||
import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
|
||||
import type { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
|
||||
import { LLMModelTypeEnum } from '@fastgpt/global/core/ai/constants';
|
||||
import {
|
||||
import type {
|
||||
FlowNodeInputItemType,
|
||||
FlowNodeOutputItemType
|
||||
} from '@fastgpt/global/core/workflow/type/io';
|
||||
import { PluginTypeEnum } from '@fastgpt/global/core/plugin/constants';
|
||||
import { getWorkflowGlobalVariables } from './utils';
|
||||
import { TFunction } from 'next-i18next';
|
||||
import { AppChatConfigType } from '@fastgpt/global/core/app/type';
|
||||
import type { TFunction } from 'next-i18next';
|
||||
import type { AppChatConfigType } from '@fastgpt/global/core/app/type';
|
||||
|
||||
export const getGlobalVariableNode = ({
|
||||
nodes,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
|
||||
import { PostWorkflowDebugProps, PostWorkflowDebugResponse } from '@/global/core/workflow/api';
|
||||
import type { PostWorkflowDebugProps, PostWorkflowDebugResponse } from '@/global/core/workflow/api';
|
||||
|
||||
export const postWorkflowDebug = (data: PostWorkflowDebugProps) =>
|
||||
POST<PostWorkflowDebugResponse>(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GET, POST } from '@/web/common/api/request';
|
||||
import type { PromotionRecordType } from '@/global/support/api/userRes.d';
|
||||
import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
|
||||
/* get promotion init data */
|
||||
export const getPromotionInitData = () =>
|
||||
|
||||
@@ -2,15 +2,15 @@ import { GET, POST, PUT } from '@/web/common/api/request';
|
||||
import { hashStr } from '@fastgpt/global/common/string/tools';
|
||||
import type { ResLogin } from '@/global/support/api/userRes.d';
|
||||
import { UserAuthTypeEnum } from '@fastgpt/global/support/user/auth/constants';
|
||||
import { UserUpdateParams } from '@/types/user';
|
||||
import { UserType } from '@fastgpt/global/support/user/type.d';
|
||||
import type { UserUpdateParams } from '@/types/user';
|
||||
import type { UserType } from '@fastgpt/global/support/user/type.d';
|
||||
import type {
|
||||
FastLoginProps,
|
||||
OauthLoginProps,
|
||||
PostLoginProps,
|
||||
SearchResult
|
||||
} from '@fastgpt/global/support/user/api.d';
|
||||
import {
|
||||
import type {
|
||||
AccountRegisterBody,
|
||||
GetWXLoginQRResponse
|
||||
} from '@fastgpt/global/support/user/login/api.d';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GET, POST } from '@/web/common/api/request';
|
||||
import type { UserInformSchema } from '@fastgpt/global/support/user/inform/type';
|
||||
import { SystemMsgModalValueType } from '@fastgpt/service/support/user/inform/type';
|
||||
import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { SystemMsgModalValueType } from '@fastgpt/service/support/user/inform/type';
|
||||
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
|
||||
export const getInforms = (data: PaginationProps) =>
|
||||
POST<PaginationResponse<UserInformSchema>>(`/proApi/support/user/inform/list`, data);
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
|
||||
import {
|
||||
import type {
|
||||
CollaboratorItemType,
|
||||
DeletePermissionQuery,
|
||||
UpdateClbPermissionProps
|
||||
} from '@fastgpt/global/support/permission/collaborator';
|
||||
import {
|
||||
import type {
|
||||
CreateTeamProps,
|
||||
InviteMemberProps,
|
||||
InviteMemberResponse,
|
||||
UpdateInviteProps,
|
||||
UpdateStatusProps,
|
||||
UpdateTeamProps
|
||||
} from '@fastgpt/global/support/user/team/controller.d';
|
||||
import type { TeamTagItemType, TeamTagSchema } from '@fastgpt/global/support/user/team/type';
|
||||
import {
|
||||
import type {
|
||||
TeamTmbItemType,
|
||||
TeamMemberItemType,
|
||||
TeamMemberSchema
|
||||
} from '@fastgpt/global/support/user/team/type.d';
|
||||
import { FeTeamPlanStatusType, TeamSubSchema } from '@fastgpt/global/support/wallet/sub/type';
|
||||
import { TeamInvoiceHeaderType } from '@fastgpt/global/support/user/team/type';
|
||||
import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { FeTeamPlanStatusType, TeamSubSchema } from '@fastgpt/global/support/wallet/sub/type';
|
||||
import type { TeamInvoiceHeaderType } from '@fastgpt/global/support/user/team/type';
|
||||
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type {
|
||||
InvitationInfoType,
|
||||
InvitationLinkCreateType,
|
||||
InvitationLinkUpdateType,
|
||||
InvitationType
|
||||
} from '@fastgpt/service/support/user/team/invitationLink/type';
|
||||
|
||||
/* --------------- team ---------------- */
|
||||
export const getTeamList = (status: `${TeamMemberSchema['status']}`) =>
|
||||
@@ -34,18 +37,37 @@ export const putSwitchTeam = (teamId: string) =>
|
||||
/* --------------- team member ---------------- */
|
||||
export const getTeamMembers = (props: PaginationProps<{ withLeaved?: boolean }>) =>
|
||||
GET<PaginationResponse<TeamMemberItemType>>(`/proApi/support/user/team/member/list`, props);
|
||||
export const postInviteTeamMember = (data: InviteMemberProps) =>
|
||||
POST<InviteMemberResponse>(`/proApi/support/user/team/member/invite`, data);
|
||||
|
||||
// export const postInviteTeamMember = (data: InviteMemberProps) =>
|
||||
// POST<InviteMemberResponse>(`/proApi/support/user/team/member/invite`, data);
|
||||
|
||||
export const putUpdateMemberName = (name: string) =>
|
||||
PUT(`/proApi/support/user/team/member/updateName`, { name });
|
||||
export const delRemoveMember = (tmbId: string) =>
|
||||
DELETE(`/proApi/support/user/team/member/delete`, { tmbId });
|
||||
export const updateInviteResult = (data: UpdateInviteProps) =>
|
||||
PUT('/proApi/support/user/team/member/updateInvite', data);
|
||||
export const updateStatus = (data: UpdateStatusProps) =>
|
||||
PUT('/proApi/support/user/team/member/updateStatus', data);
|
||||
export const postRestoreMember = (tmbId: string) =>
|
||||
POST('/proApi/support/user/team/member/restore', { tmbId });
|
||||
export const delLeaveTeam = () => DELETE('/proApi/support/user/team/member/leave');
|
||||
|
||||
/* -------------- team invitaionlink -------------------- */
|
||||
|
||||
export const postCreateInvitationLink = (data: InvitationLinkCreateType) =>
|
||||
POST<string>(`/proApi/support/user/team/invitationLink/create`, data);
|
||||
|
||||
export const getInvitationLinkList = () =>
|
||||
GET<InvitationType[]>(`/proApi/support/user/team/invitationLink/list`);
|
||||
|
||||
export const postAcceptInvitationLink = (linkId: string) =>
|
||||
POST<string>(`/proApi/support/user/team/invitationLink/accept`, { linkId });
|
||||
|
||||
export const getInvitationInfo = (linkId: string) =>
|
||||
GET<InvitationInfoType>(`/proApi/support/user/team/invitationLink/info`, { linkId });
|
||||
|
||||
export const putUpdateInvitationInfo = (data: InvitationLinkUpdateType) =>
|
||||
PUT('/proApi/support/user/team/invitationLink/update', data);
|
||||
|
||||
/* -------------- team collaborator -------------------- */
|
||||
export const getTeamClbs = () =>
|
||||
GET<CollaboratorItemType[]>(`/proApi/support/user/team/collaborator/list`);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DELETE, GET, POST, PUT } from '@/web/common/api/request';
|
||||
import { MemberGroupListType } from '@fastgpt/global/support/permission/memberGroup/type';
|
||||
import {
|
||||
import type { MemberGroupListType } from '@fastgpt/global/support/permission/memberGroup/type';
|
||||
import type {
|
||||
postCreateGroupData,
|
||||
putUpdateGroupData
|
||||
} from '@fastgpt/global/support/user/team/group/api';
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
putUpdateOrgMembersData
|
||||
} from '@fastgpt/global/support/user/team/org/api';
|
||||
import type { OrgType } from '@fastgpt/global/support/user/team/org/type';
|
||||
import { putMoveOrgType } from '@fastgpt/global/support/user/team/org/api';
|
||||
import type { putMoveOrgType } from '@fastgpt/global/support/user/team/org/api';
|
||||
|
||||
export const getOrgList = () => GET<OrgType[]>('/proApi/support/user/team/org/list');
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { GET, POST } from '@/web/common/api/request';
|
||||
import { CreateBillProps, CreateBillResponse } from '@fastgpt/global/support/wallet/bill/api';
|
||||
import type { CreateBillProps, CreateBillResponse } from '@fastgpt/global/support/wallet/bill/api';
|
||||
import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import type { BillSchemaType } from '@fastgpt/global/support/wallet/bill/type.d';
|
||||
import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
|
||||
export const getBills = (
|
||||
data: PaginationProps<{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { GET, POST } from '@/web/common/api/request';
|
||||
import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { InvoiceType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
import { InvoiceSchemaType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { InvoiceType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
import type { InvoiceSchemaType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
export type invoiceBillDataType = {
|
||||
type: BillTypeEnum;
|
||||
price: number;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { POST } from '@/web/common/api/request';
|
||||
import {
|
||||
import type {
|
||||
CreateTrainingUsageProps,
|
||||
GetUsageDashboardProps,
|
||||
GetUsageDashboardResponseItem,
|
||||
GetUsageProps
|
||||
} from '@fastgpt/global/support/wallet/usage/api.d';
|
||||
import type { UsageItemType } from '@fastgpt/global/support/wallet/usage/type';
|
||||
import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
|
||||
export const getUserUsages = (data: PaginationProps<GetUsageProps>) =>
|
||||
POST<PaginationResponse<UsageItemType>>(`/proApi/support/wallet/usage/getUsage`, data);
|
||||
|
||||
Reference in New Issue
Block a user