From 21b2f554df35d9d54f98b8103107106369353111 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Wed, 16 Oct 2024 14:52:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=AF=E9=A3=9E=E6=98=9F?= =?UTF-8?q?=E7=81=AB=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model-providers/bedrock/bedrock.yaml | 2 +- .../model-providers/hunyuan/hunyuan.yaml | 2 +- .../model-providers/spark/llm/spark-1.5.yaml | 34 ---------------- .../model-providers/spark/llm/spark-2.yaml | 34 ---------------- .../model-providers/spark/llm/spark-3.5.yaml | 34 ---------------- .../model-providers/spark/llm/spark-3.yaml | 34 ---------------- .../spark/llm/spark-4.0-ultra.yaml | 2 +- .../model-providers/spark/llm/spark-4.yaml | 34 ---------------- .../model-providers/spark/llm/spark-lite.yaml | 2 +- .../spark/llm/spark-max-32k.yaml | 2 +- .../model-providers/spark/llm/spark-max.yaml | 2 +- .../spark/llm/spark-pro-128k.yaml | 2 +- .../model-providers/spark/llm/spark-pro.yaml | 2 +- .../model-providers/spark/spark.yaml | 27 +++---------- controller/ai-api/iml.go | 40 +++++++++---------- 15 files changed, 34 insertions(+), 219 deletions(-) delete mode 100644 ai-provider/model-runtime/model-providers/spark/llm/spark-1.5.yaml delete mode 100644 ai-provider/model-runtime/model-providers/spark/llm/spark-2.yaml delete mode 100644 ai-provider/model-runtime/model-providers/spark/llm/spark-3.5.yaml delete mode 100644 ai-provider/model-runtime/model-providers/spark/llm/spark-3.yaml delete mode 100644 ai-provider/model-runtime/model-providers/spark/llm/spark-4.yaml diff --git a/ai-provider/model-runtime/model-providers/bedrock/bedrock.yaml b/ai-provider/model-runtime/model-providers/bedrock/bedrock.yaml index 93e3efe9..bda4cc38 100644 --- a/ai-provider/model-runtime/model-providers/bedrock/bedrock.yaml +++ b/ai-provider/model-runtime/model-providers/bedrock/bedrock.yaml @@ -87,4 +87,4 @@ provider_credential_schema: placeholder: en_US: A model you have access to (e.g. amazon.titan-text-lite-v1) for validation. zh_Hans: 为了进行验证,请输入一个您可用的模型名称 (例如:amazon.titan-text-lite-v1) -address: https://api.openai.com \ No newline at end of file +address: https://bedrock-runtime.amazonaws.com \ No newline at end of file diff --git a/ai-provider/model-runtime/model-providers/hunyuan/hunyuan.yaml b/ai-provider/model-runtime/model-providers/hunyuan/hunyuan.yaml index ef3773cc..4b87e243 100644 --- a/ai-provider/model-runtime/model-providers/hunyuan/hunyuan.yaml +++ b/ai-provider/model-runtime/model-providers/hunyuan/hunyuan.yaml @@ -39,4 +39,4 @@ provider_credential_schema: placeholder: zh_Hans: 在此输入您的 Secret Key en_US: Enter your Secret Key -address: https://api.openai.com \ No newline at end of file +address: https://hunyuan.tencentcloudapi.com \ No newline at end of file diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-1.5.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-1.5.yaml deleted file mode 100644 index fcd65c24..00000000 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-1.5.yaml +++ /dev/null @@ -1,34 +0,0 @@ -model: spark-1.5 -deprecated: true -label: - en_US: Spark V1.5 -model_type: llm -model_properties: - mode: chat -parameter_rules: - - name: temperature - use_template: temperature - default: 0.5 - help: - zh_Hans: 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。 - en_US: Kernel sampling threshold. Used to determine the randomness of the results. The higher the value, the stronger the randomness, that is, the higher the possibility of getting different answers to the same question. - - name: max_tokens - use_template: max_tokens - default: 512 - min: 1 - max: 4096 - help: - zh_Hans: 模型回答的tokens的最大长度。 - en_US: 模型回答的tokens的最大长度。 - - name: top_k - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - default: 4 - min: 1 - max: 6 - help: - zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 - en_US: Randomly select one from k candidates (non-equal probability). - required: false diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-2.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-2.yaml deleted file mode 100644 index 2db6805a..00000000 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-2.yaml +++ /dev/null @@ -1,34 +0,0 @@ -model: spark-2 -deprecated: true -label: - en_US: Spark V2.0 -model_type: llm -model_properties: - mode: chat -parameter_rules: - - name: temperature - use_template: temperature - default: 0.5 - help: - zh_Hans: 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。 - en_US: Kernel sampling threshold. Used to determine the randomness of the results. The higher the value, the stronger the randomness, that is, the higher the possibility of getting different answers to the same question. - - name: max_tokens - use_template: max_tokens - default: 2048 - min: 1 - max: 8192 - help: - zh_Hans: 模型回答的tokens的最大长度。 - en_US: 模型回答的tokens的最大长度。 - - name: top_k - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - default: 4 - min: 1 - max: 6 - help: - zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 - en_US: Randomly select one from k candidates (non-equal probability). - required: false diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-3.5.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-3.5.yaml deleted file mode 100644 index 86617a53..00000000 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-3.5.yaml +++ /dev/null @@ -1,34 +0,0 @@ -model: spark-3.5 -deprecated: true -label: - en_US: Spark V3.5 -model_type: llm -model_properties: - mode: chat -parameter_rules: - - name: temperature - use_template: temperature - default: 0.5 - help: - zh_Hans: 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。 - en_US: Kernel sampling threshold. Used to determine the randomness of the results. The higher the value, the stronger the randomness, that is, the higher the possibility of getting different answers to the same question. - - name: max_tokens - use_template: max_tokens - default: 2048 - min: 1 - max: 8192 - help: - zh_Hans: 模型回答的tokens的最大长度。 - en_US: 模型回答的tokens的最大长度。 - - name: top_k - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - default: 4 - min: 1 - max: 6 - help: - zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 - en_US: Randomly select one from k candidates (non-equal probability). - required: false diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-3.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-3.yaml deleted file mode 100644 index 9f296c68..00000000 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-3.yaml +++ /dev/null @@ -1,34 +0,0 @@ -model: spark-3 -deprecated: true -label: - en_US: Spark V3.0 -model_type: llm -model_properties: - mode: chat -parameter_rules: - - name: temperature - use_template: temperature - default: 0.5 - help: - zh_Hans: 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。 - en_US: Kernel sampling threshold. Used to determine the randomness of the results. The higher the value, the stronger the randomness, that is, the higher the possibility of getting different answers to the same question. - - name: max_tokens - use_template: max_tokens - default: 2048 - min: 1 - max: 8192 - help: - zh_Hans: 模型回答的tokens的最大长度。 - en_US: 模型回答的tokens的最大长度。 - - name: top_k - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - default: 4 - min: 1 - max: 6 - help: - zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 - en_US: Randomly select one from k candidates (non-equal probability). - required: false diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-4.0-ultra.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-4.0-ultra.yaml index bbf85764..5924ce24 100644 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-4.0-ultra.yaml +++ b/ai-provider/model-runtime/model-providers/spark/llm/spark-4.0-ultra.yaml @@ -1,4 +1,4 @@ -model: spark-4.0-ultra +model: 4.0Ultra label: en_US: Spark 4.0 Ultra model_type: llm diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-4.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-4.yaml deleted file mode 100644 index 4b5529e8..00000000 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-4.yaml +++ /dev/null @@ -1,34 +0,0 @@ -model: spark-4 -deprecated: true -label: - en_US: Spark V4.0 -model_type: llm -model_properties: - mode: chat -parameter_rules: - - name: temperature - use_template: temperature - default: 0.5 - help: - zh_Hans: 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。 - en_US: Kernel sampling threshold. Used to determine the randomness of the results. The higher the value, the stronger the randomness, that is, the higher the possibility of getting different answers to the same question. - - name: max_tokens - use_template: max_tokens - default: 4096 - min: 1 - max: 8192 - help: - zh_Hans: 模型回答的tokens的最大长度。 - en_US: 模型回答的tokens的最大长度。 - - name: top_k - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - default: 4 - min: 1 - max: 6 - help: - zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 - en_US: Randomly select one from k candidates (non-equal probability). - required: false diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-lite.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-lite.yaml index 1f6141a8..6393cee7 100644 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-lite.yaml +++ b/ai-provider/model-runtime/model-providers/spark/llm/spark-lite.yaml @@ -1,4 +1,4 @@ -model: spark-lite +model: lite label: en_US: Spark Lite model_type: llm diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-max-32k.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-max-32k.yaml index 1a1ab684..255ffd64 100644 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-max-32k.yaml +++ b/ai-provider/model-runtime/model-providers/spark/llm/spark-max-32k.yaml @@ -1,4 +1,4 @@ -model: spark-max-32k +model: max-32k label: en_US: Spark Max-32K model_type: llm diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-max.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-max.yaml index 71eb2b86..1cca7aba 100644 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-max.yaml +++ b/ai-provider/model-runtime/model-providers/spark/llm/spark-max.yaml @@ -1,4 +1,4 @@ -model: spark-max +model: generalv3.5 label: en_US: Spark Max model_type: llm diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-pro-128k.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-pro-128k.yaml index da1fead6..7de0b343 100644 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-pro-128k.yaml +++ b/ai-provider/model-runtime/model-providers/spark/llm/spark-pro-128k.yaml @@ -1,4 +1,4 @@ -model: spark-pro-128k +model: pro-128k label: en_US: Spark Pro-128K model_type: llm diff --git a/ai-provider/model-runtime/model-providers/spark/llm/spark-pro.yaml b/ai-provider/model-runtime/model-providers/spark/llm/spark-pro.yaml index 9ee479f1..f8f42367 100644 --- a/ai-provider/model-runtime/model-providers/spark/llm/spark-pro.yaml +++ b/ai-provider/model-runtime/model-providers/spark/llm/spark-pro.yaml @@ -1,4 +1,4 @@ -model: spark-pro +model: generalv3 label: en_US: Spark Pro model_type: llm diff --git a/ai-provider/model-runtime/model-providers/spark/spark.yaml b/ai-provider/model-runtime/model-providers/spark/spark.yaml index d09db7aa..cbfedef4 100644 --- a/ai-provider/model-runtime/model-providers/spark/spark.yaml +++ b/ai-provider/model-runtime/model-providers/spark/spark.yaml @@ -20,28 +20,13 @@ configurate_methods: - predefined-model provider_credential_schema: credential_form_schemas: - - variable: app_id + - variable: api_password label: - en_US: APPID - type: text-input - required: true - placeholder: - zh_Hans: 在此输入您的 APPID - en_US: Enter your APPID - - variable: api_secret - label: - en_US: APISecret + en_US: APIPassword type: secret-input required: true placeholder: - zh_Hans: 在此输入您的 APISecret - en_US: Enter your APISecret - - variable: api_key - label: - en_US: APIKey - type: secret-input - required: true - placeholder: - zh_Hans: 在此输入您的 APIKey - en_US: Enter your APIKey -address: https://api.openai.com \ No newline at end of file + zh_Hans: 在此输入您的 APIPassword + en_US: Enter your APIPassword + +address: https://spark-api-open.xf-yun.com \ No newline at end of file diff --git a/controller/ai-api/iml.go b/controller/ai-api/iml.go index 8d28adf2..ae2e73ef 100644 --- a/controller/ai-api/iml.go +++ b/controller/ai-api/iml.go @@ -3,6 +3,8 @@ package ai_api import ( "context" "fmt" + "net/http" + "github.com/APIParkLab/APIPark/model/plugin_model" ai_api "github.com/APIParkLab/APIPark/module/ai-api" ai_api_dto "github.com/APIParkLab/APIPark/module/ai-api/dto" @@ -13,8 +15,6 @@ import ( "github.com/eolinker/go-common/store" "github.com/gin-gonic/gin" "github.com/google/uuid" - "net/http" - "strings" ) var _ IAPIController = (*imlAPIController)(nil) @@ -117,24 +117,24 @@ func (i *imlAPIController) Edit(ctx *gin.Context, serviceId string, apiId string }, } } - path := apiInfo.Path - if input.Path != nil { - inputPath := *input.Path - prefix, err := i.module.Prefix(ctx, serviceId) - if err != nil { - return err - } - if !strings.HasSuffix(inputPath, prefix) { - if inputPath[0] != '/' { - inputPath = fmt.Sprintf("/%s", inputPath) - } - path = fmt.Sprintf("%s%s", prefix, inputPath) - } else { - path = inputPath - } - } - proxy.Path = path - input.Path = &path + //path := apiInfo.Path + //if input.Path != nil { + // inputPath := *input.Path + // prefix, err := i.module.Prefix(ctx, serviceId) + // if err != nil { + // return err + // } + // if !strings.HasSuffix(inputPath, prefix) { + // if inputPath[0] != '/' { + // inputPath = fmt.Sprintf("/%s", inputPath) + // } + // path = fmt.Sprintf("%s%s", prefix, inputPath) + // } else { + // path = inputPath + // } + //} + //proxy.Path = path + //input.Path = &path _, err = i.routerModule.Edit(ctx, serviceId, apiId, &router_dto.Edit{ Description: input.Description, Proxy: proxy,