mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-31 10:52:47 +00:00
fix: ts
This commit is contained in:
parent
3e0eea7cfb
commit
d90d91dfbe
|
|
@ -35,12 +35,7 @@ import {
|
|||
initToolNodes,
|
||||
parseToolArgs
|
||||
} from '../utils';
|
||||
import {
|
||||
getFileReadTool,
|
||||
getTopAgentConstantPrompt,
|
||||
StopAgentTool,
|
||||
SubAppIds
|
||||
} from './sub/constants';
|
||||
import { getFileReadTool, getTopAgentConstantPrompt, SubAppIds } from './sub/constants';
|
||||
import { runWorkflow } from '../..';
|
||||
import type { ChatCompletionTool } from '@fastgpt/global/core/ai/type';
|
||||
import type { ToolNodeItemType } from './type';
|
||||
|
|
@ -72,7 +67,6 @@ import { dispatchRunAppNode } from '../../child/runApp';
|
|||
import { dispatchRunPlugin } from '../../plugin/run';
|
||||
import type { ChatNodeUsageType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
import { dispatchTool } from './sub/tool';
|
||||
import { dispatchStopToolCall } from '../agent/sub/stop';
|
||||
|
||||
export type DispatchAgentModuleProps = ModuleDispatchProps<{
|
||||
[NodeInputKeyEnum.history]?: ChatItemType[];
|
||||
|
|
@ -274,11 +268,9 @@ export const dispatchRunAgent = async (props: DispatchAgentModuleProps): Promise
|
|||
isEnd
|
||||
} = await (async () => {
|
||||
if (toolId === SubAppIds.stop) {
|
||||
const { response, usages } = await dispatchStopToolCall();
|
||||
|
||||
return {
|
||||
response,
|
||||
usages,
|
||||
response: '',
|
||||
usages: [],
|
||||
isEnd: true
|
||||
};
|
||||
} else if (toolId === SubAppIds.plan) {
|
||||
|
|
|
|||
|
|
@ -17,14 +17,6 @@ export const getTopAgentConstantPrompt = () => {
|
|||
- 遇到错误时要有容错和重试机制`;
|
||||
};
|
||||
|
||||
export const StopAgentTool: ChatCompletionTool = {
|
||||
type: 'function',
|
||||
function: {
|
||||
name: SubAppIds.stop,
|
||||
description: '如果完成了所有的任务,可调用此工具。'
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
结构:
|
||||
[url1,url2,url2]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { ChatCompletionTool } from '@fastgpt/global/core/ai/type';
|
||||
import { PlanAgentTool } from './plan/constants';
|
||||
import { getFileReadTool, StopAgentTool } from './constants';
|
||||
import { getFileReadTool } from './constants';
|
||||
import { ModelAgentTool } from './model/constants';
|
||||
import type { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io';
|
||||
import type { JSONSchemaInputType } from '@fastgpt/global/core/app/jsonschema';
|
||||
|
|
@ -17,6 +17,7 @@ import { MongoApp } from '../../../../../app/schema';
|
|||
import { getMCPChildren } from '../../../../../app/mcp';
|
||||
import { getMCPToolRuntimeNode } from '@fastgpt/global/core/app/mcpTools/utils';
|
||||
import type { localeType } from '@fastgpt/global/common/i18n/type';
|
||||
import { StopAgentTool } from './stop/constants';
|
||||
|
||||
export const rewriteSubAppsToolset = ({
|
||||
subApps,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import type { ChatCompletionTool } from '@fastgpt/global/core/ai/type';
|
||||
import { SubAppIds } from '../constants';
|
||||
|
||||
export const StopAgentTool: ChatCompletionTool = {
|
||||
type: 'function',
|
||||
function: {
|
||||
name: SubAppIds.stop,
|
||||
description: '如果完成了所有的任务,可调用此工具。'
|
||||
}
|
||||
};
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import type { DispatchSubAppProps, DispatchSubAppResponse } from '../../type';
|
||||
|
||||
export const dispatchStopToolCall = async (
|
||||
props?: DispatchSubAppProps<{}>
|
||||
): Promise<DispatchSubAppResponse> => {
|
||||
return {
|
||||
response: ''
|
||||
};
|
||||
};
|
||||
|
|
@ -21,7 +21,7 @@ import MyBox from '@fastgpt/web/components/common/MyBox';
|
|||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import type { AppVersionSchemaType, VersionListItemType } from '@fastgpt/global/core/app/version';
|
||||
import type { SimpleAppSnapshotType } from './SimpleApp/useSnapshots';
|
||||
import type { SimpleAppSnapshotType } from './Edit/FormComponent/useSnapshots';
|
||||
|
||||
const PublishHistoriesSlider = <T extends SimpleAppSnapshotType | WorkflowSnapshotsType>({
|
||||
onClose,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,12 @@ const AppTypeTag = ({ type }: { type: AppTypeEnum }) => {
|
|||
const { t } = useTranslation();
|
||||
|
||||
const map = useRef({
|
||||
[AppTypeEnum.agent]: {
|
||||
label: 'Agent',
|
||||
icon: 'core/app/type/simple',
|
||||
bg: '#DBF3FF',
|
||||
color: '#0884DD'
|
||||
},
|
||||
[AppTypeEnum.simple]: {
|
||||
label: t('app:type.Chat_Agent'),
|
||||
icon: 'core/app/type/simple',
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ const MyApps = () => {
|
|||
const map = useMemo(
|
||||
() => ({
|
||||
all: t('common:core.module.template.all_team_app'),
|
||||
[AppTypeEnum.agent]: 'Agent',
|
||||
[AppTypeEnum.simple]: t('app:type.Chat_Agent'),
|
||||
[AppTypeEnum.workflow]: t('app:type.Workflow bot'),
|
||||
[AppTypeEnum.workflowTool]: t('app:toolType_workflow'),
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import NextHead from '@/components/common/NextHead';
|
|||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import AIModelSelector from '@/components/Select/AIModelSelector';
|
||||
import { form2AppWorkflow } from '@/web/core/app/utils';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import { getDefaultAppForm } from '@fastgpt/global/core/app/utils';
|
||||
import { getToolPreviewNode } from '@/web/core/app/api/tool';
|
||||
|
|
@ -48,6 +47,7 @@ import { ChatSidebarPaneEnum } from '../constants';
|
|||
import ChatHistorySidebar from '@/pageComponents/chat/slider/ChatSliderSidebar';
|
||||
import ChatSliderMobileDrawer from '@/pageComponents/chat/slider/ChatSliderMobileDrawer';
|
||||
import { getWebReqUrl } from '@fastgpt/web/common/system/utils';
|
||||
import { form2AppWorkflow } from '@/pageComponents/app/detail/Edit/SimpleApp/utils';
|
||||
|
||||
type Props = {
|
||||
myApps: AppListItemType[];
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { AppListContext } from './context';
|
|||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { postCreateApp } from '@/web/core/app/api';
|
||||
import { useRouter } from 'next/router';
|
||||
import { form2AppWorkflow } from '@/web/core/app/utils';
|
||||
import { form2AppWorkflow } from '@/pageComponents/app/detail/Edit/SimpleApp/utils';
|
||||
import ImportAppConfigEditor from '@/pageComponents/app/ImportAppConfigEditor';
|
||||
import { postFetchWorkflow } from '@/web/support/marketing/api';
|
||||
import {
|
||||
|
|
|
|||
Loading…
Reference in New Issue