mirror of
https://github.com/open-webui/computer.git
synced 2026-11-22 21:50:43 -05:00
refac
This commit is contained in:
1 parent
2196739b10
commit
28064c17d2
8 files changed
+45
-8
No files matched your search
@@ -101,11 +101,11 @@ Bring your own API key (OpenAI, Anthropic, Ollama, or any OpenAI-compatible endp
|
||||
|
||||
Use the subscriptions you already pay for as native backends on your own machine. No separate API key needed.
|
||||
|
||||
**Codex** · **Claude Code** · **Cursor** · **Grok** · **OpenCode** · **Cline** · **Pi**
|
||||
**Codex** · **Claude Code** · **Cursor** · **Grok** · **OpenCode** · **Cline** · **Gemini** · **Pi**
|
||||
|
||||
Add an agent profile from Settings, pick your models, and it shows up in the model selector like any other provider. Conversations run inside your workspace with full tool access and resume where you left off.
|
||||
|
||||
Prefer to run agents yourself? Any terminal agent (Gemini CLI, Kilo Code, Pi, and others) works in the terminal tab the way it always has.
|
||||
Prefer to run agents yourself? Any terminal agent (Kilo Code, Pi, and others) works in the terminal tab the way it always has.
|
||||
|
||||
## Messaging bots
|
||||
|
||||
|
||||
@@ -60,7 +60,15 @@ export const updateConfig = (config: Record<string, unknown>) =>
|
||||
|
||||
// ── Agents ─────────────────────────────────────────────────
|
||||
|
||||
export type AgentType = 'codex' | 'claude_code' | 'cursor' | 'grok' | 'opencode' | 'cline' | 'pi';
|
||||
export type AgentType =
|
||||
| 'codex'
|
||||
| 'claude_code'
|
||||
| 'cursor'
|
||||
| 'grok'
|
||||
| 'opencode'
|
||||
| 'cline'
|
||||
| 'gemini'
|
||||
| 'pi';
|
||||
export type AgentMode = 'auto' | 'enabled' | 'disabled';
|
||||
export type AgentStatus = 'ready' | 'not_found' | 'missing_dependency' | 'auth_unknown' | 'error';
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
grok: 'grok',
|
||||
opencode: 'opencode',
|
||||
cline: 'cline',
|
||||
gemini: 'gemini',
|
||||
pi: 'pi'
|
||||
}[agent];
|
||||
}
|
||||
@@ -61,6 +62,7 @@
|
||||
grok: 'Grok',
|
||||
opencode: 'OpenCode',
|
||||
cline: 'Cline',
|
||||
gemini: 'Gemini',
|
||||
pi: 'Pi'
|
||||
}[agent];
|
||||
}
|
||||
@@ -131,6 +133,7 @@
|
||||
<option value="grok">Grok</option>
|
||||
<option value="opencode">OpenCode</option>
|
||||
<option value="cline">Cline</option>
|
||||
<option value="gemini">Gemini</option>
|
||||
<option value="pi">Pi</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
grok: 'grok',
|
||||
opencode: 'opencode',
|
||||
cline: 'cline',
|
||||
gemini: 'gemini',
|
||||
pi: 'pi'
|
||||
}[agent];
|
||||
}
|
||||
@@ -125,6 +126,7 @@
|
||||
grok: 'Grok',
|
||||
opencode: 'OpenCode',
|
||||
cline: 'Cline',
|
||||
gemini: 'Gemini',
|
||||
pi: 'Pi'
|
||||
}[agent];
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ async def detect_profile(profile: dict[str, Any]) -> AgentDetection:
|
||||
return AgentDetection("ready", command, version, None, models)
|
||||
|
||||
if profile.get("agent") == "cline":
|
||||
models = await _probe_cline_models(command, profile)
|
||||
models = await _probe_acp_models(command, profile)
|
||||
if not models:
|
||||
return AgentDetection(
|
||||
"auth_unknown",
|
||||
@@ -170,6 +170,18 @@ async def detect_profile(profile: dict[str, Any]) -> AgentDetection:
|
||||
)
|
||||
return AgentDetection("ready", command, version, None, models)
|
||||
|
||||
if profile.get("agent") == "gemini":
|
||||
models = await _probe_acp_models(command, profile)
|
||||
if not models:
|
||||
return AgentDetection(
|
||||
"auth_unknown",
|
||||
command,
|
||||
version,
|
||||
"Could not discover Gemini models. Check Gemini CLI login or add models manually.",
|
||||
[],
|
||||
)
|
||||
return AgentDetection("ready", command, version, None, models)
|
||||
|
||||
if profile.get("agent") == "pi":
|
||||
models = await _probe_pi_models(command, profile)
|
||||
if not models:
|
||||
@@ -436,7 +448,7 @@ async def _probe_opencode_models(command: str, profile: dict[str, Any]) -> list[
|
||||
await proc.wait()
|
||||
|
||||
|
||||
async def _probe_cline_models(command: str, profile: dict[str, Any]) -> list[str] | None:
|
||||
async def _probe_acp_models(command: str, profile: dict[str, Any]) -> list[str] | None:
|
||||
from cptr.utils.agents.acp import AcpClient, acp_models_from_setup
|
||||
|
||||
env = os.environ.copy()
|
||||
|
||||
@@ -80,6 +80,16 @@ DEFAULT_AGENT_PROFILES: list[dict[str, Any]] = [
|
||||
"models": [],
|
||||
"default_model": "",
|
||||
},
|
||||
{
|
||||
"id": "gemini",
|
||||
"agent": "gemini",
|
||||
"name": "Gemini",
|
||||
"mode": "auto",
|
||||
"command": "gemini",
|
||||
"home": None,
|
||||
"models": [],
|
||||
"default_model": "",
|
||||
},
|
||||
{
|
||||
"id": "pi",
|
||||
"agent": "pi",
|
||||
@@ -93,7 +103,7 @@ DEFAULT_AGENT_PROFILES: list[dict[str, Any]] = [
|
||||
]
|
||||
|
||||
_PROFILE_ID_RE = re.compile(r"^[a-z][a-z0-9_-]{0,63}$")
|
||||
_VALID_AGENTS = {"codex", "claude_code", "cursor", "grok", "opencode", "cline", "pi"}
|
||||
_VALID_AGENTS = {"codex", "claude_code", "cursor", "grok", "opencode", "cline", "gemini", "pi"}
|
||||
_VALID_MODES = {"auto", "enabled", "disabled"}
|
||||
_VALID_CODEX_APPROVAL = {"ask", "auto", "full"}
|
||||
_VALID_CODEX_SANDBOX = {"read-only", "workspace-write", "danger-full-access"}
|
||||
@@ -113,6 +123,7 @@ _AGENT_DEFAULTS: dict[str, dict[str, str]] = {
|
||||
"grok": {"name": "Grok", "command": "grok", "model": ""},
|
||||
"opencode": {"name": "OpenCode", "command": "opencode", "model": ""},
|
||||
"cline": {"name": "Cline", "command": "cline", "model": ""},
|
||||
"gemini": {"name": "Gemini", "command": "gemini", "model": ""},
|
||||
"pi": {"name": "Pi", "command": "pi", "model": ""},
|
||||
}
|
||||
|
||||
@@ -130,7 +141,7 @@ def normalize_agent_profile(raw: dict[str, Any]) -> dict[str, Any]:
|
||||
agent = str(profile.get("agent") or "").strip()
|
||||
if agent not in _VALID_AGENTS:
|
||||
raise HTTPException(
|
||||
400, "agent must be codex, claude_code, cursor, grok, opencode, cline, or pi"
|
||||
400, "agent must be codex, claude_code, cursor, grok, opencode, cline, gemini, or pi"
|
||||
)
|
||||
defaults = _AGENT_DEFAULTS[agent]
|
||||
|
||||
|
||||
@@ -1524,6 +1524,7 @@ async def run_chat_task(
|
||||
"grok": run_grok_agent,
|
||||
"opencode": run_opencode_agent,
|
||||
"cline": run_cline_agent,
|
||||
"gemini": run_cline_agent,
|
||||
"pi": run_pi_agent,
|
||||
}
|
||||
runner = runners.get(agent_target.agent)
|
||||
|
||||
@@ -24,7 +24,7 @@ class ApiModelTarget:
|
||||
class AgentModelTarget:
|
||||
kind: Literal["agent"]
|
||||
profile_id: str
|
||||
agent: Literal["codex", "claude_code", "cursor", "grok", "opencode", "cline", "pi"]
|
||||
agent: Literal["codex", "claude_code", "cursor", "grok", "opencode", "cline", "gemini", "pi"]
|
||||
model: str
|
||||
full_model_id: str
|
||||
config: dict[str, Any]
|
||||
|
||||
Reference in new issue
Block a user