mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 15:41:05 +00:00
fix: ai response test (#5544)
* fix: ai response test * fix: skip edge check * fix: app list * fix: toolset conflict interactive node * fix: username show
This commit is contained in:
@@ -362,7 +362,6 @@ const BottomSection = () => {
|
||||
const { userInfo } = useUserStore();
|
||||
const isLoggedIn = !!userInfo;
|
||||
const avatar = userInfo?.avatar;
|
||||
const username = userInfo?.username;
|
||||
const isAdmin = !!userInfo?.team.permission.hasManagePer;
|
||||
const isShare = pathname === '/chat/share';
|
||||
|
||||
@@ -448,7 +447,7 @@ const BottomSection = () => {
|
||||
fontWeight={500}
|
||||
minW={0}
|
||||
>
|
||||
{username}
|
||||
{userInfo?.team?.memberName}
|
||||
</AnimatedText>
|
||||
</Flex>
|
||||
</UserAvatarPopover>
|
||||
|
@@ -106,7 +106,9 @@ async function handler(req: ApiRequestProps<ListAppBody>): Promise<AppListItemTy
|
||||
// Filter apps by permission, if not owner, only get apps that I have permission to access
|
||||
const idList = { _id: { $in: myPerList.map((item) => item.resourceId) } };
|
||||
const appPerQuery = teamPer.isOwner
|
||||
? {}
|
||||
? {
|
||||
parentId: parentId ? parseParentIdInMongo(parentId) : null
|
||||
}
|
||||
: parentId
|
||||
? {
|
||||
$or: [idList, parseParentIdInMongo(parentId)]
|
||||
@@ -138,6 +140,7 @@ async function handler(req: ApiRequestProps<ListAppBody>): Promise<AppListItemTy
|
||||
...searchMatch,
|
||||
type: _type
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
delete data.parentId;
|
||||
return data;
|
||||
|
@@ -5,9 +5,11 @@ import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import type { McpToolConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { UserError } from '@fastgpt/global/common/error/utils';
|
||||
import { getMCPChildren } from '@fastgpt/service/core/app/mcp';
|
||||
import { replaceRegChars } from '@fastgpt/global/common/string/tools';
|
||||
|
||||
export type McpGetChildrenmQuery = {
|
||||
id: string;
|
||||
searchKey?: string;
|
||||
};
|
||||
export type McpGetChildrenmBody = {};
|
||||
export type McpGetChildrenmResponse = (McpToolConfigType & {
|
||||
@@ -19,7 +21,7 @@ async function handler(
|
||||
req: ApiRequestProps<McpGetChildrenmBody, McpGetChildrenmQuery>,
|
||||
_res: ApiResponseType<any>
|
||||
): Promise<McpGetChildrenmResponse> {
|
||||
const { id } = req.query;
|
||||
const { id, searchKey } = req.query;
|
||||
|
||||
const app = await MongoApp.findOne({ _id: id }).lean();
|
||||
|
||||
@@ -28,6 +30,12 @@ async function handler(
|
||||
if (app.type !== AppTypeEnum.toolSet)
|
||||
return Promise.reject(new UserError('the parent is not a mcp toolset'));
|
||||
|
||||
return getMCPChildren(app);
|
||||
return (await getMCPChildren(app)).filter((item) => {
|
||||
if (searchKey && searchKey.trim() !== '') {
|
||||
const regx = new RegExp(replaceRegChars(searchKey.trim()), 'i');
|
||||
return regx.test(item.name);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
export default NextAPI(handler);
|
||||
|
@@ -29,7 +29,10 @@ import type {
|
||||
getToolVersionListProps,
|
||||
getToolVersionResponse
|
||||
} from '@/pages/api/core/app/plugin/getVersionList';
|
||||
import type { McpGetChildrenmResponse } from '@/pages/api/core/app/mcpTools/getChildren';
|
||||
import type {
|
||||
McpGetChildrenmQuery,
|
||||
McpGetChildrenmResponse
|
||||
} from '@/pages/api/core/app/mcpTools/getChildren';
|
||||
|
||||
/* ============ team plugin ============== */
|
||||
export const getTeamPlugTemplates = async (data?: {
|
||||
@@ -40,7 +43,7 @@ export const getTeamPlugTemplates = async (data?: {
|
||||
// handle get mcptools
|
||||
const app = await getAppDetailById(data.parentId);
|
||||
if (app.type === AppTypeEnum.toolSet) {
|
||||
const children = await getMcpChildren(data.parentId);
|
||||
const children = await getMcpChildren({ id: data.parentId, searchKey: data.searchKey });
|
||||
return children.map((item) => ({
|
||||
...item,
|
||||
flowNodeType: FlowNodeTypeEnum.tool,
|
||||
@@ -109,8 +112,8 @@ export const getMCPTools = (data: getMCPToolsBody) =>
|
||||
export const postRunMCPTool = (data: RunMCPToolBody) =>
|
||||
POST('/support/mcp/client/runTool', data, { timeout: 300000 });
|
||||
|
||||
export const getMcpChildren = (id: string) =>
|
||||
GET<McpGetChildrenmResponse>('/core/app/mcpTools/getChildren', { id });
|
||||
export const getMcpChildren = (data: McpGetChildrenmQuery) =>
|
||||
GET<McpGetChildrenmResponse>('/core/app/mcpTools/getChildren', data);
|
||||
|
||||
/* ============ http plugin ============== */
|
||||
export const postCreateHttpPlugin = (data: createHttpPluginBody) =>
|
||||
|
Reference in New Issue
Block a user