mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-04 10:54:33 +03:00
feat(server): bump model version (#15864)
This commit is contained in:
1 parent
66bca643da
commit
d863bfcd67
5 files changed
+91
-31
No files matched your search
Generated
+2
-2
@@ -4938,9 +4938,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "llm_adapter"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58f5fa220065e9799a5b93372655414a3af754af39d99436433b9710e874736e"
|
||||
checksum = "354989556fc4652502ad5b57507ebf7f2f761b2dfddb46573efa9598f8b651bd"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"jsonschema",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"action": "Transcript audio",
|
||||
"managedRoute": {
|
||||
"targets": ["transcript-lite"],
|
||||
"premiumTargets": ["gemini"],
|
||||
"premiumTargets": ["transcript"],
|
||||
"operations": ["structured"]
|
||||
},
|
||||
"config": {
|
||||
@@ -19,7 +19,7 @@
|
||||
"action": "Transcript audio structured",
|
||||
"managedRoute": {
|
||||
"targets": ["transcript-lite"],
|
||||
"premiumTargets": ["gemini"],
|
||||
"premiumTargets": ["transcript"],
|
||||
"operations": ["structured"]
|
||||
},
|
||||
"config": {
|
||||
@@ -837,6 +837,12 @@
|
||||
"displayName": "GPT-6 Luna",
|
||||
"minimumTier": "standard"
|
||||
},
|
||||
{
|
||||
"id": "haiku",
|
||||
"target": "haiku",
|
||||
"displayName": "Claude Haiku 5.5",
|
||||
"minimumTier": "standard"
|
||||
},
|
||||
{
|
||||
"id": "terra",
|
||||
"target": "terra",
|
||||
@@ -846,13 +852,13 @@
|
||||
{
|
||||
"id": "gemini",
|
||||
"target": "gemini",
|
||||
"displayName": "Gemini 3.8 Flash",
|
||||
"displayName": "Gemini 4 Hydrogen",
|
||||
"minimumTier": "premium"
|
||||
},
|
||||
{
|
||||
"id": "claude",
|
||||
"target": "claude",
|
||||
"displayName": "Claude Sonnet 4.6",
|
||||
"displayName": "Claude Sonnet 5.5",
|
||||
"minimumTier": "premium"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
"apiShapes": ["gemini_api", "gemini_vertex"],
|
||||
"modelId": "gemini-3.5-flash-lite"
|
||||
},
|
||||
"gemini": {
|
||||
"transcript": {
|
||||
"apiShapes": ["gemini_api", "gemini_vertex"],
|
||||
"modelId": "gemini-3.8-flash"
|
||||
},
|
||||
"gemini": {
|
||||
"apiShapes": ["gemini_api", "gemini_vertex"],
|
||||
"modelId": "gemini-4-hydrogen"
|
||||
},
|
||||
"luna": {
|
||||
"apiShapes": ["responses", "chat_completions"],
|
||||
"modelId": "gpt-6-luna"
|
||||
@@ -18,7 +22,16 @@
|
||||
"responses",
|
||||
"chat_completions"
|
||||
],
|
||||
"modelId": "claude-sonnet-4.6"
|
||||
"modelId": "claude-sonnet-5-5"
|
||||
},
|
||||
"haiku": {
|
||||
"apiShapes": [
|
||||
"vertex_anthropic",
|
||||
"anthropic",
|
||||
"responses",
|
||||
"chat_completions"
|
||||
],
|
||||
"modelId": "claude-haiku-5-5"
|
||||
},
|
||||
"image": {
|
||||
"apiShapes": ["openai_images"],
|
||||
|
||||
@@ -513,7 +513,20 @@ mod tests {
|
||||
let options = llm_get_built_in_route_options(chat.name.clone()).expect("chat route options");
|
||||
assert_eq!(options.standard_default_target_id.as_deref(), Some("luna"));
|
||||
assert_eq!(options.premium_default_target_id.as_deref(), Some("luna"));
|
||||
assert_eq!(options.choices.len(), 4);
|
||||
assert_eq!(options.choices.len(), 5);
|
||||
for premium in [false, true] {
|
||||
let luna = built_in_managed_target(&chat.name, "luna", premium).unwrap();
|
||||
let haiku = built_in_managed_target(&chat.name, "haiku", premium).unwrap();
|
||||
assert!(haiku.minimum_tier == luna.minimum_tier);
|
||||
assert_eq!(haiku.target.model_id, "claude-haiku-5-5");
|
||||
}
|
||||
for (id, model) in [("claude", "claude-sonnet-5-5"), ("gemini", "gemini-4-hydrogen")] {
|
||||
assert!(built_in_managed_target(&chat.name, id, false).is_none());
|
||||
assert_eq!(
|
||||
built_in_managed_target(&chat.name, id, true).unwrap().target.model_id,
|
||||
model
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
built_in_managed_target(&chat.name, "terra", false).map(|target| target.target.model_id.as_str()),
|
||||
None
|
||||
@@ -523,23 +536,25 @@ mod tests {
|
||||
Some("gpt-6.1-terra")
|
||||
);
|
||||
|
||||
let transcript = built_in_prompt("Transcript audio structured").expect("transcript prompt");
|
||||
assert_eq!(
|
||||
transcript.managed_targets,
|
||||
[ManagedTarget {
|
||||
api_shapes: vec![
|
||||
llm_adapter::backend::ApiShape::GeminiApi,
|
||||
llm_adapter::backend::ApiShape::GeminiVertex
|
||||
],
|
||||
model_id: "gemini-3.5-flash-lite".into()
|
||||
}]
|
||||
);
|
||||
assert_eq!(
|
||||
transcript.managed_premium_targets.as_deref().map(|targets| targets
|
||||
.iter()
|
||||
.map(|target| target.model_id.as_str())
|
||||
.collect::<Vec<_>>()),
|
||||
Some(vec!["gemini-3.8-flash"])
|
||||
);
|
||||
for name in ["Transcript audio", "Transcript audio structured"] {
|
||||
let transcript = built_in_prompt(name).expect("transcript prompt");
|
||||
assert_eq!(
|
||||
transcript.managed_targets,
|
||||
[ManagedTarget {
|
||||
api_shapes: vec![
|
||||
llm_adapter::backend::ApiShape::GeminiApi,
|
||||
llm_adapter::backend::ApiShape::GeminiVertex
|
||||
],
|
||||
model_id: "gemini-3.5-flash-lite".into()
|
||||
}]
|
||||
);
|
||||
assert_eq!(
|
||||
transcript.managed_premium_targets.as_deref().map(|targets| targets
|
||||
.iter()
|
||||
.map(|target| target.model_id.as_str())
|
||||
.collect::<Vec<_>>()),
|
||||
Some(vec!["gemini-3.8-flash"])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ mod tests {
|
||||
{ "id": "gateway", "type": "openrouter", "config": { "apiKey": "gateway-key" } },
|
||||
{ "id": "openai", "type": "openai", "models": ["stale-model"], "config": { "apiKey": "old-key" } },
|
||||
{ "id": "google", "type": "gemini", "models": ["unknown-future-model"], "config": { "apiKey": "test" } },
|
||||
{ "id": "official", "type": "anthropic", "models": ["claude-sonnet-4.6"], "config": { "apiKey": "test" } },
|
||||
{ "id": "official", "type": "anthropic", "models": ["claude-sonnet-5-5"], "config": { "apiKey": "test" } },
|
||||
{ "id": "vertex", "type": "anthropicVertex", "config": { "project": "test", "location": "global" } }
|
||||
] }
|
||||
}))
|
||||
@@ -236,13 +236,39 @@ mod tests {
|
||||
for (id, service, model) in [
|
||||
("luna", "openrouter", "openai/gpt-6-luna"),
|
||||
("terra", "openrouter", "openai/gpt-6.1-terra"),
|
||||
("gemini", "gemini", "gemini-3.8-flash"),
|
||||
("claude", "anthropicVertex", "claude-sonnet-4-6"),
|
||||
("gemini", "gemini", "gemini-4-hydrogen"),
|
||||
("claude", "anthropicVertex", "claude-sonnet-5-5"),
|
||||
("haiku", "anthropicVertex", "claude-haiku-5-5"),
|
||||
] {
|
||||
let selected = load(&copilot, id);
|
||||
assert_eq!(selected.provider.as_str(), service);
|
||||
assert_eq!(selected.target.wire_model(), model);
|
||||
}
|
||||
for id in ["luna", "haiku"] {
|
||||
assert!(
|
||||
load_managed_target(
|
||||
&copilot,
|
||||
&route::slot("chat.default").unwrap(),
|
||||
Some("Chat With AFFiNE AI"),
|
||||
route::CopilotManagedTier::Standard,
|
||||
Some(id),
|
||||
)
|
||||
.unwrap()
|
||||
.is_some()
|
||||
);
|
||||
}
|
||||
let mut gateway_only = copilot.clone();
|
||||
gateway_only
|
||||
.providers
|
||||
.profiles
|
||||
.retain(|profile| profile.id == "gateway");
|
||||
gateway_only.initialize_managed_routes().unwrap();
|
||||
for (id, model) in [
|
||||
("claude", "anthropic/claude-sonnet-5.5"),
|
||||
("haiku", "anthropic/claude-haiku-5.5"),
|
||||
] {
|
||||
assert_eq!(load(&gateway_only, id).target.wire_model(), model);
|
||||
}
|
||||
for binding in &copilot.managed_routes {
|
||||
use llm_adapter::{capability::ModelOutput, target::BackendOperation};
|
||||
assert!(!binding.resolved.capabilities.is_empty());
|
||||
@@ -271,7 +297,7 @@ mod tests {
|
||||
.remove("openaiDialect");
|
||||
copilot.providers.profiles.push(
|
||||
serde_json::from_value(json!({
|
||||
"id": "vertex-alias", "type": "anthropicVertex", "models": ["claude-sonnet-4-6"],
|
||||
"id": "vertex-alias", "type": "anthropicVertex", "models": ["claude-sonnet-5-5"],
|
||||
"config": { "project": "test", "location": "global" }
|
||||
}))
|
||||
.unwrap(),
|
||||
|
||||
Reference in new issue
Block a user