feat: 添加新的嵌入模型和重排序模型配置,更新相关文档提示

This commit is contained in:
Wenjie Zhang 2025-10-23 23:34:16 +08:00
parent 367c79a06e
commit 014e877c14
4 changed files with 154 additions and 140 deletions

View File

@ -142,6 +142,12 @@ DEFAULT_EMBED_MODELS: dict[str, EmbedModelInfo] = {
base_url="https://api.siliconflow.cn/v1/embeddings", base_url="https://api.siliconflow.cn/v1/embeddings",
api_key="SILICONFLOW_API_KEY", api_key="SILICONFLOW_API_KEY",
), ),
"siliconflow/Pro/BAAI/bge-m3": EmbedModelInfo(
name="Pro/BAAI/bge-m3",
dimension=1024,
base_url="https://api.siliconflow.cn/v1/embeddings",
api_key="SILICONFLOW_API_KEY",
),
"siliconflow/Qwen/Qwen3-Embedding-0.6B": EmbedModelInfo( "siliconflow/Qwen/Qwen3-Embedding-0.6B": EmbedModelInfo(
name="Qwen/Qwen3-Embedding-0.6B", name="Qwen/Qwen3-Embedding-0.6B",
dimension=1024, dimension=1024,
@ -179,6 +185,11 @@ DEFAULT_RERANKERS: dict[str, RerankerInfo] = {
base_url="https://api.siliconflow.cn/v1/rerank", base_url="https://api.siliconflow.cn/v1/rerank",
api_key="SILICONFLOW_API_KEY", api_key="SILICONFLOW_API_KEY",
), ),
"siliconflow/Pro/BAAI/bge-reranker-v2-m3": RerankerInfo(
name="Pro/BAAI/bge-reranker-v2-m3",
base_url="https://api.siliconflow.cn/v1/rerank",
api_key="SILICONFLOW_API_KEY",
),
"vllm/BAAI/bge-reranker-v2-m3": RerankerInfo( "vllm/BAAI/bge-reranker-v2-m3": RerankerInfo(
name="BAAI/bge-reranker-v2-m3", name="BAAI/bge-reranker-v2-m3",
base_url="http://localhost:8000/v1/rerank", base_url="http://localhost:8000/v1/rerank",

View File

@ -1,151 +1,150 @@
#################################################### ##################################################################################
# #
# 默认模型配置文件。可以直接修改该文件更新模型。 # 注意:本文件已弃用,现在模型的默认配置在 src/config/static/models.py 中定义
# 如需自定义路径,可通过环境变量 # 修改后的配置信息,保存在 saves/config/base.toml 中
# OVERRIDE_DEFAULT_MODELS_CONFIG_WITH 指向新的 YAML。
# #
##################################################### ###################################################################################
MODEL_NAMES: # MODEL_NAMES:
openai: # openai:
name: OpenAI # name: OpenAI
url: https://platform.openai.com/docs/models # url: https://platform.openai.com/docs/models
base_url: https://api.openai.com/v1 # base_url: https://api.openai.com/v1
default: gpt-4o-mini # default: gpt-4o-mini
env: OPENAI_API_KEY # env: OPENAI_API_KEY
models: # models:
- gpt-4 # - gpt-4
- gpt-4o # - gpt-4o
- gpt-4o-mini # - gpt-4o-mini
deepseek: # deepseek:
name: DeepSeek # name: DeepSeek
url: https://platform.deepseek.com/api-docs/zh-cn/pricing # url: https://platform.deepseek.com/api-docs/zh-cn/pricing
base_url: https://api.deepseek.com/v1 # base_url: https://api.deepseek.com/v1
default: deepseek-chat # default: deepseek-chat
env: DEEPSEEK_API_KEY # env: DEEPSEEK_API_KEY
models: # models:
- deepseek-chat # - deepseek-chat
- deepseek-reasoner # - deepseek-reasoner
zhipu: # zhipu:
name: 智谱AI (Zhipu) # name: 智谱AI (Zhipu)
url: https://open.bigmodel.cn/dev/api # url: https://open.bigmodel.cn/dev/api
base_url: https://open.bigmodel.cn/api/paas/v4/ # base_url: https://open.bigmodel.cn/api/paas/v4/
default: glm-4.5-flash # default: glm-4.5-flash
env: ZHIPUAI_API_KEY # env: ZHIPUAI_API_KEY
models: # models:
- glm-4.6 # - glm-4.6
- glm-4.5-air # - glm-4.5-air
- glm-4.5-flash # - glm-4.5-flash
siliconflow: # siliconflow:
name: SiliconFlow # name: SiliconFlow
url: https://cloud.siliconflow.cn/models # url: https://cloud.siliconflow.cn/models
base_url: https://api.siliconflow.cn/v1 # base_url: https://api.siliconflow.cn/v1
default: Qwen/Qwen3-32B # default: Qwen/Qwen3-32B
env: SILICONFLOW_API_KEY # env: SILICONFLOW_API_KEY
models: # models:
- Qwen/Qwen3-Next-80B-A3B-Thinking # - Qwen/Qwen3-Next-80B-A3B-Thinking
- Qwen/Qwen3-32B # - Qwen/Qwen3-32B
- deepseek-ai/DeepSeek-V3.2-Exp # - deepseek-ai/DeepSeek-V3.2-Exp
- Qwen/Qwen3-235B-A22B-Thinking-2507 # - Qwen/Qwen3-235B-A22B-Thinking-2507
- Qwen/Qwen3-235B-A22B-Instruct-2507 # - Qwen/Qwen3-235B-A22B-Instruct-2507
- moonshotai/Kimi-K2-Instruct-0905 # - moonshotai/Kimi-K2-Instruct-0905
- zai-org/GLM-4.6 # - zai-org/GLM-4.6
together.ai: # together.ai:
name: Together.ai # name: Together.ai
url: https://api.together.ai/models # url: https://api.together.ai/models
base_url: https://api.together.xyz/v1/ # base_url: https://api.together.xyz/v1/
default: meta-llama/Llama-3.3-70B-Instruct-Turbo-Free # default: meta-llama/Llama-3.3-70B-Instruct-Turbo-Free
env: TOGETHER_API_KEY # env: TOGETHER_API_KEY
models: # models:
- meta-llama/Llama-3.3-70B-Instruct-Turbo-Free # - meta-llama/Llama-3.3-70B-Instruct-Turbo-Free
dashscope: # dashscope:
name: 阿里百炼 (DashScope) # name: 阿里百炼 (DashScope)
url: https://bailian.console.aliyun.com/?switchAgent=10226727&productCode=p_efm#/model-market # url: https://bailian.console.aliyun.com/?switchAgent=10226727&productCode=p_efm#/model-market
base_url: https://dashscope.aliyuncs.com/compatible-mode/v1 # base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
default: qwen-max-latest # default: qwen-max-latest
env: DASHSCOPE_API_KEY # env: DASHSCOPE_API_KEY
models: # models:
- qwen-max-latest # - qwen-max-latest
- qwen-plus-latest # - qwen-plus-latest
- qwen-turbo-latest # - qwen-turbo-latest
- qwen3-235b-a22b-thinking-2507 # - qwen3-235b-a22b-thinking-2507
- qwen3-235b-a22b-instruct-2507 # - qwen3-235b-a22b-instruct-2507
ark: # ark:
name: 豆包Ark # name: 豆包Ark
url: https://console.volcengine.com/ark/region:ark+cn-beijing/model # url: https://console.volcengine.com/ark/region:ark+cn-beijing/model
base_url: https://ark.cn-beijing.volces.com/api/v3 # base_url: https://ark.cn-beijing.volces.com/api/v3
default: doubao-seed-1-6-250615 # default: doubao-seed-1-6-250615
env: ARK_API_KEY # env: ARK_API_KEY
models: # models:
- doubao-seed-1-6-250615 # - doubao-seed-1-6-250615
- doubao-seed-1-6-thinking-250715 # - doubao-seed-1-6-thinking-250715
- doubao-seed-1-6-flash-250715 # - doubao-seed-1-6-flash-250715
openrouter: # openrouter:
name: OpenRouter # name: OpenRouter
url: https://openrouter.ai/models # url: https://openrouter.ai/models
base_url: https://openrouter.ai/api/v1 # base_url: https://openrouter.ai/api/v1
default: openai/gpt-4o # default: openai/gpt-4o
env: OPENROUTER_API_KEY # env: OPENROUTER_API_KEY
models: # models:
- openai/gpt-4o # - openai/gpt-4o
- x-ai/grok-4 # - x-ai/grok-4
- google/gemini-2.5-pro # - google/gemini-2.5-pro
- anthropic/claude-sonnet-4 # - anthropic/claude-sonnet-4
EMBED_MODEL_INFO: # EMBED_MODEL_INFO:
siliconflow/Pro/BAAI/bge-m3: # siliconflow/Pro/BAAI/bge-m3:
name: Pro/BAAI/bge-m3 # name: Pro/BAAI/bge-m3
dimension: 1024 # dimension: 1024
base_url: https://api.siliconflow.cn/v1/embeddings # base_url: https://api.siliconflow.cn/v1/embeddings
api_key: SILICONFLOW_API_KEY # api_key: SILICONFLOW_API_KEY
siliconflow/BAAI/bge-m3: # siliconflow/BAAI/bge-m3:
name: BAAI/bge-m3 # name: BAAI/bge-m3
dimension: 1024 # dimension: 1024
base_url: https://api.siliconflow.cn/v1/embeddings # base_url: https://api.siliconflow.cn/v1/embeddings
api_key: SILICONFLOW_API_KEY # api_key: SILICONFLOW_API_KEY
siliconflow/Qwen/Qwen3-Embedding-0.6B: # siliconflow/Qwen/Qwen3-Embedding-0.6B:
name: Qwen/Qwen3-Embedding-0.6B # name: Qwen/Qwen3-Embedding-0.6B
dimension: 1024 # dimension: 1024
base_url: https://api.siliconflow.cn/v1/embeddings # base_url: https://api.siliconflow.cn/v1/embeddings
api_key: SILICONFLOW_API_KEY # api_key: SILICONFLOW_API_KEY
vllm/Qwen/Qwen3-Embedding-0.6B: # vllm/Qwen/Qwen3-Embedding-0.6B:
name: Qwen3-Embedding-0.6B # name: Qwen3-Embedding-0.6B
dimension: 1024 # dimension: 1024
base_url: http://localhost:8000/v1/embeddings # base_url: http://localhost:8000/v1/embeddings
api_key: no_api_key # api_key: no_api_key
ollama/nomic-embed-text: # ollama/nomic-embed-text:
name: nomic-embed-text # name: nomic-embed-text
base_url: http://localhost:11434/api/embed # base_url: http://localhost:11434/api/embed
dimension: 768 # dimension: 768
ollama/bge-m3: # ollama/bge-m3:
name: bge-m3 # name: bge-m3
base_url: http://localhost:11434/api/embed # base_url: http://localhost:11434/api/embed
dimension: 1024 # dimension: 1024
RERANKER_LIST: # RERANKER_LIST:
siliconflow/Pro/BAAI/bge-reranker-v2-m3: # siliconflow/Pro/BAAI/bge-reranker-v2-m3:
name: Pro/BAAI/bge-reranker-v2-m3 # name: Pro/BAAI/bge-reranker-v2-m3
base_url: https://api.siliconflow.cn/v1/rerank # base_url: https://api.siliconflow.cn/v1/rerank
api_key: SILICONFLOW_API_KEY # api_key: SILICONFLOW_API_KEY
siliconflow/BAAI/bge-reranker-v2-m3: # siliconflow/BAAI/bge-reranker-v2-m3:
name: BAAI/bge-reranker-v2-m3 # name: BAAI/bge-reranker-v2-m3
base_url: https://api.siliconflow.cn/v1/rerank # base_url: https://api.siliconflow.cn/v1/rerank
api_key: SILICONFLOW_API_KEY # api_key: SILICONFLOW_API_KEY
vllm/BAAI/bge-reranker-v2-m3: # vllm/BAAI/bge-reranker-v2-m3:
name: BAAI/bge-reranker-v2-m3 # name: BAAI/bge-reranker-v2-m3
base_url: http://localhost:8000/v1/rerank # base_url: http://localhost:8000/v1/rerank
api_key: no_api_key # api_key: no_api_key

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<a-alert message="自定义模型在 0.3.x 的稳定版中移除,只能通过修改 models.yaml 来添加模型和供应商。" type="warning" /> <a-alert message="自定义模型在 0.3.x 的稳定版中移除,只能通过修改 src/config/static/models.py 来添加模型和供应商。" type="warning" />
<br> <br>
<div class="model-provider-card configured-provider" v-for="(item, key) in modelKeys" :key="key"> <div class="model-provider-card configured-provider" v-for="(item, key) in modelKeys" :key="key">
<div class="card-header" @click="toggleExpand(item)"> <div class="card-header" @click="toggleExpand(item)">
@ -118,7 +118,7 @@
<div v-if="providerConfig.allModels.length === 0" class="modal-no-models"> <div v-if="providerConfig.allModels.length === 0" class="modal-no-models">
<a-alert v-if="!modelStatus[providerConfig.provider]" type="warning" message="请在 .env 中配置对应的 APIKEY并重新启动服务" /> <a-alert v-if="!modelStatus[providerConfig.provider]" type="warning" message="请在 .env 中配置对应的 APIKEY并重新启动服务" />
<div v-else> <div v-else>
<a-alert type="warning" message="该提供商暂未适配获取模型列表的方法,如需添加模型,请编辑 src/config/static/models.yaml 或通过环境变量 OVERRIDE_DEFAULT_MODELS_CONFIG_WITH 指向的文件。" /> <a-alert type="warning" message="该提供商暂未适配获取模型列表的方法,如需添加模型,请编辑 src/config/static/models.py 。" />
<img src="@/assets/pics/guides/how-to-add-models.png" alt="添加模型指引" style="width: 100%; height: 100%; margin-top: 16px;"> <img src="@/assets/pics/guides/how-to-add-models.png" alt="添加模型指引" style="width: 100%; height: 100%; margin-top: 16px;">
</div> </div>
</div> </div>

View File

@ -51,7 +51,7 @@
@dropdownVisibleChange="checkAllModelStatus" @dropdownVisibleChange="checkAllModelStatus"
> >
<a-select-option <a-select-option
v-for="(name, idx) in items?.embed_model.choices" :key="idx" v-for="(name, idx) in embedModelChoices" :key="idx"
:value="name" :value="name"
> >
<div style="display: flex; align-items: center; gap: 8px; min-width: 0;"> <div style="display: flex; align-items: center; gap: 8px; min-width: 0;">
@ -82,7 +82,7 @@
@change="handleChange('reranker', $event)" @change="handleChange('reranker', $event)"
> >
<a-select-option <a-select-option
v-for="(name, idx) in items?.reranker.choices" :key="idx" v-for="(name, idx) in rerankerChoices" :key="idx"
:value="name">{{ name }} :value="name">{{ name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -209,9 +209,13 @@ const state = reactive({
checkingStatus: false // checkingStatus: false //
}) })
const handleModelLocalPathsUpdate = (config) => { const embedModelChoices = computed(() => {
handleChange('model_local_paths', config) return Object.keys(configStore?.config?.embed_model_names || {}) || []
} })
const rerankerChoices = computed(() => {
return Object.keys(configStore?.config?.reranker_names || {}) || []
})
const preHandleChange = (key, e) => { const preHandleChange = (key, e) => {