DodoApp: Support Anthropic Claude based AI agent
Change-Id: I57c902c8e6fc7528df48013dc0dd61f9b74d0686
diff --git a/core/installer/app_configs/dodo_app.cue b/core/installer/app_configs/dodo_app.cue
index 1390459..c3355b3 100644
--- a/core/installer/app_configs/dodo_app.cue
+++ b/core/installer/app_configs/dodo_app.cue
@@ -30,7 +30,8 @@
cluster: clusterMap[strings.ToLower(_cluster)]
}
- geminiApiKey?: string
+ geminiApiKey?: string
+ anthropicApiKey?: string
for v in agent {
"sketch_\(v.name)_session_id": string @role(sketch-session-id)
}
@@ -499,14 +500,27 @@
type: "sketch:latest"
- geminiApiKey?: string
- _geminiApiKey: string
- if geminiApiKey != _|_ {
- _geminiApiKey: geminiApiKey
+ model: {
+ name: "gemini"
+ geminiApiKey?: string
+ } | {
+ name: "claude"
+ anthropicApiKey?: string
}
- if geminiApiKey == _|_ && input.geminiApiKey != _|_ {
+ _geminiApiKey?: string
+ _anthropicApiKey?: string
+ if model.name == "gemini" && model.geminiApiKey != _|_ {
+ _geminiApiKey: model.geminiApiKey
+ }
+ if model.name == "gemini" && model.geminiApiKey == _|_ && input.geminiApiKey != _|_ {
_geminiApiKey: input.geminiApiKey
}
+ if model.name == "claude" && model.anthropicApiKey != _|_ {
+ _anthropicApiKey: model.anthropicApiKey
+ }
+ if model.name == "claude" && model.anthropicApiKey == _|_ && input.anthropicApiKey != _|_ {
+ _anthropicApiKey: input.anthropicApiKey
+ }
agentPort: 2001
ports: [{
@@ -535,10 +549,16 @@
}, {
name: "DODO_API_BASE_ADDR"
value: input.managerAddr
- }, {
- name: "GEMINI_API_KEY"
- value: _geminiApiKey
- }]
+ },
+ if _geminiApiKey != _|_ {
+ name: "GEMINI_API_KEY"
+ value: _geminiApiKey
+ },
+ if _anthropicApiKey != _|_ {
+ name: "ANTHROPIC_API_KEY"
+ value: _anthropicApiKey
+ },
+ ]
...
}
rootDir: "/dodo/volume/\(_name)-apps"
@@ -548,7 +568,7 @@
_sessionId: input["sketch_\(name)_session_id"]
runConfiguration: [{
- bin: "sketch -verbose -unsafe -skaband-addr=\"\" -addr=\"0.0.0.0:2001\" -model=gemini -session-id=\"\(_sessionId)\""
+ bin: "sketch -verbose -unsafe -skaband-addr=\"\" -addr=\"0.0.0.0:2001\" -model=\(model.name) -session-id=\"\(_sessionId)\""
env: lastCmdEnv
}]
}
diff --git a/core/installer/dodo_app_test.go b/core/installer/dodo_app_test.go
index 6e792a0..a733c11 100644
--- a/core/installer/dodo_app_test.go
+++ b/core/installer/dodo_app_test.go
@@ -649,7 +649,10 @@
{
"type": "sketch:latest",
"name": "dev",
- "geminiApiKey": "foo",
+ "model": {
+ "name": "gemini",
+ "geminiApiKey": "foo"
+ },
"ingress": [{
"network": "private",
"subdomain": "foo",
@@ -726,8 +729,11 @@
{
"type": "sketch:latest",
"name": "dev",
+ "model": {
+ "name": "gemini"
+ }
}
- ],
+ ]
}
`
@@ -814,6 +820,9 @@
"nodeId": "76081511-fa20-4202-935a-a171c79a9daf",
"type": "sketch:latest",
"name": "lead",
+ "model": {
+ "name": "gemini"
+ },
"ports": [
{
"name": "agent",