4.8.19-feature (#3636)
* feat: sync org from wecom, pref: member list pagination (#3549) * feat: sync org * chore: fe * chore: loading * chore: type * pref: team member list change to pagination. Edit a sort of list apis. * feat: member update avatar * chore: user avatar move to tmb * chore: init scripts move user avatar * chore: sourceMember * fix: list api sourceMember * fix: member sync * fix: pagination * chore: adjust code * chore: move changeOwner to pro * chore: init v4819 script * chore: adjust code * chore: UserBox * perf: scroll page code * perf: list data * docs:更新用户答疑 (#3576) * docs: add custom uid docs (#3572) * fix: pagination bug (#3577) * 4.8.19 test (#3584) * faet: dataset search filter * fix: scroll page * fix: collection list api old version (#3591) * fix: collection list api format * fix: type error of addSourceMemeber * fix: scroll fetch (#3592) * fix: yuque dataset file folder can enter (#3593) * perf: load members;perf: yuque load;fix: workflow llm params cannot close (#3594) * chat openapi doc * feat: dataset openapi doc * perf: load members * perf: member load code * perf: yuque load * fix: workflow llm params cannot close * fix: api dataset reference tag preview (#3600) * perf: doc * feat: chat page config * fix: http parse (#3634) * update doc * fix: http parse * fix code run node reset template (#3633) Co-authored-by: Archer <545436317@qq.com> * docs:faq (#3627) * docs:faq * docsFix * perf: sleep plugin * fix: selector --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com> Co-authored-by: Jiangween <145003935+Jiangween@users.noreply.github.com> Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
@@ -5,7 +5,7 @@ import { 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 { PagingData } from '@/types';
|
||||
import { PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
|
||||
/**
|
||||
* 获取应用列表
|
||||
@@ -39,7 +39,7 @@ export const putAppById = (id: string, data: AppUpdateParams) =>
|
||||
|
||||
// =================== chat logs
|
||||
export const getAppChatLogs = (data: GetAppChatLogsParams) =>
|
||||
POST<PagingData<AppLogsListItemType>>(`/core/app/getChatLogs`, data);
|
||||
POST<PaginationResponse<AppLogsListItemType>>(`/core/app/getChatLogs`, data);
|
||||
|
||||
export const resumeInheritPer = (appId: string) =>
|
||||
GET(`/core/app/resumeInheritPermission`, { appId });
|
||||
|
||||
@@ -35,7 +35,8 @@ export const getTeamPlugTemplates = (data?: ListAppBody) =>
|
||||
intro: app.intro,
|
||||
showStatus: false,
|
||||
version: app.pluginData?.nodeVersion || defaultNodeVersion,
|
||||
isTool: true
|
||||
isTool: true,
|
||||
sourceMember: app.sourceMember
|
||||
}))
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PostPublishAppProps } from '@/global/core/app/api';
|
||||
import { GET, POST, DELETE, PUT } from '@/web/common/api/request';
|
||||
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 {
|
||||
|
||||
@@ -9,6 +9,12 @@ 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';
|
||||
|
||||
type ContextProps = {
|
||||
showRouteToAppDetail: boolean;
|
||||
showRouteToDatasetDetail: boolean;
|
||||
isShowReadRawSource: boolean;
|
||||
showNodeStatus: boolean;
|
||||
};
|
||||
type ChatBoxDataType = {
|
||||
appId: string;
|
||||
title?: string;
|
||||
@@ -37,7 +43,7 @@ type ChatItemContextType = {
|
||||
chatBoxData: ChatBoxDataType;
|
||||
setChatBoxData: React.Dispatch<React.SetStateAction<ChatBoxDataType>>;
|
||||
isPlugin: boolean;
|
||||
};
|
||||
} & ContextProps;
|
||||
|
||||
export const ChatItemContext = createContext<ChatItemContextType>({
|
||||
ChatBoxRef: null,
|
||||
@@ -61,7 +67,15 @@ export const ChatItemContext = createContext<ChatItemContextType>({
|
||||
/*
|
||||
Chat 对象的上下文
|
||||
*/
|
||||
const ChatItemContextProvider = ({ children }: { children: ReactNode }) => {
|
||||
const ChatItemContextProvider = ({
|
||||
children,
|
||||
showRouteToAppDetail,
|
||||
showRouteToDatasetDetail,
|
||||
isShowReadRawSource,
|
||||
showNodeStatus
|
||||
}: {
|
||||
children: ReactNode;
|
||||
} & ContextProps) => {
|
||||
const ChatBoxRef = useRef<ChatComponentRef>(null);
|
||||
const variablesForm = useForm<ChatBoxInputFormType>();
|
||||
|
||||
@@ -113,16 +127,23 @@ const ChatItemContextProvider = ({ children }: { children: ReactNode }) => {
|
||||
pluginRunTab,
|
||||
setPluginRunTab,
|
||||
resetVariables,
|
||||
clearChatRecords
|
||||
clearChatRecords,
|
||||
showRouteToAppDetail,
|
||||
showRouteToDatasetDetail,
|
||||
isShowReadRawSource,
|
||||
showNodeStatus
|
||||
};
|
||||
}, [
|
||||
chatBoxData,
|
||||
setChatBoxData,
|
||||
clearChatRecords,
|
||||
isPlugin,
|
||||
variablesForm,
|
||||
pluginRunTab,
|
||||
resetVariables,
|
||||
variablesForm
|
||||
clearChatRecords,
|
||||
showRouteToAppDetail,
|
||||
showRouteToDatasetDetail,
|
||||
isShowReadRawSource,
|
||||
showNodeStatus
|
||||
]);
|
||||
|
||||
return <ChatItemContext.Provider value={contextValue}>{children}</ChatItemContext.Provider>;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getPaginationRecordsBody } from '@/pages/api/core/chat/getPaginationRec
|
||||
import { ChatSiteItemType } from '@fastgpt/global/core/chat/type';
|
||||
import { PaginationResponse } from '@fastgpt/web/common/fetch/type';
|
||||
import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination';
|
||||
import React, { ReactNode, useEffect, useMemo, useState } from 'react';
|
||||
import React, { ReactNode, useMemo, useState } from 'react';
|
||||
import { createContext, useContextSelector } from 'use-context-selector';
|
||||
import { ChatItemContext } from './chatItemContext';
|
||||
import { getChatRecords } from '../api';
|
||||
@@ -68,7 +68,7 @@ const ChatRecordContextProvider = ({
|
||||
const res = await getChatRecords(data);
|
||||
|
||||
// First load scroll to bottom
|
||||
if (data.offset === 0) {
|
||||
if (Number(data.offset) === 0) {
|
||||
function scrollToBottom() {
|
||||
requestAnimationFrame(
|
||||
ChatBoxRef?.current ? () => ChatBoxRef?.current?.scrollToBottom?.() : scrollToBottom
|
||||
|
||||
@@ -37,7 +37,6 @@ import type { DatasetCollectionItemType } from '@fastgpt/global/core/dataset/typ
|
||||
import { DatasetCollectionSyncResultEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import type { DatasetDataItemType } from '@fastgpt/global/core/dataset/type';
|
||||
import type { DatasetCollectionsListItemType } from '@/global/core/dataset/type.d';
|
||||
import { PagingData } from '@/types';
|
||||
import type { getDatasetTrainingQueueResponse } from '@/pages/api/core/dataset/training/getDatasetTrainingQueue';
|
||||
import type { rebuildEmbeddingBody } from '@/pages/api/core/dataset/training/rebuildEmbedding';
|
||||
import type {
|
||||
@@ -66,8 +65,6 @@ import type {
|
||||
listExistIdQuery,
|
||||
listExistIdResponse
|
||||
} from '@/pages/api/core/dataset/apiDataset/listExistId';
|
||||
import { FeishuServer, YuqueServer } from '@fastgpt/global/core/dataset/apiDataset';
|
||||
import { RequireOnlyOne } from '@fastgpt/global/common/type/utils';
|
||||
|
||||
/* ======================== dataset ======================= */
|
||||
export const getDatasets = (data: GetDatasetListBody) =>
|
||||
@@ -110,7 +107,7 @@ export const postSearchText = (data: SearchTestProps) =>
|
||||
|
||||
/* ============================= collections ==================================== */
|
||||
export const getDatasetCollections = (data: GetDatasetCollectionsProps) =>
|
||||
POST<PagingData<DatasetCollectionsListItemType>>(`/core/dataset/collection/list`, data);
|
||||
POST<PaginationResponse<DatasetCollectionsListItemType>>(`/core/dataset/collection/listV2`, data);
|
||||
export const getDatasetCollectionPathById = (parentId: string) =>
|
||||
GET<ParentTreePathItemType[]>(`/core/dataset/collection/paths`, { parentId });
|
||||
export const getDatasetCollectionById = (id: string) =>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import ParentPaths from '@/components/common/ParentPaths';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest, useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDatasetCollectionPathById, getDatasetCollections } from '@/web/core/dataset/api';
|
||||
import { Box, Flex, ModalFooter, Button, useTheme, Grid, Card, ModalBody } from '@chakra-ui/react';
|
||||
import { DatasetCollectionTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
@@ -48,20 +48,24 @@ const SelectCollections = ({
|
||||
|
||||
useQuery(['loadDatasetDetail', datasetId], () => loadDatasetDetail(datasetId));
|
||||
|
||||
const { data, isLoading } = useQuery(['getDatasetCollections', parentId], () =>
|
||||
getDatasetCollections({
|
||||
datasetId,
|
||||
parentId,
|
||||
selectFolder: type === 'folder',
|
||||
simple: true,
|
||||
pageNum: 1,
|
||||
pageSize: 50
|
||||
})
|
||||
const { data, loading: isLoading } = useRequest2(
|
||||
() =>
|
||||
getDatasetCollections({
|
||||
datasetId,
|
||||
parentId,
|
||||
selectFolder: type === 'folder',
|
||||
simple: true,
|
||||
pageNum: 1,
|
||||
pageSize: 50
|
||||
}),
|
||||
{
|
||||
manual: false,
|
||||
refreshDeps: [datasetId, parentId, type]
|
||||
}
|
||||
);
|
||||
|
||||
const formatCollections = useMemo(
|
||||
() =>
|
||||
data?.data.map((collection) => {
|
||||
data?.list.map((collection) => {
|
||||
const icon = getCollectionIcon(collection.type, collection.name);
|
||||
|
||||
return {
|
||||
@@ -111,7 +115,7 @@ const SelectCollections = ({
|
||||
title={
|
||||
<Box>
|
||||
<ParentPaths
|
||||
paths={paths.map((path, i) => ({
|
||||
paths={paths.map((path) => ({
|
||||
parentId: path.parentId,
|
||||
parentName: path.parentName
|
||||
}))}
|
||||
|
||||
@@ -118,7 +118,7 @@ export const storeNode2FlowNode = ({
|
||||
toolDescription: t(templateInput.toolDescription ?? (storeInput.toolDescription as any)),
|
||||
|
||||
selectedTypeIndex: storeInput.selectedTypeIndex ?? templateInput.selectedTypeIndex,
|
||||
value: storeInput.value ?? templateInput.value,
|
||||
value: storeInput.value,
|
||||
valueType: storeInput.valueType ?? templateInput.valueType,
|
||||
label: storeInput.label ?? templateInput.label
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user