!205 feat: add OrcaRouter as a named LLM protocol

Merge pull request !205 from orcasjh/feature/orcarouter
This commit is contained in:
mfish
2026-08-26 08:19:59 +00:00
committed by Gitee
4 changed files with 21 additions and 5 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
### 多租户大模型管理
- 按租户隔离 AI 模型配置,不同租户可使用不同的 LLM 提供商(OpenAI / Ollama / 智谱等)
- 按租户隔离 AI 模型配置,不同租户可使用不同的 LLM 提供商(OpenAI / Ollama / 智谱 / [OrcaRouter](https://www.orcarouter.ai) 等)
- ChatModel 按配置签名缓存共享,不随租户增长
- 提供 OpenAI 兼容的 `/v1/chat/completions` 统一代理接口,流式/非流式自动切换
+1
View File
@@ -277,6 +277,7 @@ INSERT INTO `sys_dict_item` VALUES ('e100aa3c678f2bf6a4e1e24a9feee89f', 'cd33855
INSERT INTO `sys_dict_item` VALUES ('cac0983d1430c0a7dce98bd8c01cc19c', 'cd338555eccf73e26e9243837d6c711e', 'ai_model_protocol', 'ollama', 'ollama', 0, 2, '', 'blue', 0, NULL, 'admin', '2026-07-10 16:58:34', '', NULL);
INSERT INTO `sys_dict_item` VALUES ('64a2906317754ac19c779e04ddc155de', 'cd338555eccf73e26e9243837d6c711e', 'ai_model_protocol', 'deepseek', 'deepseek', 0, 3, NULL, 'cyan', 0, NULL, 'admin', '2026-07-10 16:58:49', '', NULL);
INSERT INTO `sys_dict_item` VALUES ('76faf36cc4e459171c273fa833e79ff4', 'cd338555eccf73e26e9243837d6c711e', 'ai_model_protocol', 'anthropic', 'anthropic', 0, 4, NULL, 'pink', 0, NULL, 'admin', '2026-07-10 16:59:22', '', NULL);
INSERT INTO `sys_dict_item` VALUES ('9f3c1a7d2e5b4a8c6f0d1e2a3b4c5d6e', 'cd338555eccf73e26e9243837d6c711e', 'ai_model_protocol', 'orcarouter', 'orcarouter', 0, 5, NULL, 'gold', 0, 'OrcaRouter 路由网关', 'admin', '2026-08-15 00:00:00', '', NULL);
-- ----------------------------
-- Table structure for sys_log
@@ -30,14 +30,14 @@ public class AiModelConfig extends BaseEntity<String> {
@ExcelProperty("租户ID")
@Schema(description = "租户ID")
private String tenantId;
@ExcelProperty("提供者: openai/ollama/deepseek/zhipuai/anthropic等")
@Schema(description = "提供者: openai/ollama/deepseek/zhipuai/anthropic等")
@ExcelProperty("提供者: openai/ollama/deepseek/zhipuai/anthropic/orcarouter")
@Schema(description = "提供者: openai/ollama/deepseek/zhipuai/anthropic/orcarouter")
private String provider;
@ExcelProperty("模型名称: gpt-4o, qwen3:8b, deepseek-v3 等")
@Schema(description = "模型名称: gpt-4o, qwen3:8b, deepseek-v3 等")
private String modelName;
@ExcelProperty("接入协议: openai/ollama/deepseek/anthropic")
@Schema(description = "接入协议: openai/ollama/deepseek/anthropic")
@ExcelProperty("接入协议: openai/ollama/deepseek/anthropic/orcarouter")
@Schema(description = "接入协议: openai/ollama/deepseek/anthropic/orcarouter")
private String protocol;
@ExcelProperty("API密钥(加密存储)")
@Schema(description = "API密钥(加密存储)")
@@ -81,6 +81,21 @@ public enum LlmProtocol {
.build())
.build();
}
},
ORCA_ROUTER("orcarouter") {
@Override
public ChatModel create(String apiKey, String baseUrl, String model, Integer maxTokens, Double temperature) {
// OrcaRouter 是 OpenAI 兼容的 LLM 路由网关(https://www.orcarouter.ai
return OpenAiChatModel.builder()
.options(OpenAiChatOptions.builder()
.apiKey(apiKey)
.model(model)
.temperature(temperature)
.maxTokens(maxTokens)
.baseUrl(baseUrl)
.build())
.build();
}
};
private final String value;