From 01f2e9836d933ef28d9773b1e16289839f556e8a Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Mon, 9 Sep 2024 12:41:28 +0800 Subject: [PATCH] refactor: model config -> model selector --- .../types/entities/plugin_entities/config.go | 16 +++++++-------- .../entities/plugin_entities/constant.go | 20 +++++++++---------- .../plugin_entities/tool_declaration.go | 20 +++++++++---------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/internal/types/entities/plugin_entities/config.go b/internal/types/entities/plugin_entities/config.go index 5c9fd70..4bd5e78 100644 --- a/internal/types/entities/plugin_entities/config.go +++ b/internal/types/entities/plugin_entities/config.go @@ -10,13 +10,13 @@ import ( type ConfigType string const ( - CONFIG_TYPE_SECRET_INPUT ConfigType = SECRET_INPUT - CONFIG_TYPE_TEXT_INPUT ConfigType = TEXT_INPUT - CONFIG_TYPE_SELECT ConfigType = SELECT - CONFIG_TYPE_BOOLEAN ConfigType = BOOLEAN - CONFIG_TYPE_MODEL_CONFIG ConfigType = MODEL_CONFIG - CONFIG_TYPE_APP_SELECTOR ConfigType = APP_SELECTOR - CONFIG_TYPE_TOOL_SELECTOR ConfigType = TOOL_SELECTOR + CONFIG_TYPE_SECRET_INPUT ConfigType = SECRET_INPUT + CONFIG_TYPE_TEXT_INPUT ConfigType = TEXT_INPUT + CONFIG_TYPE_SELECT ConfigType = SELECT + CONFIG_TYPE_BOOLEAN ConfigType = BOOLEAN + CONFIG_TYPE_MODEL_SELECTOR ConfigType = MODEL_SELECTOR + CONFIG_TYPE_APP_SELECTOR ConfigType = APP_SELECTOR + CONFIG_TYPE_TOOL_SELECTOR ConfigType = TOOL_SELECTOR ) type ModelConfigScope string @@ -113,7 +113,7 @@ func isScope(fl validator.FieldLevel) bool { // check config type if provider_config.Type == CONFIG_TYPE_APP_SELECTOR { return isAppSelectorScope(fl) - } else if provider_config.Type == CONFIG_TYPE_MODEL_CONFIG { + } else if provider_config.Type == CONFIG_TYPE_MODEL_SELECTOR { return isModelConfigScope(fl) } else if provider_config.Type == CONFIG_TYPE_TOOL_SELECTOR { return isToolSelectorScope(fl) diff --git a/internal/types/entities/plugin_entities/constant.go b/internal/types/entities/plugin_entities/constant.go index e07cc6a..dd5f7c5 100644 --- a/internal/types/entities/plugin_entities/constant.go +++ b/internal/types/entities/plugin_entities/constant.go @@ -1,14 +1,14 @@ package plugin_entities const ( - SECRET_INPUT = "secret-input" - TEXT_INPUT = "text-input" - SELECT = "select" - STRING = "string" - NUMBER = "number" - FILE = "file" - BOOLEAN = "boolean" - APP_SELECTOR = "app-selector" - MODEL_CONFIG = "model-config" - TOOL_SELECTOR = "tool-selector" + SECRET_INPUT = "secret-input" + TEXT_INPUT = "text-input" + SELECT = "select" + STRING = "string" + NUMBER = "number" + FILE = "file" + BOOLEAN = "boolean" + APP_SELECTOR = "app-selector" + MODEL_SELECTOR = "model-selector" + TOOL_SELECTOR = "tool-selector" ) diff --git a/internal/types/entities/plugin_entities/tool_declaration.go b/internal/types/entities/plugin_entities/tool_declaration.go index 4a38b07..73eb8d2 100644 --- a/internal/types/entities/plugin_entities/tool_declaration.go +++ b/internal/types/entities/plugin_entities/tool_declaration.go @@ -26,15 +26,15 @@ type ToolParameterOption struct { type ToolParameterType string const ( - TOOL_PARAMETER_TYPE_STRING ToolParameterType = STRING - TOOL_PARAMETER_TYPE_NUMBER ToolParameterType = NUMBER - TOOL_PARAMETER_TYPE_BOOLEAN ToolParameterType = BOOLEAN - TOOL_PARAMETER_TYPE_SELECT ToolParameterType = SELECT - TOOL_PARAMETER_TYPE_SECRET_INPUT ToolParameterType = SECRET_INPUT - TOOL_PARAMETER_TYPE_FILE ToolParameterType = FILE - TOOL_PARAMETER_TYPE_APP_SELECTOR ToolParameterType = APP_SELECTOR - TOOL_PARAMETER_TYPE_MODEL_CONFIG ToolParameterType = MODEL_CONFIG - TOOL_PARAMETER_TYPE_TOOL_SELECTOR ToolParameterType = TOOL_SELECTOR + TOOL_PARAMETER_TYPE_STRING ToolParameterType = STRING + TOOL_PARAMETER_TYPE_NUMBER ToolParameterType = NUMBER + TOOL_PARAMETER_TYPE_BOOLEAN ToolParameterType = BOOLEAN + TOOL_PARAMETER_TYPE_SELECT ToolParameterType = SELECT + TOOL_PARAMETER_TYPE_SECRET_INPUT ToolParameterType = SECRET_INPUT + TOOL_PARAMETER_TYPE_FILE ToolParameterType = FILE + TOOL_PARAMETER_TYPE_APP_SELECTOR ToolParameterType = APP_SELECTOR + TOOL_PARAMETER_TYPE_MODEL_SELECTOR ToolParameterType = MODEL_SELECTOR + TOOL_PARAMETER_TYPE_TOOL_SELECTOR ToolParameterType = TOOL_SELECTOR ) func isToolParameterType(fl validator.FieldLevel) bool { @@ -47,7 +47,7 @@ func isToolParameterType(fl validator.FieldLevel) bool { string(TOOL_PARAMETER_TYPE_SECRET_INPUT), string(TOOL_PARAMETER_TYPE_FILE), string(TOOL_PARAMETER_TYPE_APP_SELECTOR), - string(TOOL_PARAMETER_TYPE_MODEL_CONFIG), + string(TOOL_PARAMETER_TYPE_MODEL_SELECTOR), string(TOOL_PARAMETER_TYPE_TOOL_SELECTOR): return true }