Skip to content

Commit b915859

Browse files
authored
Edit Agent View (#128)
- Edit Agent view added - Add model from OpenAI compatible provider
1 parent 889c5f6 commit b915859

18 files changed

+1124
-91
lines changed

resources/help.md

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,38 @@ You could delete the GGUF files from this folder. If they are missing, but are n
124124

125125

126126

127+
## Edit Agent
128+
129+
### Overview
130+
Edit agent view is used for adding and editing agents. From there it is also possible to delete and copy an existing agent as a new one. The identifier of an agent is it's name. For now there is no tools model as part of the agent (the currently selected tools model will be used)
131+
132+
### How to use it
133+
Edit existing agent:
134+
1. Click Select button and load an agent to be edited.
135+
2. Change the Description and System Instructions fields (if needed)
136+
3. Click Add Tools button and select the tools to be used for by the agent.
137+
4. Click Save button
138+
139+
Add new agent:
140+
1. Click New button
141+
2. Enter Name, Description and System Instructions for the agent
142+
3. Click Add Tools button and select the tools to be used for by the agent.
143+
4. Click Save button
144+
145+
Copy existing agent as a new one:
146+
1. Click Copy as New button
147+
2. Edit Name, Description and System Instructions for the agent
148+
3. Click Add Tools button and select the tools to be used for by the agent.
149+
4. Click Save button
150+
151+
Delete agent:
152+
1. Click Delete button
153+
3. Select an agent to be deleted from the list
154+
4. Confirm the deletion of the agent
155+
156+
157+
158+
127159
## Edit with AI
128160

129161
### Requred servers
@@ -167,12 +199,12 @@ This generate a commit message, based on the current changes.
167199

168200
![Generate a commit message](https://github.com/user-attachments/assets/25f5d1ae-3673-4416-ba52-7615969c1bb3)
169201

170-
## Version 0.0.27 is released (21.09.2025)
202+
## Version 0.0.32 is released (05.10.2025)
171203
## What is new
172-
- xAI Grog4 free (from OpenRouter) added to the initial models
173-
- Chat with AI with project context removed (agent does it better)
174-
- Chat with AI about llama-vscode is now with agent, not using webui
175-
- Agent - new buttons "Tools Model" and "Agent" - possibility to view the selected model and agent and to change them.
204+
- predefined model DeepSeek V3.1 free 163,800 context (OpenRouter) added
205+
- predefined model Z.AI: GLM 4.5 Air (free): GLM 4.5 Air - 128.000 context (OpenRouter) added
206+
- Added agent "Ask" is for review, analysis and suggestions for the code without changing the files
207+
- Some bugs are fixed
176208

177209
## Setup instructions for llama.cpp server
178210

@@ -320,7 +352,7 @@ https://github.com/user-attachments/assets/e75e96de-878b-43db-a45b-47cc0c554697
320352
### Overview
321353
Agent is combination of system prompt and tools. If an agent is selected, it will be used by the Llama Agent UI. On slecting and agent, the selected llama-vscode tools are updated.
322354

323-
They have properties: name, description, syste prompt, tools.
355+
They have properties: name, description, system prompt, tools.
324356

325357
Agent could be added/deleted/viewed/selected/deselected/exported/imported
326358

@@ -330,6 +362,12 @@ Select "Agents..." from llama-vscode menu
330362
- Add agent...
331363
Adds an agent
332364

365+
- Edit agent...
366+
Edits an agent
367+
368+
- Copy agent...
369+
Copies an agent
370+
333371
- Delete agent...
334372
Deletes an agent
335373

@@ -390,6 +428,9 @@ Deselect the currently selected model. If the model is local, the llama.cpp serv
390428
- Add model from huggingface
391429
Enter search words to find a model from huggingface. If the model is selected it will be automatically downloaded (if not yet done) and a llama.cpp server will be started with it.
392430

431+
- Add chat model from OpenAI compatible provider
432+
Add chat model from OpenAI compatible provider - OpenRouter or custom (for example local/external llama.cpp server).
433+
393434
- Export
394435
A model could be exported as a .json files. This file could be shared with other users, modified if needed and imported again. Select a model to export it.
395436

@@ -455,7 +496,7 @@ Select the model you want to delete from the list and delete it.
455496
- View
456497
Select a model from the list to view all the details for this model
457498

458-
- Selected
499+
- Select
459500
Select a model from the list to select it. If the model is a local one (has a command in local start command) a llama.cpp server with this model will be started. Only one completion model could be selected at a time.
460501

461502
- Deselect
@@ -464,6 +505,9 @@ Deselect the currently selected model. If the model is local, the llama.cpp serv
464505
- Add model from huggingface
465506
Enter search words to find a model from huggingface. If the model is selected it will be automatically downloaded (if not yet done) and a llama.cpp server will be started with it.
466507

508+
- Add completion model from OpenAI compatible provider
509+
Add completion model from OpenAI compatible provider - OpenRouter or custom (for example local/external llama.cpp server).
510+
467511
- Export
468512
A model could be exported as a .json files. This file could be shared with other users, modified if needed and imported again. Select a model to export it.
469513

@@ -511,6 +555,9 @@ Deselect the currently selected model. If the model is local, the llama.cpp serv
511555
- Add model from huggingface
512556
Enter search words to find a model from huggingface. If the model is selected it will be automatically downloaded (if not yet done) and a llama.cpp server will be started with it.
513557

558+
- Add embeddings model from OpenAI compatible provider
559+
Add embeddings model from OpenAI compatible provider - OpenRouter or custom (for example local/external llama.cpp server).
560+
514561
- Export
515562
A model could be exported as a .json files. This file could be shared with others used, modified if needed and imported again. Select a model to export it.
516563

@@ -608,6 +655,9 @@ Deselect the currently selected model. If the model is local, the llama.cpp serv
608655
- Add model from huggingface
609656
Enter search words to find a model from huggingface. If the model is selected it will be automatically downloaded (if not yet done) and a llama.cpp server will be started with it.
610657

658+
- Add tools model from OpenAI compatible provider
659+
Add tools model from OpenAI compatible provider - OpenRouter or custom (for example local/external llama.cpp server).
660+
611661
- Export
612662
A model could be exported as a .json files. This file could be shared with other users, modified if needed and imported again. Select a model to export it.
613663

src/application.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { ChatService } from "./services/chat-service";
2828
import { Agent, Chat, Env, LlmModel } from "./types";
2929
import { ModelType, PERSISTENCE_KEYS } from "./constants";
3030
import { ApiKeyService } from "./services/api-key-service";
31+
import { OpenAiCompModelStrategy } from "./services/openai-comp-model-strategy";
3132

3233
export class Application {
3334

@@ -54,6 +55,7 @@ export class Application {
5455
public hfModelStrategy: HfModelStrategy
5556
public localModelStrategy: LocalModelStrategy
5657
public externalModelStrategy: ExternalModelStrategy
58+
public openAiCompModelStrategy: OpenAiCompModelStrategy
5759
public envService: EnvService
5860
public agentService: AgentService
5961
public agentCommandService: AgentCommandService
@@ -91,6 +93,7 @@ export class Application {
9193
this.hfModelStrategy = new HfModelStrategy(this)
9294
this.localModelStrategy = new LocalModelStrategy(this)
9395
this.externalModelStrategy = new ExternalModelStrategy(this)
96+
this.openAiCompModelStrategy = new OpenAiCompModelStrategy(this)
9497
this.modelService = new ModelService(this)
9598
this.envService = new EnvService(this)
9699
this.agentService = new AgentService(this)

src/architect.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export class Architect {
454454
if (result.includes("command not found") || result.includes("is not recognized")) {
455455
let questionInstall = "llama.cpp will be installed as it is requred by llama-vscode extension.";
456456
if (process.platform == 'win32') questionInstall += "\nVS Code will be restarted.";
457-
let shouldInstall = await Utils.showUserChoiceDialog(questionInstall, "Confirm");
457+
let [shouldInstall, shouldStopAsking] = await Utils.showYesNoNodontAskDialog(questionInstall, "Confirm");
458458
if (shouldInstall) {
459459
await this.app.menu.installLlamacpp();
460460
this.app.persistence.setGlobalValue("last_llama_cpp", (new Date()).toISOString());
@@ -464,16 +464,14 @@ export class Architect {
464464
}, 2000);
465465
}
466466
} else {
467-
let questionStopAskingLlamaCppInstall = "Do you prefer to stop getting a suggestion to install llama.cpp?"
468-
let shouldStopAsking = await Utils.showUserChoiceDialog(questionStopAskingLlamaCppInstall, "Yes");
469467
if (shouldStopAsking) this.app.configuration.updateConfigValue("ask_install_llamacpp", false);
470468
}
471469
} else {
472470
// Upgrade llama.cpp only if not upgraded at ask_upgrade_llamacpp_hours hours
473471
let lastUpgradeDateStr = this.app.persistence.getGlobalValue("last_llama_cpp");
474472
if (!lastUpgradeDateStr || Utils.isTimeToUpgrade(new Date(lastUpgradeDateStr), new Date(), this.app.configuration.ask_upgrade_llamacpp_hours)) {
475473
let questionInstall = "Do you want to upgrade llama.cpp (used for running local models)? (recommended).";
476-
let shouldInstall = await Utils.showUserChoiceDialog(questionInstall, "Confirm"); //yes, don't ask again
474+
let [shouldInstall, shouldStopAsking] = await Utils.showYesNoNodontAskDialog(questionInstall, "Confirm");
477475
if (shouldInstall) {
478476
await this.app.menu.installLlamacpp();
479477
this.app.persistence.setGlobalValue("last_llama_cpp", (new Date()).toISOString());
@@ -492,8 +490,6 @@ export class Architect {
492490
this.app.configuration.updateConfigValue(SETTING_NAME_FOR_LIST.ENVS, envs);
493491
}
494492
} else {
495-
let questionStopAskingLlamaCppUpgrade = "Do you prefer to stop getting a suggestion to upgrade llama.cpp?"
496-
let shouldStopAsking = await Utils.showUserChoiceDialog(questionStopAskingLlamaCppUpgrade, "Yes");
497493
if (shouldStopAsking){
498494
if (!lastUpgradeDateStr) this.app.persistence.setGlobalValue("last_llama_cpp", (new Date()).toISOString());
499495
this.app.configuration.updateConfigValue("ask_upgrade_llamacpp_hours", 72000); // more than 8 years

src/constants.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export const UI_TEXT_KEYS = {
175175
selectStartAgent: "Select/start agent...",
176176
deselectStopAgent: "Deselect/stop agent...",
177177
addAgent: "Add agent...",
178+
editAgent: "Edit agent...",
179+
copyAgent: "Copy agent...",
178180
viewAgentDetails: "View agent details...",
179181
deleteAgent: "Delete agent...",
180182
exportAgent: "Export agent...",
@@ -199,6 +201,7 @@ export const UI_TEXT_KEYS = {
199201
addLocalCompletionModel: "Add local completion model...",
200202
addExternalCompletionModel: "Add external completion model...",
201203
addCompletionModelFromHuggingface: "Add completion model from huggingface...",
204+
addCompletionOpenAiCompModel: "Add completion model from OpenAI compatible provider...",
202205
viewCompletionModelDetails: "View completion model details...",
203206
deleteCompletionModel: "Delete completion model...",
204207
exportCompletionModel: "Export completion model...",
@@ -210,6 +213,7 @@ export const UI_TEXT_KEYS = {
210213
addLocalChatModel: "Add local chat model...",
211214
addExternalChatModel: "Add external chat model...",
212215
addChatModelFromHuggingface: "Add chat model from huggingface...",
216+
addChatOpenAiCompModel: "Add chat model from OpenAI compatible provider...",
213217
viewChatModelDetails: "View chat model details...",
214218
deleteChatModel: "Delete chat model...",
215219
exportChatModel: "Export chat model...",
@@ -221,6 +225,7 @@ export const UI_TEXT_KEYS = {
221225
addLocalEmbeddingsModel: "Add local embeddings model...",
222226
addExternalEmbeddingsModel: "Add external embeddings model...",
223227
addEmbeddingsModelFromHuggingface: "Add embeddings model from huggingface...",
228+
addEmbeddingsOpenAiCompModel: "Add embeddings model from OpenAI compatible provider...",
224229
viewEmbeddingsModelDetails: "View embeddings model details...",
225230
deleteEmbeddingsModel: "Delete embeddings model...",
226231
exportEmbeddingsModel: "Export embeddings model...",
@@ -232,6 +237,7 @@ export const UI_TEXT_KEYS = {
232237
addLocalToolsModel: "Add local tools model...",
233238
addExternalToolsModel: "Add external tools model...",
234239
addToolsModelFromHuggingface: "Add tools model from huggingface...",
240+
addToolsOpenAiCompModel: "Add tools model from OpenAI compatible provider...",
235241
viewToolsModelDetails: "View tools model details...",
236242
deleteToolsModel: "Delete tools model...",
237243
exportToolsModel: "Export tools model...",
@@ -262,4 +268,13 @@ export const PREDEFINED_LISTS_KEYS = {
262268
ENVS: SETTING_NAME_FOR_LIST.ENVS,
263269
AGENTS: SETTING_NAME_FOR_LIST.AGENTS,
264270
AGENT_COMMANDS: SETTING_NAME_FOR_LIST.AGENT_COMMANDS,
265-
} as const;
271+
} as const;
272+
273+
export enum OpenAiProvidersKeys {
274+
OpenRouter = 'OpenRouter...',
275+
Custom = 'Custom...'
276+
}
277+
export const OPENAI_COMP_PROVIDERS = {
278+
[OpenAiProvidersKeys.OpenRouter]: "https://openrouter.ai/api",
279+
[OpenAiProvidersKeys.Custom]: ""
280+
} as const

src/lists.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ export const PREDEFINED_LISTS = new Map<string, any>([
629629
},
630630
{
631631
"name": "default",
632-
"description": "This is the default agent.",
632+
"description": "Agent for agentic programming - could answer questions, change/add/delete file, execute terminal commands, etc.",
633633
"systemInstruction": [
634634
"You are an agent for software development - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user.",
635635
"Only terminate your turn when you are sure that the problem is solved.",

src/llama-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export class LlamaServer {
241241
"temperature": 0.8,
242242
"top_p": 0.95,
243243
...(model.trim() != "" && { model: model}),
244-
"tools": [...this.app.tools.tools, ...this.app.tools.vscodeTools],
244+
"tools": [...this.app.tools.getTools(), ...this.app.tools.vscodeTools],
245245
"tool_choice": "auto"
246246
};
247247
}

0 commit comments

Comments
 (0)