Add OmO agent model fallback chain to inherit OpenCode system default (#79)
- Add systemDefaultModel parameter to createBuiltinAgents() function - Implement model fallback priority chain for OmO agent: 1. oh-my-opencode.json agents.OmO.model (explicit override) 2. OpenCode system config.model (system default) 3. Hardcoded default in omoAgent (fallback) - Pass config.model from OpenCode settings to createBuiltinAgents() This fixes issue #79 where users couldn't change agent models via OpenCode config. 🤖 Generated with assistance of OhMyOpenCode (https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -62,7 +62,8 @@ function mergeAgentConfig(
|
|||||||
export function createBuiltinAgents(
|
export function createBuiltinAgents(
|
||||||
disabledAgents: BuiltinAgentName[] = [],
|
disabledAgents: BuiltinAgentName[] = [],
|
||||||
agentOverrides: AgentOverrides = {},
|
agentOverrides: AgentOverrides = {},
|
||||||
directory?: string
|
directory?: string,
|
||||||
|
systemDefaultModel?: string
|
||||||
): Record<string, AgentConfig> {
|
): Record<string, AgentConfig> {
|
||||||
const result: Record<string, AgentConfig> = {}
|
const result: Record<string, AgentConfig> = {}
|
||||||
|
|
||||||
@@ -84,6 +85,18 @@ export function createBuiltinAgents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const override = agentOverrides[agentName]
|
const override = agentOverrides[agentName]
|
||||||
|
|
||||||
|
// Apply model fallback chain for OmO agent:
|
||||||
|
// 1. oh-my-opencode.json agents.OmO.model (highest priority)
|
||||||
|
// 2. OpenCode system config.model (middle priority)
|
||||||
|
// 3. Hardcoded default in omoAgent (lowest priority / fallback)
|
||||||
|
if (agentName === "OmO" && systemDefaultModel && !override?.model) {
|
||||||
|
finalConfig = {
|
||||||
|
...finalConfig,
|
||||||
|
model: systemDefaultModel,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
result[name] = mergeAgentConfig(finalConfig, override)
|
result[name] = mergeAgentConfig(finalConfig, override)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -294,6 +294,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
pluginConfig.disabled_agents,
|
pluginConfig.disabled_agents,
|
||||||
pluginConfig.agents,
|
pluginConfig.agents,
|
||||||
ctx.directory,
|
ctx.directory,
|
||||||
|
config.model,
|
||||||
);
|
);
|
||||||
|
|
||||||
const userAgents = (pluginConfig.claude_code?.agents ?? true) ? loadUserAgents() : {};
|
const userAgents = (pluginConfig.claude_code?.agents ?? true) ? loadUserAgents() : {};
|
||||||
|
|||||||
Reference in New Issue
Block a user