|
@@ -11,9 +11,9 @@ import { clone, isEqual } from 'lodash-es'
|
|
|
import { CodeBracketIcon } from '@heroicons/react/20/solid'
|
|
|
import Button from '../../base/button'
|
|
|
import Loading from '../../base/loading'
|
|
|
-import s from './style.module.css'
|
|
|
import useAdvancedPromptConfig from './hooks/use-advanced-prompt-config'
|
|
|
import EditHistoryModal from './config-prompt/conversation-histroy/edit-modal'
|
|
|
+import AssistantTypePicker from './config/assistant-type-picker'
|
|
|
import type {
|
|
|
AnnotationReplyConfig,
|
|
|
DatasetConfigs,
|
|
@@ -37,10 +37,9 @@ import { fetchAppDetail, updateAppModelConfig } from '@/service/apps'
|
|
|
import { promptVariablesToUserInputsForm, userInputsFormToPromptVariables } from '@/utils/model-config'
|
|
|
import { fetchDatasets } from '@/service/datasets'
|
|
|
import { useProviderContext } from '@/context/provider-context'
|
|
|
-import { AppType, ModelModeType, RETRIEVE_TYPE, Resolution, TransferMethod } from '@/types/app'
|
|
|
-import { FlipBackward } from '@/app/components/base/icons/src/vender/line/arrows'
|
|
|
+import { AgentStrategy, AppType, ModelModeType, RETRIEVE_TYPE, Resolution, TransferMethod } from '@/types/app'
|
|
|
import { PromptMode } from '@/models/debug'
|
|
|
-import { ANNOTATION_DEFAULT, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config'
|
|
|
+import { ANNOTATION_DEFAULT, DEFAULT_AGENT_SETTING, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config'
|
|
|
import SelectDataSet from '@/app/components/app/configuration/dataset-config/select-dataset'
|
|
|
import I18n from '@/context/i18n'
|
|
|
import { useModalContext } from '@/context/modal-context'
|
|
@@ -49,6 +48,8 @@ import Drawer from '@/app/components/base/drawer'
|
|
|
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
|
|
|
import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
|
|
import { useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
|
|
+import { fetchCollectionList } from '@/service/tools'
|
|
|
+import { type Collection } from '@/app/components/tools/types'
|
|
|
|
|
|
type PublichConfig = {
|
|
|
modelConfig: ModelConfig
|
|
@@ -75,6 +76,7 @@ const Configuration: FC = () => {
|
|
|
const [isShowDebugPanel, { setTrue: showDebugPanel, setFalse: hideDebugPanel }] = useBoolean(false)
|
|
|
|
|
|
const [introduction, setIntroduction] = useState<string>('')
|
|
|
+ const [suggestedQuestions, setSuggestedQuestions] = useState<string[]>([])
|
|
|
const [controlClearChatMessage, setControlClearChatMessage] = useState(0)
|
|
|
const [prevPromptConfig, setPrevPromptConfig] = useState<PromptConfig>({
|
|
|
prompt_template: '',
|
|
@@ -141,8 +143,23 @@ const Configuration: FC = () => {
|
|
|
retriever_resource: null,
|
|
|
sensitive_word_avoidance: null,
|
|
|
dataSets: [],
|
|
|
+ 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 isOpenAI = modelConfig.provider === 'openai'
|
|
|
+ const isFunctionCall = isOpenAI && modelConfig.mode === ModelModeType.chat
|
|
|
|
|
|
+ const [collectionList, setCollectionList] = useState<Collection[]>([])
|
|
|
+ useEffect(() => {
|
|
|
+
|
|
|
+ }, [])
|
|
|
const [datasetConfigs, setDatasetConfigs] = useState<DatasetConfigs>({
|
|
|
retrieval_model: RETRIEVE_TYPE.oneWay,
|
|
|
reranking_model: {
|
|
@@ -152,6 +169,9 @@ const Configuration: FC = () => {
|
|
|
top_k: 2,
|
|
|
score_threshold_enabled: false,
|
|
|
score_threshold: 0.7,
|
|
|
+ datasets: {
|
|
|
+ datasets: [],
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
const setModelConfig = (newModelConfig: ModelConfig) => {
|
|
@@ -165,7 +185,7 @@ const Configuration: FC = () => {
|
|
|
}, [modelModeType])
|
|
|
|
|
|
const [dataSets, setDataSets] = useState<DataSet[]>([])
|
|
|
- const contextVar = modelConfig.configs.prompt_variables.find(item => item.is_context_var)?.key
|
|
|
+ const contextVar = modelConfig.configs.prompt_variables.find((item: any) => item.is_context_var)?.key
|
|
|
const hasSetContextVar = !!contextVar
|
|
|
const [isShowSelectDataSet, { setTrue: showSelectDataSet, setFalse: hideSelectDataSet }] = useBoolean(false)
|
|
|
const selectedIds = dataSets.map(item => item.id)
|
|
@@ -335,83 +355,131 @@ const Configuration: FC = () => {
|
|
|
}
|
|
|
|
|
|
useEffect(() => {
|
|
|
- fetchAppDetail({ url: '/apps', id: appId }).then(async (res: any) => {
|
|
|
- setMode(res.mode)
|
|
|
- const modelConfig = res.model_config
|
|
|
- const promptMode = modelConfig.prompt_type === PromptMode.advanced ? PromptMode.advanced : PromptMode.simple
|
|
|
- doSetPromptMode(promptMode)
|
|
|
- if (promptMode === PromptMode.advanced) {
|
|
|
- setChatPromptConfig(modelConfig.chat_prompt_config || clone(DEFAULT_CHAT_PROMPT_CONFIG) as any)
|
|
|
- setCompletionPromptConfig(modelConfig.completion_prompt_config || clone(DEFAULT_COMPLETION_PROMPT_CONFIG) as any)
|
|
|
- setCanReturnToSimpleMode(false)
|
|
|
- }
|
|
|
-
|
|
|
- const model = res.model_config.model
|
|
|
-
|
|
|
- let datasets: any = null
|
|
|
- if (modelConfig.agent_mode?.enabled)
|
|
|
- datasets = modelConfig.agent_mode?.tools.filter(({ dataset }: any) => dataset?.enabled)
|
|
|
-
|
|
|
- if (dataSets && datasets?.length && datasets?.length > 0) {
|
|
|
- const { data: dataSetsWithDetail } = await fetchDatasets({ url: '/datasets', params: { page: 1, ids: datasets.map(({ dataset }: any) => dataset.id) } })
|
|
|
- datasets = dataSetsWithDetail
|
|
|
- setDataSets(datasets)
|
|
|
- }
|
|
|
-
|
|
|
- setIntroduction(modelConfig.opening_statement)
|
|
|
- if (modelConfig.more_like_this)
|
|
|
- setMoreLikeThisConfig(modelConfig.more_like_this)
|
|
|
-
|
|
|
- if (modelConfig.suggested_questions_after_answer)
|
|
|
- setSuggestedQuestionsAfterAnswerConfig(modelConfig.suggested_questions_after_answer)
|
|
|
-
|
|
|
- if (modelConfig.speech_to_text)
|
|
|
- setSpeechToTextConfig(modelConfig.speech_to_text)
|
|
|
-
|
|
|
- if (modelConfig.retriever_resource)
|
|
|
- setCitationConfig(modelConfig.retriever_resource)
|
|
|
+ (async () => {
|
|
|
+ const collectionList = await fetchCollectionList() as Collection[]
|
|
|
+ setCollectionList(collectionList)
|
|
|
+ fetchAppDetail({ url: '/apps', id: appId }).then(async (res: any) => {
|
|
|
+ setMode(res.mode)
|
|
|
+ const modelConfig = res.model_config
|
|
|
+ const promptMode = modelConfig.prompt_type === PromptMode.advanced ? PromptMode.advanced : PromptMode.simple
|
|
|
+ doSetPromptMode(promptMode)
|
|
|
+ if (promptMode === PromptMode.advanced) {
|
|
|
+ setChatPromptConfig(modelConfig.chat_prompt_config || clone(DEFAULT_CHAT_PROMPT_CONFIG) as any)
|
|
|
+ setCompletionPromptConfig(modelConfig.completion_prompt_config || clone(DEFAULT_COMPLETION_PROMPT_CONFIG) as any)
|
|
|
+ setCanReturnToSimpleMode(false)
|
|
|
+ }
|
|
|
|
|
|
- if (modelConfig.annotation_reply)
|
|
|
- setAnnotationConfig(modelConfig.annotation_reply, true)
|
|
|
+ const model = res.model_config.model
|
|
|
|
|
|
- if (modelConfig.sensitive_word_avoidance)
|
|
|
- setModerationConfig(modelConfig.sensitive_word_avoidance)
|
|
|
+ let datasets: any = null
|
|
|
+ // old dataset struct
|
|
|
+ if (modelConfig.agent_mode?.tools?.find(({ dataset }: any) => dataset?.enabled))
|
|
|
+ datasets = modelConfig.agent_mode?.tools.filter(({ dataset }: any) => dataset?.enabled)
|
|
|
+ // new dataset struct
|
|
|
+ else if (modelConfig.dataset_configs.datasets?.datasets?.length > 0)
|
|
|
+ datasets = modelConfig.dataset_configs?.datasets?.datasets
|
|
|
|
|
|
- if (modelConfig.external_data_tools)
|
|
|
- setExternalDataToolsConfig(modelConfig.external_data_tools)
|
|
|
+ if (dataSets && datasets?.length && datasets?.length > 0) {
|
|
|
+ const { data: dataSetsWithDetail } = await fetchDatasets({ url: '/datasets', params: { page: 1, ids: datasets.map(({ dataset }: any) => dataset.id) } })
|
|
|
+ datasets = dataSetsWithDetail
|
|
|
+ setDataSets(datasets)
|
|
|
+ }
|
|
|
|
|
|
- const config = {
|
|
|
- modelConfig: {
|
|
|
- provider: model.provider,
|
|
|
- model_id: model.name,
|
|
|
- mode: model.mode,
|
|
|
- configs: {
|
|
|
- prompt_template: modelConfig.pre_prompt,
|
|
|
- prompt_variables: userInputsFormToPromptVariables(modelConfig.user_input_form, modelConfig.dataset_query_variable),
|
|
|
+ setIntroduction(modelConfig.opening_statement)
|
|
|
+ setSuggestedQuestions(modelConfig.suggested_questions || [])
|
|
|
+ if (modelConfig.more_like_this)
|
|
|
+ setMoreLikeThisConfig(modelConfig.more_like_this)
|
|
|
+
|
|
|
+ if (modelConfig.suggested_questions_after_answer)
|
|
|
+ setSuggestedQuestionsAfterAnswerConfig(modelConfig.suggested_questions_after_answer)
|
|
|
+
|
|
|
+ if (modelConfig.speech_to_text)
|
|
|
+ setSpeechToTextConfig(modelConfig.speech_to_text)
|
|
|
+
|
|
|
+ if (modelConfig.retriever_resource)
|
|
|
+ setCitationConfig(modelConfig.retriever_resource)
|
|
|
+
|
|
|
+ if (modelConfig.annotation_reply)
|
|
|
+ setAnnotationConfig(modelConfig.annotation_reply, true)
|
|
|
+
|
|
|
+ if (modelConfig.sensitive_word_avoidance)
|
|
|
+ setModerationConfig(modelConfig.sensitive_word_avoidance)
|
|
|
+
|
|
|
+ if (modelConfig.external_data_tools)
|
|
|
+ setExternalDataToolsConfig(modelConfig.external_data_tools)
|
|
|
+
|
|
|
+ const config = {
|
|
|
+ modelConfig: {
|
|
|
+ provider: model.provider,
|
|
|
+ model_id: model.name,
|
|
|
+ mode: model.mode,
|
|
|
+ configs: {
|
|
|
+ prompt_template: modelConfig.pre_prompt,
|
|
|
+ prompt_variables: userInputsFormToPromptVariables(
|
|
|
+ [
|
|
|
+ ...modelConfig.user_input_form,
|
|
|
+ ...(
|
|
|
+ modelConfig.external_data_tools?.length
|
|
|
+ ? modelConfig.external_data_tools.map((item: any) => {
|
|
|
+ return {
|
|
|
+ external_data_tool: {
|
|
|
+ variable: item.variable as string,
|
|
|
+ label: item.label as string,
|
|
|
+ enabled: item.enabled,
|
|
|
+ type: item.type as string,
|
|
|
+ config: item.config,
|
|
|
+ required: true,
|
|
|
+ icon: item.icon,
|
|
|
+ icon_background: item.icon_background,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ })
|
|
|
+ : []
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ modelConfig.dataset_query_variable,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ opening_statement: modelConfig.opening_statement,
|
|
|
+ more_like_this: modelConfig.more_like_this,
|
|
|
+ suggested_questions_after_answer: modelConfig.suggested_questions_after_answer,
|
|
|
+ speech_to_text: modelConfig.speech_to_text,
|
|
|
+ retriever_resource: modelConfig.retriever_resource,
|
|
|
+ sensitive_word_avoidance: modelConfig.sensitive_word_avoidance,
|
|
|
+ external_data_tools: modelConfig.external_data_tools,
|
|
|
+ dataSets: datasets || [],
|
|
|
+ // eslint-disable-next-line multiline-ternary
|
|
|
+ agentConfig: res.is_agent ? {
|
|
|
+ max_iteration: DEFAULT_AGENT_SETTING.max_iteration,
|
|
|
+ ...modelConfig.agent_mode,
|
|
|
+ // remove dataset
|
|
|
+ enabled: true, // modelConfig.agent_mode?.enabled is not correct. old app: the value of app with dataset's is always true
|
|
|
+ tools: modelConfig.agent_mode?.tools.filter((tool: any) => {
|
|
|
+ return !tool.dataset
|
|
|
+ }).map((tool: any) => {
|
|
|
+ return {
|
|
|
+ ...tool,
|
|
|
+ isDeleted: res.deleted_tools?.includes(tool.tool_name),
|
|
|
+ notAuthor: collectionList.find(c => tool.provider_id === c.id)?.is_team_authorization === false,
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ } : DEFAULT_AGENT_SETTING,
|
|
|
},
|
|
|
- opening_statement: modelConfig.opening_statement,
|
|
|
- more_like_this: modelConfig.more_like_this,
|
|
|
- suggested_questions_after_answer: modelConfig.suggested_questions_after_answer,
|
|
|
- speech_to_text: modelConfig.speech_to_text,
|
|
|
- retriever_resource: modelConfig.retriever_resource,
|
|
|
- sensitive_word_avoidance: modelConfig.sensitive_word_avoidance,
|
|
|
- external_data_tools: modelConfig.external_data_tools,
|
|
|
- dataSets: datasets || [],
|
|
|
- },
|
|
|
- completionParams: model.completion_params,
|
|
|
- }
|
|
|
+ completionParams: model.completion_params,
|
|
|
+ }
|
|
|
|
|
|
- if (modelConfig.file_upload)
|
|
|
- setVisionConfig(modelConfig.file_upload.image, true)
|
|
|
+ if (modelConfig.file_upload)
|
|
|
+ setVisionConfig(modelConfig.file_upload.image, true)
|
|
|
|
|
|
- syncToPublishedConfig(config)
|
|
|
- setPublishedConfig(config)
|
|
|
- setDatasetConfigs({
|
|
|
- retrieval_model: RETRIEVE_TYPE.oneWay,
|
|
|
- ...modelConfig.dataset_configs,
|
|
|
+ syncToPublishedConfig(config)
|
|
|
+ setPublishedConfig(config)
|
|
|
+ setDatasetConfigs({
|
|
|
+ retrieval_model: RETRIEVE_TYPE.oneWay,
|
|
|
+ ...modelConfig.dataset_configs,
|
|
|
+ })
|
|
|
+ setHasFetchedDetail(true)
|
|
|
})
|
|
|
- setHasFetchedDetail(true)
|
|
|
- })
|
|
|
+ })()
|
|
|
}, [appId])
|
|
|
|
|
|
const promptEmpty = (() => {
|
|
@@ -420,7 +488,7 @@ const Configuration: FC = () => {
|
|
|
|
|
|
if (isAdvancedMode) {
|
|
|
if (modelModeType === ModelModeType.chat)
|
|
|
- return chatPromptConfig.prompt.every(({ text }) => !text)
|
|
|
+ return chatPromptConfig.prompt.every(({ text }: any) => !text)
|
|
|
|
|
|
else
|
|
|
return !completionPromptConfig.prompt.text
|
|
@@ -487,15 +555,15 @@ const Configuration: FC = () => {
|
|
|
user_input_form: promptVariablesToUserInputsForm(promptVariables),
|
|
|
dataset_query_variable: contextVar || '',
|
|
|
opening_statement: introduction || '',
|
|
|
+ suggested_questions: suggestedQuestions || [],
|
|
|
more_like_this: moreLikeThisConfig,
|
|
|
suggested_questions_after_answer: suggestedQuestionsAfterAnswerConfig,
|
|
|
speech_to_text: speechToTextConfig,
|
|
|
retriever_resource: citationConfig,
|
|
|
sensitive_word_avoidance: moderationConfig,
|
|
|
- external_data_tools: externalDataToolsConfig,
|
|
|
agent_mode: {
|
|
|
- enabled: true,
|
|
|
- tools: [...postDatasets],
|
|
|
+ ...modelConfig.agentConfig,
|
|
|
+ strategy: isFunctionCall ? AgentStrategy.functionCall : AgentStrategy.react,
|
|
|
},
|
|
|
model: {
|
|
|
provider: modelConfig.provider,
|
|
@@ -503,7 +571,12 @@ const Configuration: FC = () => {
|
|
|
mode: modelConfig.mode,
|
|
|
completion_params: completionParams as any,
|
|
|
},
|
|
|
- dataset_configs: datasetConfigs,
|
|
|
+ dataset_configs: {
|
|
|
+ ...datasetConfigs,
|
|
|
+ datasets: {
|
|
|
+ datasets: [...postDatasets],
|
|
|
+ } as any,
|
|
|
+ },
|
|
|
file_upload: {
|
|
|
image: visionConfig,
|
|
|
},
|
|
@@ -558,6 +631,10 @@ const Configuration: FC = () => {
|
|
|
modelModeType,
|
|
|
promptMode,
|
|
|
isAdvancedMode,
|
|
|
+ isAgent,
|
|
|
+ isOpenAI,
|
|
|
+ isFunctionCall,
|
|
|
+ collectionList,
|
|
|
setPromptMode,
|
|
|
canReturnToSimpleMode,
|
|
|
setCanReturnToSimpleMode,
|
|
@@ -572,6 +649,8 @@ const Configuration: FC = () => {
|
|
|
conversationId,
|
|
|
introduction,
|
|
|
setIntroduction,
|
|
|
+ suggestedQuestions,
|
|
|
+ setSuggestedQuestions,
|
|
|
setConversationId,
|
|
|
controlClearChatMessage,
|
|
|
setControlClearChatMessage,
|
|
@@ -614,70 +693,73 @@ const Configuration: FC = () => {
|
|
|
>
|
|
|
<>
|
|
|
<div className="flex flex-col h-full">
|
|
|
- <div className='flex items-center justify-between px-6 shrink-0 py-3 flex-wrap gap-y-2'>
|
|
|
- <div className='flex items-end'>
|
|
|
- <div className={s.promptTitle}></div>
|
|
|
- <div className='flex items-center h-[14px] space-x-1 text-xs'>
|
|
|
- {/* modelModeType missing can not load template */}
|
|
|
- {(!isAdvancedMode && modelModeType) && (
|
|
|
- <div
|
|
|
- onClick={() => setPromptMode(PromptMode.advanced)}
|
|
|
- className={'cursor-pointer text-indigo-600'}
|
|
|
- >
|
|
|
- {t('appDebug.promptMode.simple')}
|
|
|
- </div>
|
|
|
- )}
|
|
|
- {isAdvancedMode && (
|
|
|
- <div className='flex items-center space-x-2'>
|
|
|
- <div className={cn(locale === 'en' && 'italic', `${s.advancedPromptMode} text-indigo-600`)}>{t('appDebug.promptMode.advanced')}</div>
|
|
|
- {canReturnToSimpleMode && (
|
|
|
- <div
|
|
|
- onClick={() => setPromptMode(PromptMode.simple)}
|
|
|
- className='flex items-center h-6 px-2 bg-indigo-600 shadow-xs border border-gray-200 rounded-lg text-white text-xs font-semibold cursor-pointer space-x-1'
|
|
|
- >
|
|
|
- <FlipBackward className='w-3 h-3 text-white' />
|
|
|
- <div className='text-xs font-semibold uppercase'>{t('appDebug.promptMode.switchBack')}</div>
|
|
|
- </div>
|
|
|
+ <div className='flex grow h-[200px]'>
|
|
|
+ <div className="w-full sm:w-1/2 shrink-0 flex flex-col h-full">
|
|
|
+ {/* Header Left */}
|
|
|
+ <div className='flex justify-between items-center px-6 h-14'>
|
|
|
+ <div className='flex items-center'>
|
|
|
+ <div className='leading-6 text-base font-semibold text-gray-900'>{t('appDebug.orchestrate')}</div>
|
|
|
+ <div className='flex items-center h-[14px] space-x-1 text-xs'>
|
|
|
+ {isAdvancedMode && (
|
|
|
+ <div className='ml-1 flex items-center h-5 px-1.5 border border-gray-100 rounded-md text-[11px] font-medium text-gray-500 uppercase'>{t('appDebug.promptMode.advanced')}</div>
|
|
|
)}
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+ {isChatApp && (
|
|
|
+ <AssistantTypePicker
|
|
|
+ value={isAgent ? 'agent' : 'assistant'}
|
|
|
+ disabled={isAdvancedMode && !canReturnToSimpleMode}
|
|
|
+ onChange={(value: string) => {
|
|
|
+ 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)
|
|
|
+ }}
|
|
|
+ />
|
|
|
)}
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className='flex items-center flex-wrap gap-y-2 gap-x-2'>
|
|
|
- {/* Model and Parameters */}
|
|
|
- <ModelParameterModal
|
|
|
- isAdvancedMode={isAdvancedMode}
|
|
|
- mode={mode}
|
|
|
- provider={modelConfig.provider}
|
|
|
- completionParams={completionParams}
|
|
|
- modelId={modelConfig.model_id}
|
|
|
- setModel={setModel as any}
|
|
|
- onCompletionParamsChange={(newParams: FormValue) => {
|
|
|
- setCompletionParams(newParams)
|
|
|
- }}
|
|
|
- />
|
|
|
- <div className='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'>{t('appDebug.operation.resetConfig')}</Button>
|
|
|
- {isMobile && (
|
|
|
- <Button className='!h-8 !text-[13px] font-medium' onClick={showDebugPanel}>
|
|
|
- <span className='mr-1'>{t('appDebug.operation.debugConfig')}</span>
|
|
|
- <CodeBracketIcon className="h-4 w-4 text-gray-500" />
|
|
|
- </Button>
|
|
|
- )}
|
|
|
- <Button type='primary' onClick={() => handlePublish(false)} className={cn(cannotPublish && '!bg-primary-200 !cursor-not-allowed', 'shrink-0 w-[70px] !h-8 !text-[13px] font-medium')}>{t('appDebug.operation.applyConfig')}</Button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div className='flex grow h-[200px]'>
|
|
|
- <div className="w-full sm:w-1/2 shrink-0">
|
|
|
<Config />
|
|
|
</div>
|
|
|
- {!isMobile && <div className="relative w-1/2 grow h-full overflow-y-auto py-4 px-6 bg-gray-50 flex flex-col rounded-tl-2xl border-t border-l" style={{ borderColor: 'rgba(0, 0, 0, 0.02)' }}>
|
|
|
- <Debug
|
|
|
- hasSetAPIKEY={hasSettedApiKey}
|
|
|
- onSetting={() => setShowAccountSettingModal({ payload: 'provider' })}
|
|
|
- inputs={inputs}
|
|
|
- />
|
|
|
+ {!isMobile && <div className="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 */}
|
|
|
+ <ModelParameterModal
|
|
|
+ isAdvancedMode={isAdvancedMode}
|
|
|
+ mode={mode}
|
|
|
+ provider={modelConfig.provider}
|
|
|
+ completionParams={completionParams}
|
|
|
+ modelId={modelConfig.model_id}
|
|
|
+ setModel={setModel as any}
|
|
|
+ onCompletionParamsChange={(newParams: FormValue) => {
|
|
|
+ setCompletionParams(newParams)
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <div className='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'>{t('appDebug.operation.resetConfig')}</Button>
|
|
|
+ {isMobile && (
|
|
|
+ <Button className='!h-8 !text-[13px] font-medium' onClick={showDebugPanel}>
|
|
|
+ <span className='mr-1'>{t('appDebug.operation.debugConfig')}</span>
|
|
|
+ <CodeBracketIcon className="h-4 w-4 text-gray-500" />
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ <Button type='primary' onClick={() => handlePublish(false)} className={cn(cannotPublish && '!bg-primary-200 !cursor-not-allowed', 'shrink-0 w-[70px] !h-8 !text-[13px] font-medium')}>{t('appDebug.operation.applyConfig')}</Button>
|
|
|
+ </div>
|
|
|
+ <div className='flex flex-col grow h-0 px-6 py-4 rounded-tl-2xl border-t border-l bg-gray-50 '>
|
|
|
+ <Debug
|
|
|
+ hasSetAPIKEY={hasSettedApiKey}
|
|
|
+ onSetting={() => setShowAccountSettingModal({ payload: 'provider' })}
|
|
|
+ inputs={inputs}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>}
|
|
|
</div>
|
|
|
</div>
|