diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx index 870566f114..67cbfd8b12 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx @@ -10,6 +10,7 @@ import AppSideBar from '@/app/components/app-sidebar' import type { NavIcon } from '@/app/components/app-sidebar/navLink' import { fetchAppDetail } from '@/service/apps' import { useAppContext } from '@/context/app-context' +import Loading from '@/app/components/base/loading' import { BarChartSquare02, FileHeart02, PromptEngineering, TerminalSquare } from '@/app/components/base/icons/src/vender/line/development' import { BarChartSquare02 as BarChartSquare02Solid, FileHeart02 as FileHeart02Solid, PromptEngineering as PromptEngineeringSolid, TerminalSquare as TerminalSquareSolid } from '@/app/components/base/icons/src/vender/solid/development' @@ -76,14 +77,20 @@ const AppDetailLayout: FC = (props) => { }, [appDetail]) useEffect(() => { + setAppDetail() fetchAppDetail({ url: '/apps', id: appId }).then((res) => { setAppDetail(res) setNavigation(getNavigations(appId, isCurrentWorkspaceManager, res.mode)) }) }, [appId, getNavigations, isCurrentWorkspaceManager, setAppDetail]) - if (!appDetail) - return null + if (!appDetail) { + return ( +
+ +
+ ) + } // redirections if ((appDetail.mode === 'workflow' || appDetail.mode === 'advanced-chat') && (pathname).endsWith('configuration')) @@ -93,7 +100,9 @@ const AppDetailLayout: FC = (props) => { return (
- + {appDetail && ( + + )}
{children}
diff --git a/web/app/components/app-sidebar/app-info.tsx b/web/app/components/app-sidebar/app-info.tsx index ccfb22c781..9d9d38fb04 100644 --- a/web/app/components/app-sidebar/app-info.tsx +++ b/web/app/components/app-sidebar/app-info.tsx @@ -66,7 +66,6 @@ const AppInfo = ({ expand }: IAppInfoProps) => { type: 'success', message: t('app.editDone'), }) - console.log(app.description) setAppDetail(app) mutateApps() } @@ -151,17 +150,17 @@ const AppInfo = ({ expand }: IAppInfoProps) => { onClick={() => setOpen(v => !v)} className='block' > -
+
- +
{expand && ( -
-
+
+
{appDetail.name}
-
+
{appDetail.mode === 'advanced-chat' && ( <>
{t('app.types.chatbot').toUpperCase()}
@@ -193,11 +192,11 @@ const AppInfo = ({ expand }: IAppInfoProps) => { {/* header */}
- +
-
-
{appDetail.name}
-
+
+
{appDetail.name}
+
{appDetail.mode === 'advanced-chat' && ( <>
{t('app.types.chatbot').toUpperCase()}
diff --git a/web/app/components/app-sidebar/basic.tsx b/web/app/components/app-sidebar/basic.tsx index 46dce55eb8..09f978b04b 100644 --- a/web/app/components/app-sidebar/basic.tsx +++ b/web/app/components/app-sidebar/basic.tsx @@ -58,7 +58,7 @@ const ICON_MAP = { export default function AppBasic({ icon, icon_background, name, type, hoverTip, textStyle, mode = 'expand', iconType = 'app' }: IAppBasicProps) { return ( -
+
{icon && icon_background && iconType === 'app' && (
diff --git a/web/app/components/app-sidebar/index.tsx b/web/app/components/app-sidebar/index.tsx index d039d7e3c4..effddfe702 100644 --- a/web/app/components/app-sidebar/index.tsx +++ b/web/app/components/app-sidebar/index.tsx @@ -60,7 +60,7 @@ const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInf
{iconType === 'app' && ( diff --git a/web/app/components/app-sidebar/switch-modal/completion.png b/web/app/components/app-sidebar/switch-modal/completion.png new file mode 100644 index 0000000000..7a3cbd5107 Binary files /dev/null and b/web/app/components/app-sidebar/switch-modal/completion.png differ diff --git a/web/app/components/app-sidebar/switch-modal/expert.png b/web/app/components/app-sidebar/switch-modal/expert.png new file mode 100644 index 0000000000..ba941a5865 Binary files /dev/null and b/web/app/components/app-sidebar/switch-modal/expert.png differ diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx index 9ed2464598..424b77f0cd 100644 --- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx @@ -9,7 +9,7 @@ import { useContext } from 'use-context-selector' import ConfirmAddVar from './confirm-add-var' import s from './style.module.css' import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap' -import { PromptMode, type PromptVariable } from '@/models/debug' +import { type PromptVariable } from '@/models/debug' import Tooltip from '@/app/components/base/tooltip' import { AppType } from '@/types/app' import { getNewVar, getVars } from '@/utils/var' @@ -22,7 +22,6 @@ import ConfigContext from '@/context/debug-configuration' import { useModalContext } from '@/context/modal-context' import type { ExternalDataTool } from '@/models/common' import { useToastContext } from '@/app/components/base/toast' -import { ArrowNarrowRight } from '@/app/components/base/icons/src/vender/line/arrows' import { useEventEmitterContextContext } from '@/context/event-emitter' import { ADD_EXTERNAL_DATA_TOOL } from '@/app/components/app/configuration/config-var' import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '@/app/components/base/prompt-editor/plugins/variable-block' @@ -53,9 +52,7 @@ const Prompt: FC = ({ hasSetBlockStatus, showSelectDataSet, externalDataToolsConfig, - isAdvancedMode, isAgent, - setPromptMode, } = useContext(ConfigContext) const { notify } = useToastContext() const { setShowExternalDataToolModal } = useModalContext() @@ -134,9 +131,6 @@ const Prompt: FC = ({
- - -
{mode === AppType.chat ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}
{!readonly && ( = ({ )}
- - {!isAgent && !isAdvancedMode && ( - <> -
-
setPromptMode(PromptMode.advanced)} - > -
{t('appDebug.promptMode.advanced')}
- -
- + {!isAgent && ( + )}
+
{promptTemplate.length}
+
+ )} > void +} + +const AgentSettingButton: FC = ({ + onAgentSettingChange, + isFunctionCall, + isChatModel, + agentConfig, +}) => { + const { t } = useTranslation() + const [isShowAgentSetting, setIsShowAgentSetting] = useState(false) + + return ( + <> + + {isShowAgentSetting && ( + { + onAgentSettingChange(payloadNew) + setIsShowAgentSetting(false) + }} + onCancel={() => setIsShowAgentSetting(false)} + /> + )} + + ) +} +export default React.memo(AgentSettingButton) diff --git a/web/app/components/app/configuration/config/index.tsx b/web/app/components/app/configuration/config/index.tsx index 6f16ace26e..a7275ff781 100644 --- a/web/app/components/app/configuration/config/index.tsx +++ b/web/app/components/app/configuration/config/index.tsx @@ -16,11 +16,10 @@ import AddFeatureBtn from './feature/add-feature-btn' import ChooseFeature from './feature/choose-feature' import useFeature from './feature/use-feature' import AgentTools from './agent/agent-tools' -import AdvancedModeWaring from '@/app/components/app/configuration/prompt-mode/advanced-mode-waring' import ConfigContext from '@/context/debug-configuration' import ConfigPrompt from '@/app/components/app/configuration/config-prompt' import ConfigVar from '@/app/components/app/configuration/config-var' -import { type CitationConfig, type ModelConfig, type ModerationConfig, type MoreLikeThisConfig, PromptMode, type PromptVariable, type SpeechToTextConfig, type SuggestedQuestionsAfterAnswerConfig, type TextToSpeechConfig } from '@/models/debug' +import { type CitationConfig, type ModelConfig, type ModerationConfig, type MoreLikeThisConfig, type PromptVariable, type SpeechToTextConfig, type SuggestedQuestionsAfterAnswerConfig, type TextToSpeechConfig } from '@/models/debug' import { AppType, ModelModeType } from '@/types/app' import { useModalContext } from '@/context/modal-context' import ConfigParamModal from '@/app/components/app/configuration/toolbox/annotation/config-param-modal' @@ -34,8 +33,8 @@ const Config: FC = () => { isAdvancedMode, modelModeType, isAgent, - canReturnToSimpleMode, - setPromptMode, + // canReturnToSimpleMode, + // setPromptMode, hasSetBlockStatus, showHistoryModal, introduction, @@ -209,11 +208,6 @@ const Config: FC = () => { className="grow h-0 relative px-6 pb-[50px] overflow-y-auto" > - { - (isAdvancedMode && canReturnToSimpleMode && !isAgent) && ( - setPromptMode(PromptMode.simple)} /> - ) - } {showChooseFeature && ( { agentConfig: DEFAULT_AGENT_SETTING, }) - const isChatApp = mode === AppType.chat - const isAgent = modelConfig.agentConfig?.enabled - const setIsAgent = (value: boolean) => { - const newModelConfig = produce(modelConfig, (draft: ModelConfig) => { - draft.agentConfig.enabled = value - }) - doSetModelConfig(newModelConfig) - } + const isAgent = mode === 'agent-chat' + const isOpenAI = modelConfig.provider === 'openai' const [collectionList, setCollectionList] = useState([]) @@ -750,9 +744,9 @@ const Configuration: FC = () => { > <>
-
-
- {/* Header Left */} +
+ {/* Header */} +
{t('appDebug.orchestrate')}
@@ -762,35 +756,24 @@ const Configuration: FC = () => { )}
- {isChatApp && ( - { - setIsAgent(value === 'agent') - if (value === 'agent') - setPromptMode(PromptMode.simple) - }} - isFunctionCall={isFunctionCall} - isChatModel={modelConfig.mode === ModelModeType.chat} - agentConfig={modelConfig.agentConfig} - onAgentSettingChange={(config) => { - const nextConfig = produce(modelConfig, (draft: ModelConfig) => { - draft.agentConfig = config - }) - setModelConfig(nextConfig) - }} - /> - )} -
- -
- {!isMobile &&
- {/* Header Right */} -
- {/* Model and Parameters */} - { - !debugWithMultipleModel && ( +
+ {/* Agent Setting */} + {isAgent && ( + { + const nextConfig = produce(modelConfig, (draft: ModelConfig) => { + draft.agentConfig = config + }) + setModelConfig(nextConfig) + }} + /> + )} + {/* Model and Parameters */} + {!debugWithMultipleModel && ( <> { debugWithMultipleModel={debugWithMultipleModel} onDebugWithMultipleModelChange={handleDebugWithMultipleModelChange} /> -
+
- ) - } - - {isMobile && ( - - )} - { - debugWithMultipleModel - ? ( - handlePublish(false, item)} - /> - ) - : ( - - ) - } + )} + + {isMobile && ( + + )} + {debugWithMultipleModel + ? ( handlePublish(false, item)} + />) + : ()} +
+
+
+ +
+ {!isMobile &&
void + setAppDetail: (appDetail?: App) => void } export const useStore = create(set => ({ diff --git a/web/service/log.ts b/web/service/log.ts index b7fce991ef..9238b4947b 100644 --- a/web/service/log.ts +++ b/web/service/log.ts @@ -63,13 +63,3 @@ export const fetchAnnotationsCount: Fetcher = ({ url, params }) => { return get(url, { params }) } - -// TODO -export const fetchFullRunDetail: Fetcher = ({ url, params }) => { - return get(url, { params }) -} - -// TODO -export const fetchTracingDetail: Fetcher = ({ url, params }) => { - return get(url, { params }) -}