Commit beff31b0 authored by JzoNg's avatar JzoNg

update style app config

parent 2360fb29
...@@ -10,6 +10,7 @@ import AppSideBar from '@/app/components/app-sidebar' ...@@ -10,6 +10,7 @@ import AppSideBar from '@/app/components/app-sidebar'
import type { NavIcon } from '@/app/components/app-sidebar/navLink' import type { NavIcon } from '@/app/components/app-sidebar/navLink'
import { fetchAppDetail } from '@/service/apps' import { fetchAppDetail } from '@/service/apps'
import { useAppContext } from '@/context/app-context' 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, 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' 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<IAppDetailLayoutProps> = (props) => { ...@@ -76,14 +77,20 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
}, [appDetail]) }, [appDetail])
useEffect(() => { useEffect(() => {
setAppDetail()
fetchAppDetail({ url: '/apps', id: appId }).then((res) => { fetchAppDetail({ url: '/apps', id: appId }).then((res) => {
setAppDetail(res) setAppDetail(res)
setNavigation(getNavigations(appId, isCurrentWorkspaceManager, res.mode)) setNavigation(getNavigations(appId, isCurrentWorkspaceManager, res.mode))
}) })
}, [appId, getNavigations, isCurrentWorkspaceManager, setAppDetail]) }, [appId, getNavigations, isCurrentWorkspaceManager, setAppDetail])
if (!appDetail) if (!appDetail) {
return null return (
<div className='flex h-full items-center justify-center bg-white'>
<Loading />
</div>
)
}
// redirections // redirections
if ((appDetail.mode === 'workflow' || appDetail.mode === 'advanced-chat') && (pathname).endsWith('configuration')) if ((appDetail.mode === 'workflow' || appDetail.mode === 'advanced-chat') && (pathname).endsWith('configuration'))
...@@ -93,7 +100,9 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => { ...@@ -93,7 +100,9 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
return ( return (
<div className={cn(s.app, 'flex', 'overflow-hidden')}> <div className={cn(s.app, 'flex', 'overflow-hidden')}>
{appDetail && (
<AppSideBar title={appDetail.name} icon={appDetail.icon} icon_background={appDetail.icon_background} desc={appDetail.mode} navigation={navigation} /> <AppSideBar title={appDetail.name} icon={appDetail.icon} icon_background={appDetail.icon_background} desc={appDetail.mode} navigation={navigation} />
)}
<div className="bg-white grow overflow-hidden"> <div className="bg-white grow overflow-hidden">
{children} {children}
</div> </div>
......
...@@ -66,7 +66,6 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -66,7 +66,6 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
type: 'success', type: 'success',
message: t('app.editDone'), message: t('app.editDone'),
}) })
console.log(app.description)
setAppDetail(app) setAppDetail(app)
mutateApps() mutateApps()
} }
...@@ -151,17 +150,17 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -151,17 +150,17 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
onClick={() => setOpen(v => !v)} onClick={() => setOpen(v => !v)}
className='block' className='block'
> >
<div className='flex cursor-pointer'> <div className={cn('flex cursor-pointer p-1 rounded-lg hover:bg-gray-100', open && 'bg-gray-100')}>
<div className='shrink-0 mr-2'> <div className='shrink-0 mr-2'>
<AppIcon icon={appDetail.icon} background={appDetail.icon_background} /> <AppIcon size="large" icon={appDetail.icon} background={appDetail.icon_background} />
</div> </div>
{expand && ( {expand && (
<div className="grow w-0 pt-[2px]"> <div className="grow w-0">
<div className='flex justify-between items-center text-sm leading-4 font-medium text-gray-900'> <div className='flex justify-between items-center text-sm leading-5 font-medium text-gray-900'>
<div className='truncate' title={appDetail.name}>{appDetail.name}</div> <div className='truncate' title={appDetail.name}>{appDetail.name}</div>
<ChevronDown className='shrink-0 ml-[2px] w-3 h-3 text-gray-500' /> <ChevronDown className='shrink-0 ml-[2px] w-3 h-3 text-gray-500' />
</div> </div>
<div className='flex items-center text-xs leading-[18px] font-medium text-gray-500 gap-1'> <div className='flex items-center text-[10px] leading-[18px] font-medium text-gray-500 gap-1'>
{appDetail.mode === 'advanced-chat' && ( {appDetail.mode === 'advanced-chat' && (
<> <>
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.chatbot').toUpperCase()}</div> <div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.chatbot').toUpperCase()}</div>
...@@ -193,11 +192,11 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -193,11 +192,11 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
{/* header */} {/* header */}
<div className={cn('flex pl-4 pt-3 pr-3', !appDetail.description && 'pb-2')}> <div className={cn('flex pl-4 pt-3 pr-3', !appDetail.description && 'pb-2')}>
<div className='shrink-0 mr-2'> <div className='shrink-0 mr-2'>
<AppIcon icon={appDetail.icon} background={appDetail.icon_background} /> <AppIcon size="large" icon={appDetail.icon} background={appDetail.icon_background} />
</div> </div>
<div className='grow w-0 pt-[2px]'> <div className='grow w-0'>
<div title={appDetail.name} className='flex justify-between items-center text-sm leading-4 font-medium text-gray-900 truncate'>{appDetail.name}</div> <div title={appDetail.name} className='flex justify-between items-center text-sm leading-5 font-medium text-gray-900 truncate'>{appDetail.name}</div>
<div className='flex items-center text-xs leading-[18px] font-medium text-gray-500 gap-1'> <div className='flex items-center text-[10px] leading-[18px] font-medium text-gray-500 gap-1'>
{appDetail.mode === 'advanced-chat' && ( {appDetail.mode === 'advanced-chat' && (
<> <>
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.chatbot').toUpperCase()}</div> <div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.chatbot').toUpperCase()}</div>
......
...@@ -58,7 +58,7 @@ const ICON_MAP = { ...@@ -58,7 +58,7 @@ const ICON_MAP = {
export default function AppBasic({ icon, icon_background, name, type, hoverTip, textStyle, mode = 'expand', iconType = 'app' }: IAppBasicProps) { export default function AppBasic({ icon, icon_background, name, type, hoverTip, textStyle, mode = 'expand', iconType = 'app' }: IAppBasicProps) {
return ( return (
<div className="flex items-start"> <div className="flex items-start p-1">
{icon && icon_background && iconType === 'app' && ( {icon && icon_background && iconType === 'app' && (
<div className='flex-shrink-0 mr-3'> <div className='flex-shrink-0 mr-3'>
<AppIcon icon={icon} background={icon_background} /> <AppIcon icon={icon} background={icon_background} />
......
...@@ -60,7 +60,7 @@ const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInf ...@@ -60,7 +60,7 @@ const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInf
<div <div
className={` className={`
shrink-0 shrink-0
${expand ? 'p-4' : 'p-2'} ${expand ? 'p-3' : 'p-2'}
`} `}
> >
{iconType === 'app' && ( {iconType === 'app' && (
......
...@@ -9,7 +9,7 @@ import { useContext } from 'use-context-selector' ...@@ -9,7 +9,7 @@ import { useContext } from 'use-context-selector'
import ConfirmAddVar from './confirm-add-var' import ConfirmAddVar from './confirm-add-var'
import s from './style.module.css' import s from './style.module.css'
import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap' 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 Tooltip from '@/app/components/base/tooltip'
import { AppType } from '@/types/app' import { AppType } from '@/types/app'
import { getNewVar, getVars } from '@/utils/var' import { getNewVar, getVars } from '@/utils/var'
...@@ -22,7 +22,6 @@ import ConfigContext from '@/context/debug-configuration' ...@@ -22,7 +22,6 @@ import ConfigContext from '@/context/debug-configuration'
import { useModalContext } from '@/context/modal-context' import { useModalContext } from '@/context/modal-context'
import type { ExternalDataTool } from '@/models/common' import type { ExternalDataTool } from '@/models/common'
import { useToastContext } from '@/app/components/base/toast' 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 { useEventEmitterContextContext } from '@/context/event-emitter'
import { ADD_EXTERNAL_DATA_TOOL } from '@/app/components/app/configuration/config-var' 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' import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '@/app/components/base/prompt-editor/plugins/variable-block'
...@@ -53,9 +52,7 @@ const Prompt: FC<ISimplePromptInput> = ({ ...@@ -53,9 +52,7 @@ const Prompt: FC<ISimplePromptInput> = ({
hasSetBlockStatus, hasSetBlockStatus,
showSelectDataSet, showSelectDataSet,
externalDataToolsConfig, externalDataToolsConfig,
isAdvancedMode,
isAgent, isAgent,
setPromptMode,
} = useContext(ConfigContext) } = useContext(ConfigContext)
const { notify } = useToastContext() const { notify } = useToastContext()
const { setShowExternalDataToolModal } = useModalContext() const { setShowExternalDataToolModal } = useModalContext()
...@@ -134,9 +131,6 @@ const Prompt: FC<ISimplePromptInput> = ({ ...@@ -134,9 +131,6 @@ const Prompt: FC<ISimplePromptInput> = ({
<div className='rounded-xl bg-[#EEF4FF]'> <div className='rounded-xl bg-[#EEF4FF]'>
<div className="flex justify-between items-center h-11 px-3"> <div className="flex justify-between items-center h-11 px-3">
<div className="flex items-center space-x-1"> <div className="flex items-center space-x-1">
<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fillRule="evenodd" clipRule="evenodd" d="M3.00001 0.100098C3.21218 0.100098 3.41566 0.184383 3.56569 0.334412C3.71572 0.484441 3.80001 0.687924 3.80001 0.900098V1.7001H4.60001C4.81218 1.7001 5.01566 1.78438 5.16569 1.93441C5.31572 2.08444 5.40001 2.28792 5.40001 2.5001C5.40001 2.71227 5.31572 2.91575 5.16569 3.06578C5.01566 3.21581 4.81218 3.3001 4.60001 3.3001H3.80001V4.1001C3.80001 4.31227 3.71572 4.51575 3.56569 4.66578C3.41566 4.81581 3.21218 4.9001 3.00001 4.9001C2.78783 4.9001 2.58435 4.81581 2.43432 4.66578C2.28429 4.51575 2.20001 4.31227 2.20001 4.1001V3.3001H1.40001C1.18783 3.3001 0.98435 3.21581 0.834321 3.06578C0.684292 2.91575 0.600006 2.71227 0.600006 2.5001C0.600006 2.28792 0.684292 2.08444 0.834321 1.93441C0.98435 1.78438 1.18783 1.7001 1.40001 1.7001H2.20001V0.900098C2.20001 0.687924 2.28429 0.484441 2.43432 0.334412C2.58435 0.184383 2.78783 0.100098 3.00001 0.100098ZM3.00001 8.1001C3.21218 8.1001 3.41566 8.18438 3.56569 8.33441C3.71572 8.48444 3.80001 8.68792 3.80001 8.9001V9.7001H4.60001C4.81218 9.7001 5.01566 9.78438 5.16569 9.93441C5.31572 10.0844 5.40001 10.2879 5.40001 10.5001C5.40001 10.7123 5.31572 10.9158 5.16569 11.0658C5.01566 11.2158 4.81218 11.3001 4.60001 11.3001H3.80001V12.1001C3.80001 12.3123 3.71572 12.5158 3.56569 12.6658C3.41566 12.8158 3.21218 12.9001 3.00001 12.9001C2.78783 12.9001 2.58435 12.8158 2.43432 12.6658C2.28429 12.5158 2.20001 12.3123 2.20001 12.1001V11.3001H1.40001C1.18783 11.3001 0.98435 11.2158 0.834321 11.0658C0.684292 10.9158 0.600006 10.7123 0.600006 10.5001C0.600006 10.2879 0.684292 10.0844 0.834321 9.93441C0.98435 9.78438 1.18783 9.7001 1.40001 9.7001H2.20001V8.9001C2.20001 8.68792 2.28429 8.48444 2.43432 8.33441C2.58435 8.18438 2.78783 8.1001 3.00001 8.1001ZM8.60001 0.100098C8.77656 0.100041 8.94817 0.158388 9.0881 0.266047C9.22802 0.373706 9.32841 0.52463 9.37361 0.695298L10.3168 4.2601L13 5.8073C13.1216 5.87751 13.2226 5.9785 13.2928 6.10011C13.363 6.22173 13.4 6.35967 13.4 6.5001C13.4 6.64052 13.363 6.77847 13.2928 6.90008C13.2226 7.02169 13.1216 7.12268 13 7.1929L10.3168 8.7409L9.37281 12.3049C9.32753 12.4754 9.22716 12.6262 9.08732 12.7337C8.94748 12.8413 8.77602 12.8996 8.59961 12.8996C8.42319 12.8996 8.25173 12.8413 8.11189 12.7337C7.97205 12.6262 7.87169 12.4754 7.82641 12.3049L6.88321 8.7401L4.20001 7.1929C4.0784 7.12268 3.97742 7.02169 3.90721 6.90008C3.837 6.77847 3.80004 6.64052 3.80004 6.5001C3.80004 6.35967 3.837 6.22173 3.90721 6.10011C3.97742 5.9785 4.0784 5.87751 4.20001 5.8073L6.88321 4.2593L7.82721 0.695298C7.87237 0.524762 7.97263 0.373937 8.1124 0.266291C8.25216 0.158646 8.42359 0.100217 8.60001 0.100098Z" fill="#5850EC" />
</svg>
<div className='h2'>{mode === AppType.chat ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}</div> <div className='h2'>{mode === AppType.chat ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}</div>
{!readonly && ( {!readonly && (
<Tooltip <Tooltip
...@@ -149,26 +143,21 @@ const Prompt: FC<ISimplePromptInput> = ({ ...@@ -149,26 +143,21 @@ const Prompt: FC<ISimplePromptInput> = ({
)} )}
</div> </div>
<div className='flex items-center'> <div className='flex items-center'>
{!isAgent && (
<AutomaticBtn onClick={showAutomaticTrue} /> <AutomaticBtn onClick={showAutomaticTrue} />
{!isAgent && !isAdvancedMode && (
<>
<div className='mx-1 w-px h-3.5 bg-black/5'></div>
<div
className='flex items-center px-2 space-x-1 text-xs font-semibold text-[#444CE7] cursor-pointer'
onClick={() => setPromptMode(PromptMode.advanced)}
>
<div>{t('appDebug.promptMode.advanced')}</div>
<ArrowNarrowRight className='w-3 h-3'></ArrowNarrowRight>
</div>
</>
)} )}
</div> </div>
</div> </div>
<PromptEditorHeightResizeWrap <PromptEditorHeightResizeWrap
className='px-4 py-2 min-h-[228px] bg-white rounded-xl text-sm text-gray-700' className='px-4 pt-2 min-h-[228px] bg-white rounded-t-xl text-sm text-gray-700'
height={editorHeight} height={editorHeight}
minHeight={minHeight} minHeight={minHeight}
onHeightChange={setEditorHeight} onHeightChange={setEditorHeight}
footer={(
<div className='pl-4 pb-2 flex bg-white rounded-b-xl'>
<div className="h-[18px] leading-[18px] px-1 rounded-md bg-gray-100 text-xs text-gray-500">{promptTemplate.length}</div>
</div>
)}
> >
<PromptEditor <PromptEditor
className='min-h-[210px]' className='min-h-[210px]'
......
'use client'
import type { FC } from 'react'
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import AgentSetting from './agent/agent-setting'
import Button from '@/app/components/base/button'
import { Settings01 } from '@/app/components/base/icons/src/vender/line/general'
import type { AgentConfig } from '@/models/debug'
type Props = {
isFunctionCall: boolean
isChatModel: boolean
agentConfig?: AgentConfig
onAgentSettingChange: (payload: AgentConfig) => void
}
const AgentSettingButton: FC<Props> = ({
onAgentSettingChange,
isFunctionCall,
isChatModel,
agentConfig,
}) => {
const { t } = useTranslation()
const [isShowAgentSetting, setIsShowAgentSetting] = useState(false)
return (
<>
<Button onClick={() => setIsShowAgentSetting(true)} className='shrink-0 mr-2 !px-3 !h-8 !text-[13px] font-medium text-gray-700'>
<Settings01 className='mr-1 w-4 h-4 text-gray-500' />
{t('appDebug.agent.setting.name')}
</Button>
{isShowAgentSetting && (
<AgentSetting
isFunctionCall={isFunctionCall}
payload={agentConfig as AgentConfig}
isChatModel={isChatModel}
onSave={(payloadNew) => {
onAgentSettingChange(payloadNew)
setIsShowAgentSetting(false)
}}
onCancel={() => setIsShowAgentSetting(false)}
/>
)}
</>
)
}
export default React.memo(AgentSettingButton)
...@@ -16,11 +16,10 @@ import AddFeatureBtn from './feature/add-feature-btn' ...@@ -16,11 +16,10 @@ import AddFeatureBtn from './feature/add-feature-btn'
import ChooseFeature from './feature/choose-feature' import ChooseFeature from './feature/choose-feature'
import useFeature from './feature/use-feature' import useFeature from './feature/use-feature'
import AgentTools from './agent/agent-tools' 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 ConfigContext from '@/context/debug-configuration'
import ConfigPrompt from '@/app/components/app/configuration/config-prompt' import ConfigPrompt from '@/app/components/app/configuration/config-prompt'
import ConfigVar from '@/app/components/app/configuration/config-var' 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 { AppType, ModelModeType } from '@/types/app'
import { useModalContext } from '@/context/modal-context' import { useModalContext } from '@/context/modal-context'
import ConfigParamModal from '@/app/components/app/configuration/toolbox/annotation/config-param-modal' import ConfigParamModal from '@/app/components/app/configuration/toolbox/annotation/config-param-modal'
...@@ -34,8 +33,8 @@ const Config: FC = () => { ...@@ -34,8 +33,8 @@ const Config: FC = () => {
isAdvancedMode, isAdvancedMode,
modelModeType, modelModeType,
isAgent, isAgent,
canReturnToSimpleMode, // canReturnToSimpleMode,
setPromptMode, // setPromptMode,
hasSetBlockStatus, hasSetBlockStatus,
showHistoryModal, showHistoryModal,
introduction, introduction,
...@@ -209,11 +208,6 @@ const Config: FC = () => { ...@@ -209,11 +208,6 @@ const Config: FC = () => {
className="grow h-0 relative px-6 pb-[50px] overflow-y-auto" className="grow h-0 relative px-6 pb-[50px] overflow-y-auto"
> >
<AddFeatureBtn toBottomHeight={toBottomHeight} onClick={showChooseFeatureTrue} /> <AddFeatureBtn toBottomHeight={toBottomHeight} onClick={showChooseFeatureTrue} />
{
(isAdvancedMode && canReturnToSimpleMode && !isAgent) && (
<AdvancedModeWaring onReturnToSimpleMode={() => setPromptMode(PromptMode.simple)} />
)
}
{showChooseFeature && ( {showChooseFeature && (
<ChooseFeature <ChooseFeature
isShow={showChooseFeature} isShow={showChooseFeature}
......
...@@ -11,6 +11,7 @@ import { clone, isEqual } from 'lodash-es' ...@@ -11,6 +11,7 @@ import { clone, isEqual } from 'lodash-es'
import { CodeBracketIcon } from '@heroicons/react/20/solid' import { CodeBracketIcon } from '@heroicons/react/20/solid'
import Button from '../../base/button' import Button from '../../base/button'
import Loading from '../../base/loading' import Loading from '../../base/loading'
import AgentSettingButton from './config/agent-setting-button'
import useAdvancedPromptConfig from './hooks/use-advanced-prompt-config' import useAdvancedPromptConfig from './hooks/use-advanced-prompt-config'
import EditHistoryModal from './config-prompt/conversation-histroy/edit-modal' import EditHistoryModal from './config-prompt/conversation-histroy/edit-modal'
import { import {
...@@ -20,7 +21,6 @@ import { ...@@ -20,7 +21,6 @@ import {
import type { ModelAndParameter } from './debug/types' import type { ModelAndParameter } from './debug/types'
import { APP_SIDEBAR_SHOULD_COLLAPSE } from './debug/types' import { APP_SIDEBAR_SHOULD_COLLAPSE } from './debug/types'
import PublishWithMultipleModel from './debug/debug-with-multiple-model/publish-with-multiple-model' import PublishWithMultipleModel from './debug/debug-with-multiple-model/publish-with-multiple-model'
import AssistantTypePicker from './config/assistant-type-picker'
import type { import type {
AnnotationReplyConfig, AnnotationReplyConfig,
DatasetConfigs, DatasetConfigs,
...@@ -161,14 +161,8 @@ const Configuration: FC = () => { ...@@ -161,14 +161,8 @@ const Configuration: FC = () => {
agentConfig: DEFAULT_AGENT_SETTING, agentConfig: DEFAULT_AGENT_SETTING,
}) })
const isChatApp = mode === AppType.chat const isAgent = mode === 'agent-chat'
const isAgent = modelConfig.agentConfig?.enabled
const setIsAgent = (value: boolean) => {
const newModelConfig = produce(modelConfig, (draft: ModelConfig) => {
draft.agentConfig.enabled = value
})
doSetModelConfig(newModelConfig)
}
const isOpenAI = modelConfig.provider === 'openai' const isOpenAI = modelConfig.provider === 'openai'
const [collectionList, setCollectionList] = useState<Collection[]>([]) const [collectionList, setCollectionList] = useState<Collection[]>([])
...@@ -750,9 +744,9 @@ const Configuration: FC = () => { ...@@ -750,9 +744,9 @@ const Configuration: FC = () => {
> >
<> <>
<div className="flex flex-col h-full"> <div className="flex flex-col h-full">
<div className='flex grow h-[200px]'> <div className='relative flex grow h-[200px] pt-14'>
<div className={`w-full sm:w-1/2 shrink-0 flex flex-col h-full ${debugWithMultipleModel && 'max-w-[560px]'}`}> {/* Header */}
{/* Header Left */} <div className='absolute top-0 left-0 w-full h-14 bg-white'>
<div className='flex justify-between items-center px-6 h-14'> <div className='flex justify-between items-center px-6 h-14'>
<div className='flex items-center'> <div className='flex items-center'>
<div className='leading-6 text-base font-semibold text-gray-900'>{t('appDebug.orchestrate')}</div> <div className='leading-6 text-base font-semibold text-gray-900'>{t('appDebug.orchestrate')}</div>
...@@ -762,18 +756,14 @@ const Configuration: FC = () => { ...@@ -762,18 +756,14 @@ const Configuration: FC = () => {
)} )}
</div> </div>
</div> </div>
{isChatApp && ( <div className='flex items-center'>
<AssistantTypePicker {/* Agent Setting */}
value={isAgent ? 'agent' : 'assistant'} {isAgent && (
disabled={isAdvancedMode && !canReturnToSimpleMode} <AgentSettingButton
onChange={(value: string) => {
setIsAgent(value === 'agent')
if (value === 'agent')
setPromptMode(PromptMode.simple)
}}
isFunctionCall={isFunctionCall}
isChatModel={modelConfig.mode === ModelModeType.chat} isChatModel={modelConfig.mode === ModelModeType.chat}
agentConfig={modelConfig.agentConfig} agentConfig={modelConfig.agentConfig}
isFunctionCall={isFunctionCall}
onAgentSettingChange={(config) => { onAgentSettingChange={(config) => {
const nextConfig = produce(modelConfig, (draft: ModelConfig) => { const nextConfig = produce(modelConfig, (draft: ModelConfig) => {
draft.agentConfig = config draft.agentConfig = config
...@@ -782,15 +772,8 @@ const Configuration: FC = () => { ...@@ -782,15 +772,8 @@ const Configuration: FC = () => {
}} }}
/> />
)} )}
</div>
<Config />
</div>
{!isMobile && <div className="grow relative w-1/2 h-full overflow-y-auto flex flex-col " style={{ borderColor: 'rgba(0, 0, 0, 0.02)' }}>
{/* Header Right */}
<div className='flex justify-end items-center flex-wrap px-6 h-14 space-x-2'>
{/* Model and Parameters */} {/* Model and Parameters */}
{ {!debugWithMultipleModel && (
!debugWithMultipleModel && (
<> <>
<ModelParameterModal <ModelParameterModal
isAdvancedMode={isAdvancedMode} isAdvancedMode={isAdvancedMode}
...@@ -805,36 +788,35 @@ const Configuration: FC = () => { ...@@ -805,36 +788,35 @@ const Configuration: FC = () => {
debugWithMultipleModel={debugWithMultipleModel} debugWithMultipleModel={debugWithMultipleModel}
onDebugWithMultipleModelChange={handleDebugWithMultipleModelChange} onDebugWithMultipleModelChange={handleDebugWithMultipleModelChange}
/> />
<div className='w-[1px] h-[14px] bg-gray-200'></div> <div className='mx-2 w-[1px] h-[14px] bg-gray-200'></div>
</> </>
) )}
} <Button onClick={() => setShowConfirm(true)} className='shrink-0 mr-2 w-[70px] !h-8 !text-[13px] font-medium text-gray-900'>{t('appDebug.operation.resetConfig')}</Button>
<Button onClick={() => setShowConfirm(true)} className='shrink-0 mr-2 w-[70px] !h-8 !text-[13px] font-medium'>{t('appDebug.operation.resetConfig')}</Button>
{isMobile && ( {isMobile && (
<Button className='!h-8 !text-[13px] font-medium' onClick={showDebugPanel}> <Button className='!h-8 !text-[13px] font-medium' onClick={showDebugPanel}>
<span className='mr-1'>{t('appDebug.operation.debugConfig')}</span> <span className='mr-1'>{t('appDebug.operation.debugConfig')}</span>
<CodeBracketIcon className="h-4 w-4 text-gray-500" /> <CodeBracketIcon className="h-4 w-4 text-gray-500" />
</Button> </Button>
)} )}
{ {debugWithMultipleModel
debugWithMultipleModel ? (<PublishWithMultipleModel
? (
<PublishWithMultipleModel
multipleModelConfigs={multipleModelConfigs} multipleModelConfigs={multipleModelConfigs}
onSelect={item => handlePublish(false, item)} onSelect={item => handlePublish(false, item)}
/> />)
) : (<Button
: (
<Button
type='primary' type='primary'
onClick={() => handlePublish(false)} onClick={() => handlePublish(false)}
className={cn(cannotPublish && '!bg-primary-200 !cursor-not-allowed', 'shrink-0 w-[70px] !h-8 !text-[13px] font-medium')} className={cn(cannotPublish && '!bg-primary-200 !cursor-not-allowed', 'shrink-0 w-[70px] !h-8 !text-[13px] font-medium')}
> >
{t('appDebug.operation.applyConfig')} {t('appDebug.operation.applyConfig')}
</Button> </Button>)}
) </div>
}
</div> </div>
</div>
<div className={`w-full sm:w-1/2 shrink-0 flex flex-col h-full ${debugWithMultipleModel && 'max-w-[560px]'}`}>
<Config />
</div>
{!isMobile && <div className="grow relative w-1/2 h-full overflow-y-auto flex flex-col " style={{ borderColor: 'rgba(0, 0, 0, 0.02)' }}>
<div className='flex flex-col grow h-0 rounded-tl-2xl border-t border-l bg-gray-50 '> <div className='flex flex-col grow h-0 rounded-tl-2xl border-t border-l bg-gray-50 '>
<Debug <Debug
hasSetAPIKEY={hasSettedApiKey} hasSetAPIKEY={hasSettedApiKey}
......
...@@ -6,7 +6,7 @@ type State = { ...@@ -6,7 +6,7 @@ type State = {
} }
type Action = { type Action = {
setAppDetail: (appDetail: App) => void setAppDetail: (appDetail?: App) => void
} }
export const useStore = create<State & Action>(set => ({ export const useStore = create<State & Action>(set => ({
......
...@@ -63,13 +63,3 @@ export const fetchAnnotationsCount: Fetcher<AnnotationsCountResponse, { url: str ...@@ -63,13 +63,3 @@ export const fetchAnnotationsCount: Fetcher<AnnotationsCountResponse, { url: str
export const fetchWorkflowLogs: Fetcher<WorkflowLogsResponse, { url: string; params?: WorkflowLogsRequest }> = ({ url, params }) => { export const fetchWorkflowLogs: Fetcher<WorkflowLogsResponse, { url: string; params?: WorkflowLogsRequest }> = ({ url, params }) => {
return get<WorkflowLogsResponse>(url, { params }) return get<WorkflowLogsResponse>(url, { params })
} }
// TODO
export const fetchFullRunDetail: Fetcher<WorkflowLogsResponse, { url: string; params?: WorkflowLogsRequest }> = ({ url, params }) => {
return get<WorkflowLogsResponse>(url, { params })
}
// TODO
export const fetchTracingDetail: Fetcher<WorkflowLogsResponse, { url: string; params?: WorkflowLogsRequest }> = ({ url, params }) => {
return get<WorkflowLogsResponse>(url, { params })
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment