|
@@ -77,6 +77,7 @@ import {
|
|
|
correctToolProvider,
|
|
|
} from '@/utils'
|
|
|
import PluginDependency from '@/app/components/workflow/plugin-dependency'
|
|
|
+import { useAppDetailContext } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main'
|
|
|
|
|
|
type PublishConfig = {
|
|
|
modelConfig: ModelConfig
|
|
@@ -824,7 +825,7 @@ const Configuration: FC = () => {
|
|
|
)
|
|
|
setAppSiderbarExpand('collapse')
|
|
|
}
|
|
|
-
|
|
|
+ const { detail, isCreate, isEdit, isOperation } = useAppDetailContext()
|
|
|
if (isLoading) {
|
|
|
return <div className='flex h-full items-center justify-center'>
|
|
|
<Loading type='area' />
|
|
@@ -922,57 +923,61 @@ const Configuration: FC = () => {
|
|
|
)}
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div className='flex items-center'>
|
|
|
- {/* Agent Setting */}
|
|
|
- {isAgent && (
|
|
|
- <AgentSettingButton
|
|
|
- isChatModel={modelConfig.mode === ModelModeType.chat}
|
|
|
- agentConfig={modelConfig.agentConfig}
|
|
|
-
|
|
|
- isFunctionCall={isFunctionCall}
|
|
|
- onAgentSettingChange={(config) => {
|
|
|
- const nextConfig = produce(modelConfig, (draft: ModelConfig) => {
|
|
|
- draft.agentConfig = config
|
|
|
- })
|
|
|
- setModelConfig(nextConfig)
|
|
|
- }}
|
|
|
- />
|
|
|
- )}
|
|
|
- {/* Model and Parameters */}
|
|
|
- {!debugWithMultipleModel && (
|
|
|
- <>
|
|
|
- <ModelParameterModal
|
|
|
- isAdvancedMode={isAdvancedMode}
|
|
|
- mode={mode}
|
|
|
- provider={modelConfig.provider}
|
|
|
- completionParams={completionParams}
|
|
|
- modelId={modelConfig.model_id}
|
|
|
- setModel={setModel as any}
|
|
|
- onCompletionParamsChange={(newParams: FormValue) => {
|
|
|
- setCompletionParams(newParams)
|
|
|
- }}
|
|
|
- debugWithMultipleModel={debugWithMultipleModel}
|
|
|
- onDebugWithMultipleModelChange={handleDebugWithMultipleModelChange}
|
|
|
- />
|
|
|
- <Divider type='vertical' className='mx-2 h-[14px]' />
|
|
|
- </>
|
|
|
- )}
|
|
|
- {isMobile && (
|
|
|
- <Button className='mr-2 !h-8 !text-[13px] font-medium' onClick={showDebugPanel}>
|
|
|
- <span className='mr-1'>{t('appDebug.operation.debugConfig')}</span>
|
|
|
- <CodeBracketIcon className="h-4 w-4 text-text-tertiary" />
|
|
|
- </Button>
|
|
|
- )}
|
|
|
- <AppPublisher {...{
|
|
|
- publishDisabled: cannotPublish,
|
|
|
- publishedAt: (latestPublishedAt || 0) * 1000,
|
|
|
- debugWithMultipleModel,
|
|
|
- multipleModelConfigs,
|
|
|
- onPublish,
|
|
|
- publishedConfig: publishedConfig!,
|
|
|
- resetAppConfig: () => syncToPublishedConfig(publishedConfig!),
|
|
|
- }} />
|
|
|
- </div>
|
|
|
+ {
|
|
|
+ isEdit && (
|
|
|
+ <div className='flex items-center'>
|
|
|
+ {/* Agent Setting */}
|
|
|
+ {isAgent && (
|
|
|
+ <AgentSettingButton
|
|
|
+ isChatModel={modelConfig.mode === ModelModeType.chat}
|
|
|
+ agentConfig={modelConfig.agentConfig}
|
|
|
+
|
|
|
+ isFunctionCall={isFunctionCall}
|
|
|
+ onAgentSettingChange={(config) => {
|
|
|
+ const nextConfig = produce(modelConfig, (draft: ModelConfig) => {
|
|
|
+ draft.agentConfig = config
|
|
|
+ })
|
|
|
+ setModelConfig(nextConfig)
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {/* Model and Parameters */}
|
|
|
+ {!debugWithMultipleModel && (
|
|
|
+ <>
|
|
|
+ <ModelParameterModal
|
|
|
+ isAdvancedMode={isAdvancedMode}
|
|
|
+ mode={mode}
|
|
|
+ provider={modelConfig.provider}
|
|
|
+ completionParams={completionParams}
|
|
|
+ modelId={modelConfig.model_id}
|
|
|
+ setModel={setModel as any}
|
|
|
+ onCompletionParamsChange={(newParams: FormValue) => {
|
|
|
+ setCompletionParams(newParams)
|
|
|
+ }}
|
|
|
+ debugWithMultipleModel={debugWithMultipleModel}
|
|
|
+ onDebugWithMultipleModelChange={handleDebugWithMultipleModelChange}
|
|
|
+ />
|
|
|
+ <Divider type='vertical' className='mx-2 h-[14px]' />
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ {isMobile && (
|
|
|
+ <Button className='mr-2 !h-8 !text-[13px] font-medium' onClick={showDebugPanel}>
|
|
|
+ <span className='mr-1'>{t('appDebug.operation.debugConfig')}</span>
|
|
|
+ <CodeBracketIcon className="h-4 w-4 text-text-tertiary" />
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ <AppPublisher {...{
|
|
|
+ publishDisabled: cannotPublish,
|
|
|
+ publishedAt: (latestPublishedAt || 0) * 1000,
|
|
|
+ debugWithMultipleModel,
|
|
|
+ multipleModelConfigs,
|
|
|
+ onPublish,
|
|
|
+ publishedConfig: publishedConfig!,
|
|
|
+ resetAppConfig: () => syncToPublishedConfig(publishedConfig!),
|
|
|
+ }} />
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className={`flex h-full w-full shrink-0 flex-col sm:w-1/2 ${debugWithMultipleModel && 'max-w-[560px]'}`}>
|