From c39be7852ff98391ed91e8834c598a17dd7a93eb Mon Sep 17 00:00:00 2001 From: JzoNg Date: Fri, 1 Nov 2024 11:59:40 +0800 Subject: [PATCH] Revert "parameters and rules" This reverts commit 22696fa75be09f8b13d4fb01ece2e92cf46e0fd9. --- .../params-config/config-content.tsx | 11 ++-- .../model-parameter-trigger.tsx | 4 +- .../app/configuration/debug/types.ts | 1 - .../components/app/configuration/index.tsx | 14 ++--- .../model-parameter-modal/index.tsx | 17 ++---- .../model-selector/index.tsx | 4 +- .../model-selector/popup-item.tsx | 8 +-- .../model-selector/popup.tsx | 2 +- .../components/workflow/nodes/llm/panel.tsx | 1 - .../workflow/nodes/llm/use-config.ts | 3 +- .../nodes/parameter-extractor/panel.tsx | 1 - .../nodes/question-classifier/panel.tsx | 1 - .../nodes/question-classifier/types.ts | 2 +- web/app/components/workflow/types.ts | 51 +++++++++--------- web/models/debug.ts | 52 +++++++++---------- web/service/debug.ts | 8 +-- 16 files changed, 75 insertions(+), 105 deletions(-) diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx index aa911d45e8..6b1983f5e2 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx @@ -25,7 +25,7 @@ import { useSelectedDatasetsMode } from '@/app/components/workflow/nodes/knowled import Switch from '@/app/components/base/switch' import Toast from '@/app/components/base/toast' -type Props = { +interface Props { datasetConfigs: DatasetConfigs onChange: (configs: DatasetConfigs, isRetrievalModeChange?: boolean) => void isInWorkflow?: boolean @@ -71,7 +71,6 @@ const ConfigContent: FC = ({ ? { ...rerankDefaultModel, provider: rerankDefaultModel.provider.provider, - plugin_id: rerankDefaultModel.provider.plugin_id, } : undefined, ) @@ -81,14 +80,12 @@ const ConfigContent: FC = ({ return { provider_name: datasetConfigs.reranking_model.reranking_provider_name, model_name: datasetConfigs.reranking_model.reranking_model_name, - plugin_id: datasetConfigs.reranking_model.reranking_plugin_id, } } else if (rerankDefaultModel) { return { provider_name: rerankDefaultModel.provider.provider, model_name: rerankDefaultModel.model, - plugin_id: rerankDefaultModel.provider.plugin_id, } } })() @@ -175,7 +172,7 @@ const ConfigContent: FC = ({ return false return datasetConfigs.reranking_enable - }, [canManuallyToggleRerank, datasetConfigs.reranking_enable, isRerankDefaultModelValid]) + }, [canManuallyToggleRerank, datasetConfigs.reranking_enable]) const handleDisabledSwitchClick = useCallback(() => { if (!currentRerankModel && !showRerankModel) @@ -303,14 +300,13 @@ const ConfigContent: FC = ({
{ onChange({ ...datasetConfigs, reranking_model: { reranking_provider_name: v.provider, reranking_model_name: v.model, - reranking_plugin_id: v.plugin_id, }, }) }} @@ -388,7 +384,6 @@ const ConfigContent: FC = ({ portalToFollowElemContentClassName='!z-[1002]' isAdvancedMode={true} mode={model?.mode} - pluginId={model?.plugin_id} provider={model?.provider} completionParams={model?.completion_params} modelId={model?.name} diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx index 380d7363f6..155ebe21ca 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx @@ -36,13 +36,12 @@ const ModelParameterTrigger: FC = ({ const language = useLanguage() const index = multipleModelConfigs.findIndex(v => v.id === modelAndParameter.id) - const handleSelectModel = ({ modelId, provider, pluginId }: { modelId: string; provider: string; pluginId: string }) => { + const handleSelectModel = ({ modelId, provider }: { modelId: string; provider: string }) => { const newModelConfigs = [...multipleModelConfigs] newModelConfigs[index] = { ...newModelConfigs[index], model: modelId, provider, - plugin_id: pluginId, } onMultipleModelConfigsChange(true, newModelConfigs) } @@ -59,7 +58,6 @@ const ModelParameterTrigger: FC = ({ } diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index c74881d7f8..af50fc65c3 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -72,7 +72,7 @@ import { SupportUploadFileTypes } from '@/app/components/workflow/types' import NewFeaturePanel from '@/app/components/base/features/new-feature-panel' import { fetchFileUploadConfig } from '@/service/common' -type PublishConfig = { +interface PublishConfig { modelConfig: ModelConfig completionParams: FormValue } @@ -156,7 +156,6 @@ const Configuration: FC = () => { const setCompletionParams = (value: FormValue) => { const params = { ...value } - // eslint-disable-next-line ts/no-use-before-define if ((!params.stop || params.stop.length === 0) && (modeModeTypeRef.current === ModelModeType.completion)) { params.stop = getTempStop() setTempStop([]) @@ -165,7 +164,6 @@ const Configuration: FC = () => { } const [modelConfig, doSetModelConfig] = useState({ - plugin_id: 'langgenius', provider: 'openai', model_id: 'gpt-3.5-turbo', mode: ModelModeType.unset, @@ -200,7 +198,6 @@ const Configuration: FC = () => { reranking_model: { reranking_provider_name: '', reranking_model_name: '', - reranking_plugin_id: '', }, top_k: DATASET_DEFAULT.top_k, score_threshold_enabled: false, @@ -282,7 +279,6 @@ const Configuration: FC = () => { reranking_model: restConfigs.reranking_model && { reranking_provider_name: restConfigs.reranking_model.reranking_provider_name, reranking_model_name: restConfigs.reranking_model.reranking_model_name, - reranking_plugin_id: restConfigs.reranking_model.reranking_plugin_id, }, retrieval_model, score_threshold_enabled, @@ -324,7 +320,6 @@ const Configuration: FC = () => { textGenerationModelList, } = useTextGenerationCurrentProviderAndModelAndModelList( { - plugin_id: modelConfig.plugin_id, provider: modelConfig.provider, model: modelConfig.model_id, }, @@ -355,7 +350,6 @@ const Configuration: FC = () => { const [canReturnToSimpleMode, setCanReturnToSimpleMode] = useState(true) const setPromptMode = async (mode: PromptMode) => { if (mode === PromptMode.advanced) { - // eslint-disable-next-line ts/no-use-before-define await migrateToDefaultPrompt() setCanReturnToSimpleMode(true) } @@ -551,7 +545,6 @@ const Configuration: FC = () => { const config = { modelConfig: { - plugin_id: model.plugin_id, provider: model.provider, model_id: model.name, mode: model.mode, @@ -770,8 +763,8 @@ const Configuration: FC = () => { handleMultipleModelConfigsChange( true, [ - { id: `${Date.now()}`, model: modelConfig.model_id, plugin_id: modelConfig.plugin_id, provider: modelConfig.provider, parameters: completionParams }, - { id: `${Date.now()}-no-repeat`, model: '', plugin_id: '', provider: '', parameters: {} }, + { id: `${Date.now()}`, model: modelConfig.model_id, provider: modelConfig.provider, parameters: completionParams }, + { id: `${Date.now()}-no-repeat`, model: '', provider: '', parameters: {} }, ], ) setAppSiderbarExpand('collapse') @@ -893,7 +886,6 @@ const Configuration: FC = () => { void + setModel: (model: { modelId: string; provider: string; mode?: string; features?: string[] }) => void completionParams: FormValue onCompletionParamsChange: (newParams: FormValue) => void hideDebugWithMultipleModel?: boolean @@ -75,7 +74,6 @@ const ModelParameterModal: FC = ({ portalToFollowElemContentClassName, isAdvancedMode, modelId, - pluginId, provider, setModel, completionParams, @@ -90,17 +88,13 @@ const ModelParameterModal: FC = ({ const { t } = useTranslation() const { isAPIKeySet } = useProviderContext() const [open, setOpen] = useState(false) - const { data: parameterRulesData, isLoading } = useSWR((provider && modelId) ? `/workspaces/current/model-providers/${pluginId}/${provider}/models/parameter-rules?model=${modelId}` : null, fetchModelParameterRules) + const { data: parameterRulesData, isLoading } = useSWR((provider && modelId) ? `/workspaces/current/model-providers/${provider}/models/parameter-rules?model=${modelId}` : null, fetchModelParameterRules) const { currentProvider, currentModel, activeTextGenerationModelList, } = useTextGenerationCurrentProviderAndModelAndModelList( - { - plugin_id: pluginId, - provider, - model: modelId, - }, + { provider, model: modelId }, ) const hasDeprecated = !currentProvider || !currentModel @@ -118,12 +112,11 @@ const ModelParameterModal: FC = ({ }) } - const handleChangeModel = ({ provider, model, plugin_id }: DefaultModel) => { + const handleChangeModel = ({ provider, model }: DefaultModel) => { const targetProvider = activeTextGenerationModelList.find(modelItem => modelItem.provider === provider) const targetModelItem = targetProvider?.models.find(modelItem => modelItem.model === model) setModel({ modelId: model, - pluginId: plugin_id, provider, mode: targetModelItem?.model_properties.mode as string, features: targetModelItem?.features || [], @@ -208,7 +201,7 @@ const ModelParameterModal: FC = ({ {t('common.modelProvider.model').toLocaleUpperCase()}
= ({ defaultModel, ) - const handleSelect = (pluginId: string, provider: string, model: ModelItem) => { + const handleSelect = (provider: string, model: ModelItem) => { setOpen(false) if (onSelect) - onSelect({ plugin_id: pluginId, provider, model: model.model }) + onSelect({ provider, model: model.model }) } const handleToggle = () => { diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx index ce62494220..d62131ac4c 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx @@ -25,7 +25,7 @@ import Tooltip from '@/app/components/base/tooltip' type PopupItemProps = { defaultModel?: DefaultModel model: Model - onSelect: (pluginId: string, provider: string, model: ModelItem) => void + onSelect: (provider: string, model: ModelItem) => void } const PopupItem: FC = ({ defaultModel, @@ -39,11 +39,11 @@ const PopupItem: FC = ({ const updateModelList = useUpdateModelList() const updateModelProviders = useUpdateModelProviders() const currentProvider = modelProviders.find(provider => provider.provider === model.provider)! - const handleSelect = (pluginId: string, provider: string, modelItem: ModelItem) => { + const handleSelect = (provider: string, modelItem: ModelItem) => { if (modelItem.status !== ModelStatusEnum.active) return - onSelect(pluginId, provider, modelItem) + onSelect(provider, modelItem) } const handleOpenModelModal = () => { setShowModelModal({ @@ -80,7 +80,7 @@ const PopupItem: FC = ({ group relative flex items-center px-3 py-1.5 h-8 rounded-lg ${modelItem.status === ModelStatusEnum.active ? 'cursor-pointer hover:bg-gray-50' : 'cursor-not-allowed hover:bg-gray-50/60'} `} - onClick={() => handleSelect(model.plugin_id, model.provider, modelItem)} + onClick={() => handleSelect(model.provider, modelItem)} > void + onSelect: (provider: string, model: ModelItem) => void } const Popup: FC = ({ defaultModel, diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index 038522df46..76607b29b1 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -132,7 +132,6 @@ const Panel: FC> = ({ isInWorkflow isAdvancedMode={true} mode={model?.mode} - pluginId={model?.plugin_id} provider={model?.provider} completionParams={model?.completion_params} modelId={model?.name} diff --git a/web/app/components/workflow/nodes/llm/use-config.ts b/web/app/components/workflow/nodes/llm/use-config.ts index 7715383020..33742b0726 100644 --- a/web/app/components/workflow/nodes/llm/use-config.ts +++ b/web/app/components/workflow/nodes/llm/use-config.ts @@ -123,7 +123,7 @@ const useConfig = (id: string, payload: LLMNodeType) => { }, }) - const handleModelChanged = useCallback((model: { provider: string; modelId: string; pluginId: string; mode?: string }) => { + const handleModelChanged = useCallback((model: { provider: string; modelId: string; mode?: string }) => { const newInputs = produce(inputRef.current, (draft) => { draft.model.provider = model.provider draft.model.name = model.modelId @@ -139,7 +139,6 @@ const useConfig = (id: string, payload: LLMNodeType) => { useEffect(() => { if (currentProvider?.provider && currentModel?.model && !model.provider) { handleModelChanged({ - pluginId: currentProvider?.plugin_id, provider: currentProvider?.provider, modelId: currentModel?.model, mode: currentModel?.model_properties?.mode as string, diff --git a/web/app/components/workflow/nodes/parameter-extractor/panel.tsx b/web/app/components/workflow/nodes/parameter-extractor/panel.tsx index edadc2e4ba..e9d3856c71 100644 --- a/web/app/components/workflow/nodes/parameter-extractor/panel.tsx +++ b/web/app/components/workflow/nodes/parameter-extractor/panel.tsx @@ -77,7 +77,6 @@ const Panel: FC> = ({ isInWorkflow isAdvancedMode={true} mode={model?.mode} - pluginId={model?.plugin_id} provider={model?.provider} completionParams={model?.completion_params} modelId={model?.name} diff --git a/web/app/components/workflow/nodes/question-classifier/panel.tsx b/web/app/components/workflow/nodes/question-classifier/panel.tsx index 4b2866204b..523ec50019 100644 --- a/web/app/components/workflow/nodes/question-classifier/panel.tsx +++ b/web/app/components/workflow/nodes/question-classifier/panel.tsx @@ -65,7 +65,6 @@ const Panel: FC> = ({ isInWorkflow isAdvancedMode={true} mode={model?.mode} - pluginId={model?.plugin_id} provider={model?.provider} completionParams={model.completion_params} modelId={model.name} diff --git a/web/app/components/workflow/nodes/question-classifier/types.ts b/web/app/components/workflow/nodes/question-classifier/types.ts index ddc16b4501..ca102b083e 100644 --- a/web/app/components/workflow/nodes/question-classifier/types.ts +++ b/web/app/components/workflow/nodes/question-classifier/types.ts @@ -1,6 +1,6 @@ import type { CommonNodeType, Memory, ModelConfig, ValueSelector, VisionSetting } from '@/app/components/workflow/types' -export type Topic = { +export interface Topic { id: string name: string } diff --git a/web/app/components/workflow/types.ts b/web/app/components/workflow/types.ts index ef26d9465f..811ec0d70c 100644 --- a/web/app/components/workflow/types.ts +++ b/web/app/components/workflow/types.ts @@ -37,7 +37,7 @@ export enum ControlMode { Hand = 'hand', } -export type Branch = { +export interface Branch { id: string name: string } @@ -68,7 +68,7 @@ export type CommonNodeType = { height?: number } & T & Partial> -export type CommonEdgeType = { +export interface CommonEdgeType { _hovering?: boolean _connectedNodeIsHovering?: boolean _connectedNodeIsSelected?: boolean @@ -82,14 +82,14 @@ export type CommonEdgeType = { export type Node = ReactFlowNode> export type SelectedNode = Pick -export type NodeProps = { id: string; data: CommonNodeType } -export type NodePanelProps = { +export interface NodeProps { id: string; data: CommonNodeType } +export interface NodePanelProps { id: string data: CommonNodeType } export type Edge = ReactFlowEdge -export type WorkflowDataUpdater = { +export interface WorkflowDataUpdater { nodes: Node[] edges: Edge[] viewport: Viewport @@ -97,7 +97,7 @@ export type WorkflowDataUpdater = { export type ValueSelector = string[] // [nodeId, key | obj key path] -export type Variable = { +export interface Variable { variable: string label?: string | { nodeType: BlockEnum @@ -112,14 +112,14 @@ export type Variable = { isParagraph?: boolean } -export type EnvironmentVariable = { +export interface EnvironmentVariable { id: string name: string value: any value_type: 'string' | 'number' | 'secret' } -export type ConversationVariable = { +export interface ConversationVariable { id: string name: string value_type: ChatVarType @@ -127,13 +127,13 @@ export type ConversationVariable = { description: string } -export type GlobalVariable = { +export interface GlobalVariable { name: string value_type: 'string' | 'number' description: string } -export type VariableWithValue = { +export interface VariableWithValue { key: string value: string } @@ -169,8 +169,7 @@ export type InputVar = { value_selector?: ValueSelector } & Partial -export type ModelConfig = { - plugin_id: string +export interface ModelConfig { provider: string name: string mode: string @@ -188,7 +187,7 @@ export enum EditionType { jinja2 = 'jinja2', } -export type PromptItem = { +export interface PromptItem { id?: string role?: PromptRole text: string @@ -201,12 +200,12 @@ export enum MemoryRole { assistant = 'assistant', } -export type RolePrefix = { +export interface RolePrefix { user: string assistant: string } -export type Memory = { +export interface Memory { role_prefix?: RolePrefix window: { enabled: boolean @@ -230,7 +229,7 @@ export enum VarType { any = 'any', } -export type Var = { +export interface Var { variable: string type: VarType children?: Var[] // if type is obj, has the children struct @@ -241,21 +240,21 @@ export type Var = { des?: string } -export type NodeOutPutVar = { +export interface NodeOutPutVar { nodeId: string title: string vars: Var[] isStartNode?: boolean } -export type Block = { +export interface Block { classification?: string type: BlockEnum title: string description?: string } -export type NodeDefault = { +export interface NodeDefault { defaultValue: Partial getAvailablePrevNodes: (isChatMode: boolean) => BlockEnum[] getAvailableNextNodes: (isChatMode: boolean) => BlockEnum[] @@ -295,19 +294,19 @@ export type OnNodeAdd = ( } ) => void -export type CheckValidRes = { +export interface CheckValidRes { isValid: boolean errorMessage?: string } -export type RunFile = { +export interface RunFile { type: string transfer_method: TransferMethod[] url?: string upload_file_id?: string } -export type WorkflowRunningData = { +export interface WorkflowRunningData { task_id?: string message_id?: string conversation_id?: string @@ -332,7 +331,7 @@ export type WorkflowRunningData = { tracing?: NodeTracing[] } -export type HistoryWorkflowData = { +export interface HistoryWorkflowData { id: string sequence_number: number status: string @@ -344,7 +343,7 @@ export enum ChangeType { remove = 'remove', } -export type MoreInfo = { +export interface MoreInfo { type: ChangeType payload?: { beforeKey: string @@ -364,7 +363,7 @@ export enum SupportUploadFileTypes { custom = 'custom', } -export type UploadFileSetting = { +export interface UploadFileSetting { allowed_file_upload_methods: TransferMethod[] allowed_file_types: SupportUploadFileTypes[] allowed_file_extensions?: string[] @@ -372,7 +371,7 @@ export type UploadFileSetting = { number_limits?: number } -export type VisionSetting = { +export interface VisionSetting { variable_selector: ValueSelector detail: Resolution } diff --git a/web/models/debug.ts b/web/models/debug.ts index 64a6cb7f84..301248b234 100644 --- a/web/models/debug.ts +++ b/web/models/debug.ts @@ -10,25 +10,25 @@ export enum PromptMode { advanced = 'advanced', } -export type PromptItem = { +export interface PromptItem { role?: PromptRole text: string } -export type ChatPromptConfig = { +export interface ChatPromptConfig { prompt: PromptItem[] } -export type ConversationHistoriesRole = { +export interface ConversationHistoriesRole { user_prefix: string assistant_prefix: string } -export type CompletionPromptConfig = { +export interface CompletionPromptConfig { prompt: PromptItem conversation_histories_role: ConversationHistoriesRole } -export type BlockStatus = { +export interface BlockStatus { context: boolean history: boolean query: boolean @@ -40,7 +40,7 @@ export enum PromptRole { assistant = 'assistant', } -export type PromptVariable = { +export interface PromptVariable { key: string name: string type: string // "string" | "number" | "select", @@ -55,7 +55,7 @@ export type PromptVariable = { icon_background?: string } -export type CompletionParams = { +export interface CompletionParams { max_tokens: number temperature: number top_p: number @@ -66,12 +66,12 @@ export type CompletionParams = { export type ModelId = 'gpt-3.5-turbo' | 'text-davinci-003' -export type PromptConfig = { +export interface PromptConfig { prompt_template: string prompt_variables: PromptVariable[] } -export type MoreLikeThisConfig = { +export interface MoreLikeThisConfig { enabled: boolean } @@ -79,7 +79,7 @@ export type SuggestedQuestionsAfterAnswerConfig = MoreLikeThisConfig export type SpeechToTextConfig = MoreLikeThisConfig -export type TextToSpeechConfig = { +export interface TextToSpeechConfig { enabled: boolean voice?: string language?: string @@ -88,7 +88,7 @@ export type TextToSpeechConfig = { export type CitationConfig = MoreLikeThisConfig -export type AnnotationReplyConfig = { +export interface AnnotationReplyConfig { id: string enabled: boolean score_threshold: number @@ -98,7 +98,7 @@ export type AnnotationReplyConfig = { } } -export type ModerationContentConfig = { +export interface ModerationContentConfig { enabled: boolean preset_response?: string } @@ -113,15 +113,14 @@ export type ModerationConfig = MoreLikeThisConfig & { } export type RetrieverResourceConfig = MoreLikeThisConfig -export type AgentConfig = { +export interface AgentConfig { enabled: boolean strategy: AgentStrategy max_iteration: number tools: ToolItem[] } // frontend use. Not the same as backend -export type ModelConfig = { - plugin_id: string +export interface ModelConfig { provider: string // LLM Provider: for example "OPENAI" model_id: string mode: ModelModeType @@ -139,17 +138,16 @@ export type ModelConfig = { dataSets: any[] agentConfig: AgentConfig } -export type DatasetConfigItem = { +export interface DatasetConfigItem { enable: boolean value: number } -export type DatasetConfigs = { +export interface DatasetConfigs { retrieval_model: RETRIEVE_TYPE reranking_model: { reranking_provider_name: string reranking_model_name: string - reranking_plugin_id: string } top_k: number score_threshold_enabled: boolean @@ -174,39 +172,39 @@ export type DatasetConfigs = { reranking_enable?: boolean } -export type DebugRequestBody = { +export interface DebugRequestBody { inputs: Inputs query: string completion_params: CompletionParams model_config: ModelConfig } -export type DebugResponse = { +export interface DebugResponse { id: string answer: string created_at: string } -export type DebugResponseStream = { +export interface DebugResponseStream { id: string data: string created_at: string } -export type FeedBackRequestBody = { +export interface FeedBackRequestBody { message_id: string rating: 'like' | 'dislike' content?: string from_source: 'api' | 'log' } -export type FeedBackResponse = { +export interface FeedBackResponse { message_id: string rating: 'like' | 'dislike' } // Log session list -export type LogSessionListQuery = { +export interface LogSessionListQuery { keyword?: string start?: string // format datetime(YYYY-mm-dd HH:ii) end?: string // format datetime(YYYY-mm-dd HH:ii) @@ -214,7 +212,7 @@ export type LogSessionListQuery = { limit: number // default 20. 1-100 } -export type LogSessionListResponse = { +export interface LogSessionListResponse { data: { id: string conversation_id: string @@ -228,7 +226,7 @@ export type LogSessionListResponse = { } // log session detail and debug -export type LogSessionDetailResponse = { +export interface LogSessionDetailResponse { id: string conversation_id: string model_provider: string @@ -242,7 +240,7 @@ export type LogSessionDetailResponse = { from_source: 'api' | 'log' } -export type SavedMessage = { +export interface SavedMessage { id: string answer: string } diff --git a/web/service/debug.ts b/web/service/debug.ts index 887fde02c6..093cddfd62 100644 --- a/web/service/debug.ts +++ b/web/service/debug.ts @@ -3,13 +3,13 @@ import type { IOnCompleted, IOnData, IOnError, IOnFile, IOnMessageEnd, IOnMessag import type { ChatPromptConfig, CompletionPromptConfig } from '@/models/debug' import type { ModelModeType } from '@/types/app' import type { ModelParameterRule } from '@/app/components/header/account-setting/model-provider-page/declarations' -export type AutomaticRes = { +export interface AutomaticRes { prompt: string variables: string[] opening_statement: string error?: string } -export type CodeGenRes = { +export interface CodeGenRes { code: string language: string[] error?: string @@ -82,8 +82,8 @@ export const generateRuleCode = (body: Record) => { }) } -export const fetchModelParams = (pluginID: string, providerName: string, modelId: string) => { - return get(`workspaces/current/model-providers/${pluginID}/${providerName}/models/parameter-rules`, { +export const fetchModelParams = (providerName: string, modelId: string) => { + return get(`workspaces/current/model-providers/${providerName}/models/parameter-rules`, { params: { model: modelId, },