瀏覽代碼

feat: add mock data

Yeuoly 10 月之前
父節點
當前提交
562de30041
共有 2 個文件被更改,包括 92 次插入1 次删除
  1. 91 1
      internal/service/manage_plugin.go
  2. 1 0
      internal/types/models/model.go

+ 91 - 1
internal/service/manage_plugin.go

@@ -67,5 +67,95 @@ func ListTools(tenant_id string, page int, page_size int) *entities.Response {
 }
 
 func ListModels(tenant_id string, page int, page_size int) *entities.Response {
-	return nil
+	providers := make([]plugin_entities.ModelProviderDeclaration, 0)
+	providers = append(providers, plugin_entities.ModelProviderDeclaration{
+		Provider: "openai",
+		Label: plugin_entities.I18nObject{
+			EnUS:   "OpenAI",
+			ZhHans: "OpenAI",
+			JaJp:   "OpenAI",
+			PtBr:   "OpenAI",
+		},
+		Description: &plugin_entities.I18nObject{
+			EnUS:   "OpenAI",
+			ZhHans: "OpenAI",
+			JaJp:   "OpenAI",
+			PtBr:   "OpenAI",
+		},
+		IconSmall: &plugin_entities.I18nObject{
+			EnUS:   "icon_small.svg",
+			ZhHans: "icon_small.svg",
+			JaJp:   "icon_small.svg",
+			PtBr:   "icon_small.svg",
+		},
+		IconLarge: &plugin_entities.I18nObject{
+			EnUS:   "icon_large.svg",
+			ZhHans: "icon_large.svg",
+			JaJp:   "icon_large.svg",
+			PtBr:   "icon_large.svg",
+		},
+		Background: &[]string{"background.svg"}[0],
+		SupportedModelTypes: []plugin_entities.ModelType{
+			plugin_entities.MODEL_TYPE_LLM,
+		},
+		ConfigurateMethods: []plugin_entities.ModelProviderConfigurateMethod{
+			plugin_entities.CONFIGURATE_METHOD_PREDEFINED_MODEL,
+			plugin_entities.CONFIGURATE_METHOD_CUSTOMIZABLE_MODEL,
+		},
+		ProviderCredentialSchema: &plugin_entities.ModelProviderCredentialSchema{
+			CredentialFormSchemas: []plugin_entities.ModelProviderCredentialFormSchema{
+				{
+					Variable: "api_key",
+					Label: plugin_entities.I18nObject{
+						EnUS:   "API Key",
+						ZhHans: "API Key",
+						JaJp:   "API Key",
+						PtBr:   "API Key",
+					},
+					Type:      plugin_entities.FORM_TYPE_SECRET_INPUT,
+					Required:  true,
+					MaxLength: 1024,
+				},
+			},
+		},
+		ModelDeclarations: []plugin_entities.ModelDeclaration{
+			{
+				Model: "gpt-4o",
+				Label: plugin_entities.I18nObject{
+					EnUS:   "GPT-4o",
+					ZhHans: "GPT-4o",
+					JaJp:   "GPT-4o",
+					PtBr:   "GPT-4o",
+				},
+				ModelType: plugin_entities.MODEL_TYPE_LLM,
+				Features: []string{
+					"multi-tool-call",
+				},
+				FetchFrom: plugin_entities.CONFIGURATE_METHOD_PREDEFINED_MODEL,
+				ModelProperties: map[string]any{
+					"mode":         "chat",
+					"context_size": 128000,
+				},
+				ParameterRules: []plugin_entities.ModelParameterRule{
+					{
+						Name: "temperature",
+						Label: &plugin_entities.I18nObject{
+							EnUS:   "Temperature",
+							ZhHans: "温度",
+							JaJp:   "温度",
+							PtBr:   "温度",
+						},
+						Type:      &[]plugin_entities.ModelParameterType{plugin_entities.PARAMETER_TYPE_FLOAT}[0],
+						Required:  true,
+						Min:       &[]float64{0}[0],
+						Max:       &[]float64{1}[0],
+						Default:   &[]any{0.7}[0],
+						Precision: &[]int{2}[0],
+					},
+				},
+			},
+		},
+	})
+
+	return entities.NewSuccessResponse(providers)
 }

+ 1 - 0
internal/types/models/model.go

@@ -0,0 +1 @@
+package models