Skip to content

Commit

Permalink
refactor: model config -> model selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Sep 9, 2024
1 parent b3d619b commit 01f2e98
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
16 changes: 8 additions & 8 deletions internal/types/entities/plugin_entities/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions internal/types/entities/plugin_entities/constant.go
Original file line number Diff line number Diff line change
@@ -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"
)
20 changes: 10 additions & 10 deletions internal/types/entities/plugin_entities/tool_declaration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down

0 comments on commit 01f2e98

Please sign in to comment.