feat(opencode): remplace le profil Ollama HTTP par OpenCode
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
use domain::ids::ProfileId;
|
||||
use domain::permission::ProjectorKey;
|
||||
use domain::profile::{
|
||||
AgentProfile, ContextInjection, HttpChatConfig, McpCapability, McpConfigStrategy, McpTransport,
|
||||
AgentProfile, ContextInjection, McpCapability, McpConfigStrategy, McpTransport, OpenCodeConfig,
|
||||
StructuredAdapter,
|
||||
};
|
||||
|
||||
@ -97,29 +97,27 @@ pub fn reference_profiles() -> Vec<AgentProfile> {
|
||||
McpTransport::Stdio,
|
||||
)),
|
||||
AgentProfile::new(
|
||||
reference_id("ollama-openai-compatible"),
|
||||
"Ollama / OpenAI-compatible local model",
|
||||
"openai-compatible",
|
||||
reference_id("opencode-ollama"),
|
||||
"OpenCode + Ollama",
|
||||
"opencode",
|
||||
Vec::new(),
|
||||
ContextInjection::convention_file("AGENTS.md")
|
||||
.expect("AGENTS.md is a valid convention target"),
|
||||
None,
|
||||
Some("opencode --version".to_owned()),
|
||||
"{agentRunDir}",
|
||||
None,
|
||||
)
|
||||
.expect("OpenAI-compatible reference profile is valid")
|
||||
.with_structured_adapter(StructuredAdapter::OpenAiCompatible)
|
||||
.with_chat_http(
|
||||
HttpChatConfig::new(
|
||||
"http://localhost:11434/v1",
|
||||
"qwen2.5-coder",
|
||||
None,
|
||||
Some(120_000),
|
||||
Some(5_000),
|
||||
Some(HttpChatConfig::DEFAULT_MAX_TOOL_ITERATIONS),
|
||||
)
|
||||
.expect("OpenAI-compatible HTTP config is valid"),
|
||||
),
|
||||
.expect("OpenCode reference profile is valid")
|
||||
.with_structured_adapter(StructuredAdapter::OpenCode)
|
||||
.with_opencode(
|
||||
OpenCodeConfig::new(Some("ollama/qwen3-coder:30b".to_owned()))
|
||||
.expect("OpenCode config is valid"),
|
||||
)
|
||||
.with_mcp(McpCapability::new(
|
||||
McpConfigStrategy::open_code_config("opencode.json")
|
||||
.expect("opencode.json is a valid relative config target"),
|
||||
McpTransport::Stdio,
|
||||
)),
|
||||
AgentProfile::new(
|
||||
reference_id("gemini"),
|
||||
"Gemini CLI",
|
||||
@ -227,16 +225,23 @@ mod mcp_tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn openai_compatible_seed_is_selectable_http_profile_without_mcp() {
|
||||
let profile = profile("ollama-openai-compatible");
|
||||
fn opencode_ollama_seed_replaces_http_ollama_profile() {
|
||||
let profile = profile("opencode-ollama");
|
||||
assert_eq!(
|
||||
profile.structured_adapter,
|
||||
Some(StructuredAdapter::OpenAiCompatible)
|
||||
Some(StructuredAdapter::OpenCode)
|
||||
);
|
||||
let chat = profile.chat_http.as_ref().expect("chatHttp present");
|
||||
assert_eq!(chat.endpoint, "http://localhost:11434/v1");
|
||||
assert_eq!(chat.model, "qwen2.5-coder");
|
||||
assert!(profile.mcp.is_none());
|
||||
assert_eq!(profile.command, "opencode");
|
||||
assert!(profile.chat_http.is_none());
|
||||
assert_eq!(
|
||||
profile
|
||||
.opencode
|
||||
.as_ref()
|
||||
.and_then(|config| config.model.as_deref()),
|
||||
Some("ollama/qwen3-coder:30b")
|
||||
);
|
||||
assert!(profile.mcp.is_some());
|
||||
assert!(profile.materializes_idea_bridge());
|
||||
assert!(profile.is_selectable());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user