mirror of
https://github.com/ggml-org/llama.vscode.git
synced 2026-05-07 01:15:23 +00:00
Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a2078d470 |
12 changed files with 330 additions and 50 deletions
25
package.json
25
package.json
|
|
@ -1565,6 +1565,31 @@
|
|||
"default": "",
|
||||
"description": "self-signed certificate file - path/to/cert.pem"
|
||||
},
|
||||
"llama-vscode.health_check_interval_s": {
|
||||
"type": "number",
|
||||
"default": 30,
|
||||
"description": "Models health check interval in seconds"
|
||||
},
|
||||
"llama-vscode.health_check_compl_enabled": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Works only for llama.cpp servers - enables health check for completion model"
|
||||
},
|
||||
"llama-vscode.health_check_chat_enabled": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Works only for llama.cpp servers - enables health check for chat model"
|
||||
},
|
||||
"llama-vscode.health_check_embs_enabled": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Works only for llama.cpp servers - enables health check for embeddings model"
|
||||
},
|
||||
"llama-vscode.health_check_tools_enabled": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Works only for llama.cpp servers - enables health check for tools model"
|
||||
},
|
||||
"llama-vscode.n_prefix": {
|
||||
"default": 256,
|
||||
"type": "number",
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ This is a conversation with the local AI. Mainly for asking questions for refere
|
|||
- Press Ctrl+; inside an editor (or select from llama.vscode menu Chat with AI) - A chat window will open inside VS Code
|
||||
- Enter your message and start the chat
|
||||
|
||||
## Chat with AI with project context
|
||||
This is removed. Chat with AI with project context is equal to using agent with the tool search_source. The agent has many other tools and is therefore a better choice.
|
||||
## Code completion
|
||||
## Code completion
|
||||
|
||||
### Requred servers
|
||||
- Completion server
|
||||
|
|
@ -183,13 +181,31 @@ There is a page in llama-vscode UI with the current environment details. From th
|
|||
In the source control panel just click on the star button (near the commit button).
|
||||
This generate a commit message, based on the current changes.
|
||||
|
||||
## Version 0.0.39 is released (31.12.2025)
|
||||
## Health check
|
||||
|
||||
### Overview
|
||||
Health check for the models is added. It works with llama.cpp server or other servers, which supports endpoint/health REST service. When the health check is enabled, the current state of the selected model is visible in the environment view. The health check is done every 30 seconds (could be changed from setting Health_check_interval_s). It could be triggered also manually by the user by clicking the appropriate button in the environment view (after the selected model name).
|
||||
|
||||
### How to use it
|
||||
1. Enable health check in settings for the appropriate model (e.g. for completion Health_check_compl_enabled)
|
||||
2. Open environment view and select the completion model (for example)
|
||||
3. The health check will be monitored periodically and the status will be displayed in the environment view
|
||||
4. Optionally, the health check can be triggered manually by clicking the appropriate button
|
||||
|
||||
Settings:
|
||||
- Health_check_interval_s: The interval in seconds for the health check
|
||||
- Health_check_compl_enabled: Enable/disable health check for completion model
|
||||
- Health_check_chat_enabled: Enable/disable health check for chat model
|
||||
- Health_check_embs_enabled: Enable/disable health check for embedding model
|
||||
- Health_check_tools_enabled: Enable/disable health check for tools model
|
||||
## Version 0.0.40 is released (05.01.2025)
|
||||
## What is new
|
||||
|
||||
- Skills (https://agentskills.io/home) could be now used with llama-vscode
|
||||
- skills_folder setting determines where are skills descriptions. If empty the <project_folder>/skills folder is used by default
|
||||
- Anthropic models support skills best. I guess, the open source models will catch up.
|
||||
|
||||
Generation of multiple completions in parallel:
|
||||
- Setting max_parallel_completions determines how many completions to generate in parallel (default 3)
|
||||
- Shortcuts - Alt+] - next completion, Alt+[ - previous completion
|
||||
- Requires llama.cpp after December, 6, 2025 (commit c42712b) but is backword compatible (generates one completion for older versions)
|
||||
- [More details](https://github.com/ggml-org/llama.vscode/wiki/Parallel-completions)
|
||||
|
||||
## Setup instructions for llama.cpp server
|
||||
|
||||
|
|
@ -682,8 +698,9 @@ Llama-vscode generates parallel code completions (default 3) if a version of lla
|
|||
The setting max_parallel_completions determines how many completions are generated.
|
||||
|
||||
### How to use it
|
||||
1. Run the completion model and start codeing
|
||||
1. Run the completion model and start coding
|
||||
2. When a code completion is shown, press Ctrl+] to show the next completion, Ctrl+[ to show the previous completion
|
||||
3. Alternatively - you could hover over the shown completion and when the toolbar is shown click the arrows to show the other completions.
|
||||
|
||||
|
||||
Settings:
|
||||
|
|
|
|||
|
|
@ -65,13 +65,14 @@ export class Application {
|
|||
public apiKeyService: ApiKeyService
|
||||
|
||||
private selectedComplModel: LlmModel = Application.emptyModel
|
||||
private selectedModel: LlmModel = Application.emptyModel
|
||||
private selectedChatModel: LlmModel = Application.emptyModel
|
||||
private selectedEmbeddingsModel: LlmModel = Application.emptyModel
|
||||
private selectedToolsModel: LlmModel = Application.emptyModel
|
||||
private selectedTmpAgentModel: LlmModel = Application.emptyModel
|
||||
private selectedEnv: Env = {name: ""}
|
||||
private selectedAgent: Agent = {name: "", systemInstruction: []}
|
||||
private selectedChat: Chat = {name: "", id: ""}
|
||||
private modelState: Map<string, string> = new Map()
|
||||
|
||||
private constructor(context: vscode.ExtensionContext) {
|
||||
this.configuration = new Configuration()
|
||||
|
|
@ -111,7 +112,26 @@ export class Application {
|
|||
Application.instance = new Application(context);
|
||||
}
|
||||
return Application.instance;
|
||||
}
|
||||
}
|
||||
|
||||
getModel = (modelType: ModelType): LlmModel => {
|
||||
let model: LlmModel;
|
||||
switch (modelType) {
|
||||
case ModelType.Completion:
|
||||
model = this.selectedComplModel;
|
||||
break;
|
||||
case ModelType.Chat:
|
||||
model = this.selectedChatModel;
|
||||
break;
|
||||
case ModelType.Embeddings:
|
||||
model = this.selectedEmbeddingsModel;
|
||||
break;
|
||||
case ModelType.Tools:
|
||||
model = this.selectedToolsModel;
|
||||
break;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
getComplModel = (): LlmModel => {
|
||||
return this.selectedComplModel;
|
||||
|
|
@ -122,7 +142,7 @@ export class Application {
|
|||
}
|
||||
|
||||
getChatModel = (): LlmModel => {
|
||||
return this.selectedModel;
|
||||
return this.selectedChatModel;
|
||||
}
|
||||
|
||||
getEmbeddingsModel = (): LlmModel => {
|
||||
|
|
@ -158,7 +178,7 @@ export class Application {
|
|||
}
|
||||
|
||||
isChatModelSelected = (): boolean => {
|
||||
return this.selectedModel != undefined && this.selectedModel.name. trim() != "";
|
||||
return this.selectedChatModel != undefined && this.selectedChatModel.name. trim() != "";
|
||||
}
|
||||
|
||||
isToolsModelSelected = (): boolean => {
|
||||
|
|
@ -193,7 +213,7 @@ export class Application {
|
|||
this.selectedComplModel = model??Application.emptyModel;
|
||||
break;
|
||||
case ModelType.Chat:
|
||||
this.selectedModel = model??Application.emptyModel;
|
||||
this.selectedChatModel = model??Application.emptyModel;
|
||||
break;
|
||||
case ModelType.Embeddings:
|
||||
this.selectedEmbeddingsModel = model??Application.emptyModel;
|
||||
|
|
@ -205,6 +225,15 @@ export class Application {
|
|||
this.llamaWebviewProvider.updateLlamaView();
|
||||
}
|
||||
|
||||
setModelState = (type: ModelType, state: string) => {
|
||||
this.modelState.set(type, state);
|
||||
this.llamaWebviewProvider.updateModels();
|
||||
}
|
||||
|
||||
getModelState = (type: ModelType): string => {
|
||||
return this.modelState.get(type)??"";
|
||||
}
|
||||
|
||||
setAgentModel = (model: LlmModel | undefined) => {
|
||||
this.selectedTmpAgentModel = model??Application.emptyModel;
|
||||
this.llamaWebviewProvider.updateLlamaView();
|
||||
|
|
|
|||
|
|
@ -178,6 +178,16 @@ export class Architect {
|
|||
context.subscriptions.push(rungBufferUpdateDisposable);
|
||||
}
|
||||
|
||||
setPeriodicModelsHealthUpdate = (context: vscode.ExtensionContext) => {
|
||||
const modelsHealthIntervalId = setInterval(this.app.modelService.periodicModelHealthUpdate, this.app.configuration.health_check_interval_s * 1000);
|
||||
const modelsHealthUpdateDisposable = {
|
||||
dispose: () => {
|
||||
clearInterval(modelsHealthIntervalId);
|
||||
}
|
||||
};
|
||||
context.subscriptions.push(modelsHealthUpdateDisposable);
|
||||
}
|
||||
|
||||
setOnSaveFile = (context: vscode.ExtensionContext) => {
|
||||
const onSaveDocDisposable = vscode.workspace.onDidSaveTextDocument(this.app.extraContext.handleDocumentSave);
|
||||
context.subscriptions.push(onSaveDocDisposable);
|
||||
|
|
|
|||
|
|
@ -369,15 +369,4 @@ export class Completion {
|
|||
}
|
||||
else return [];
|
||||
}
|
||||
|
||||
private getMaxNumber(numbers: number[]): number {
|
||||
let max = 0;
|
||||
for (const num of numbers) {
|
||||
if (num > max) {
|
||||
max = num;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ export class Configuration {
|
|||
ring_update_ms = 1000;
|
||||
skills_folder = ""
|
||||
language = "en";
|
||||
health_check_interval_s = 30;
|
||||
health_check_compl_enabled = false;
|
||||
health_check_chat_enabled = false;
|
||||
health_check_embs_enabled = false;
|
||||
health_check_tools_enabled = false;
|
||||
|
||||
|
||||
// experimental - avoid using
|
||||
use_openai_endpoint = false;
|
||||
|
|
@ -263,6 +269,11 @@ export class Configuration {
|
|||
this.env_start_last_used_confirm = Boolean(config.get<boolean>("env_start_last_used_confirm", true));
|
||||
this.ask_install_llamacpp = Boolean(config.get<boolean>("ask_install_llamacpp", true));
|
||||
this.ask_upgrade_llamacpp_hours = Number(config.get<number>("ask_upgrade_llamacpp_hours"));
|
||||
this.health_check_interval_s = Number(config.get<number>("health_check_interval_s"));
|
||||
this.health_check_compl_enabled = Boolean(config.get<boolean>("health_check_compl_enabled"));
|
||||
this.health_check_chat_enabled = Boolean(config.get<boolean>("health_check_chat_enabled"));
|
||||
this.health_check_embs_enabled = Boolean(config.get<boolean>("health_check_embs_enabled"));
|
||||
this.health_check_tools_enabled = Boolean(config.get<boolean>("health_check_tools_enabled"));
|
||||
};
|
||||
|
||||
getUiText = (uiText: string): string | undefined => {
|
||||
|
|
@ -287,7 +298,11 @@ export class Configuration {
|
|||
isEnvViewSettingChanged = (event: vscode.ConfigurationChangeEvent) => {
|
||||
return event.affectsConfiguration("llama-vscode.enabled")
|
||||
|| event.affectsConfiguration("llama-vscode.rag_enabled")
|
||||
|| event.affectsConfiguration("llama-vscode.env_start_last_used");
|
||||
|| event.affectsConfiguration("llama-vscode.env_start_last_used")
|
||||
|| event.affectsConfiguration("llama-vscode.health_check_compl_enabled")
|
||||
|| event.affectsConfiguration("llama-vscode.health_check_chat_enabled")
|
||||
|| event.affectsConfiguration("llama-vscode.health_check_embs_enabled")
|
||||
|| event.affectsConfiguration("llama-vscode.health_check_tools_enabled");
|
||||
}
|
||||
|
||||
isRagConfigChanged = (event: vscode.ConfigurationChangeEvent) => {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
app.architect.registerCommandNoCacheCompletion(context);
|
||||
app.architect.setOnSaveFile(context);
|
||||
app.architect.setPeriodicRingBufferUpdate(context);
|
||||
app.architect.setPeriodicModelsHealthUpdate(context);
|
||||
app.architect.setClipboardEvents(context);
|
||||
app.architect.setOnChangeActiveFile(context);
|
||||
app.architect.registerCommandAcceptFirstLine(context);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import axios from "axios";
|
||||
import axios, { AxiosRequestConfig } from "axios";
|
||||
import {Application} from "./application";
|
||||
import vscode, { Terminal } from "vscode";
|
||||
import { LlmModel, LlamaChatResponse, LlamaResponse, ChatMessage } from "./types";
|
||||
|
|
@ -7,7 +7,7 @@ import * as cp from 'child_process';
|
|||
import * as util from 'util';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { SUPPORTED_IMG_FILE_EXTS } from "./constants";
|
||||
import { ModelType, SUPPORTED_IMG_FILE_EXTS } from "./constants";
|
||||
|
||||
const STATUS_OK = 200;
|
||||
|
||||
|
|
@ -832,4 +832,36 @@ export class LlamaServer {
|
|||
}
|
||||
return { endpoint, model, requestConfig };
|
||||
}
|
||||
|
||||
checkHealth = async (modelType: ModelType, model: LlmModel) => {
|
||||
let requestConfig: AxiosRequestConfig = this.app.configuration.axiosRequestConfigCompl;
|
||||
switch (modelType) {
|
||||
case ModelType.Chat:
|
||||
requestConfig = this.app.configuration.axiosRequestConfigChat;
|
||||
break;
|
||||
case ModelType.Completion:
|
||||
requestConfig = this.app.configuration.axiosRequestConfigCompl;
|
||||
break;
|
||||
case ModelType.Tools:
|
||||
requestConfig = this.app.configuration.axiosRequestConfigTools;
|
||||
break;
|
||||
case ModelType.Embeddings:
|
||||
requestConfig = this.app.configuration.axiosRequestConfigEmbeddings;
|
||||
break;
|
||||
}
|
||||
try {
|
||||
// TODO:Make sure to work with OpenRauter too
|
||||
let response = await axios.get(model.endpoint + "/health", requestConfig);
|
||||
if (!response.data.hasOwnProperty("status")) return "Error: No health status field found";
|
||||
return response.data.status
|
||||
} catch (error) {
|
||||
if (error instanceof TypeError) {
|
||||
return "TypeError occurred: " + error.message;
|
||||
} else if (error instanceof ReferenceError) {
|
||||
return "ReferenceError occurred:" + error.message;
|
||||
} else {
|
||||
return "An unexpected Error occurred:" + (error as Error).message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
|
|||
case 'moreCompletionModel':
|
||||
await this.app.modelService.processModelActions(ModelType.Completion);
|
||||
break;
|
||||
case 'checkModelHealth':
|
||||
await this.app.modelService.checkModelHealth(message.model);
|
||||
break;
|
||||
case 'selectAgentModel':
|
||||
await this.app.modelService.selectAgentModel(ModelType.Tools, this.app.configuration.tools_models_list);
|
||||
break;
|
||||
|
|
@ -356,7 +359,7 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
|
|||
files: Array.from(contextFiles.entries())
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public addEditAgent(agent: Agent) {
|
||||
this.app.agentService.resetEditedAgentTools();
|
||||
|
|
@ -385,29 +388,42 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
|
|||
this.updateSettingInEnvView('enabled', this.app.configuration.enabled);
|
||||
this.updateSettingInEnvView('rag_enabled', this.app.configuration.rag_enabled);
|
||||
this.updateSettingInEnvView('env_start_last_used', this.app.configuration.env_start_last_used);
|
||||
this.updateSettingInEnvView('health_check_compl_enabled', this.app.configuration.health_check_compl_enabled);
|
||||
this.updateSettingInEnvView('health_check_chat_enabled', this.app.configuration.health_check_chat_enabled);
|
||||
this.updateSettingInEnvView('health_check_embs_enabled', this.app.configuration.health_check_embs_enabled);
|
||||
this.updateSettingInEnvView('health_check_tools_enabled', this.app.configuration.health_check_tools_enabled);
|
||||
}
|
||||
|
||||
private updateEmbsModel() {
|
||||
private updateEmbsModel(status: string = "") {
|
||||
const currentEmbeddingsModel: LlmModel = this.app.getEmbeddingsModel();
|
||||
let modelName = currentEmbeddingsModel.name
|
||||
if (this.app.configuration.health_check_embs_enabled && status && status.toLowerCase() != "ok")
|
||||
modelName += ": " + status;
|
||||
vscode.commands.executeCommand('llama-vscode.webview.postMessage', {
|
||||
command: 'updateEmbeddingsModel',
|
||||
model: currentEmbeddingsModel.name || 'No model selected'
|
||||
model: modelName || 'No model selected'
|
||||
});
|
||||
}
|
||||
|
||||
private updateChatModel() {
|
||||
const currentChatModel: LlmModel = this.app.getChatModel();
|
||||
private updateChatModel(status: string = "") {
|
||||
const currentChatModel: LlmModel = this.app.getModel(ModelType.Chat);
|
||||
let modelName = currentChatModel.name
|
||||
if (this.app.configuration.health_check_chat_enabled && status && status.toLowerCase() != "ok")
|
||||
modelName += ": " + status;
|
||||
vscode.commands.executeCommand('llama-vscode.webview.postMessage', {
|
||||
command: 'updateChatModel',
|
||||
model: currentChatModel.name || 'No model selected'
|
||||
model: modelName || 'No model selected'
|
||||
});
|
||||
}
|
||||
|
||||
private updateToolsModel() {
|
||||
const currentToolsModel: LlmModel = this.app.getToolsModel();
|
||||
private updateToolsModel(status: string = "") {
|
||||
const currentToolsModel: LlmModel = this.app.getModel(ModelType.Tools);
|
||||
let modelName = currentToolsModel.name
|
||||
if (this.app.configuration.health_check_tools_enabled && status && status.toLowerCase() != "ok")
|
||||
modelName += ": " + status;
|
||||
vscode.commands.executeCommand('llama-vscode.webview.postMessage', {
|
||||
command: 'updateToolsModel',
|
||||
model: currentToolsModel.name || 'No model selected'
|
||||
model: modelName || 'No model selected'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -419,11 +435,14 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
|
|||
});
|
||||
}
|
||||
|
||||
private updateComplsModel() {
|
||||
const currentToolsModel: LlmModel = this.app.getComplModel();
|
||||
public updateComplsModel(status: string = "") {
|
||||
const currentComplModel: LlmModel = this.app.getModel(ModelType.Completion);
|
||||
let modelName = currentComplModel.name
|
||||
if (this.app.configuration.health_check_compl_enabled && status && status.toLowerCase() != "ok")
|
||||
modelName += ": " + status;
|
||||
vscode.commands.executeCommand('llama-vscode.webview.postMessage', {
|
||||
command: 'updateCompletionModel',
|
||||
model: currentToolsModel.name || 'No model selected'
|
||||
model: modelName || 'No model selected'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -497,10 +516,7 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
|
|||
}
|
||||
|
||||
public updateLlamaView() {
|
||||
this.updateToolsModel();
|
||||
this.updateChatModel();
|
||||
this.updateEmbsModel();
|
||||
this.updateComplsModel();
|
||||
this.updateModels();
|
||||
this.updateTmpAgentModel();
|
||||
this.updateAgent();
|
||||
this.updateEnv();
|
||||
|
|
@ -508,6 +524,13 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
|
|||
this.logInUi(this.app.llamaAgent.getAgentLogText())
|
||||
}
|
||||
|
||||
public updateModels() {
|
||||
this.updateToolsModel(this.app.getModelState(ModelType.Tools));
|
||||
this.updateChatModel(this.app.getModelState(ModelType.Chat));
|
||||
this.updateEmbsModel(this.app.getModelState(ModelType.Embeddings));
|
||||
this.updateComplsModel(this.app.getModelState(ModelType.Completion));
|
||||
}
|
||||
|
||||
public updateContextFilesInfo() {
|
||||
const fileKeys = this.app.chatContext.getProjectFiles();
|
||||
vscode.commands.executeCommand('llama-vscode.webview.postMessage', {
|
||||
|
|
|
|||
|
|
@ -391,6 +391,7 @@ export class ModelService {
|
|||
|
||||
clearModel = (type: ModelType) => {
|
||||
this.app.setSelectedModel(type, Application.emptyModel);
|
||||
this.app.setModelState(type, "");
|
||||
this.app.llamaWebviewProvider.updateLlamaView();
|
||||
}
|
||||
|
||||
|
|
@ -433,4 +434,38 @@ export class ModelService {
|
|||
}
|
||||
else return true;
|
||||
}
|
||||
|
||||
periodicModelHealthUpdate = async () => {
|
||||
if (this.app.configuration.health_check_interval_s > 0) {
|
||||
if (this.app.configuration.health_check_compl_enabled && this.app.isComplModelSelected()) {
|
||||
await this.updateModelState(ModelType.Completion);
|
||||
}
|
||||
if (this.app.configuration.health_check_chat_enabled && this.app.isChatModelSelected()) {
|
||||
await this.updateModelState(ModelType.Chat);
|
||||
}
|
||||
if (this.app.configuration.health_check_embs_enabled && this.app.isEmbeddingsModelSelected()) {
|
||||
await this.updateModelState(ModelType.Embeddings);
|
||||
}
|
||||
if (this.app.configuration.health_check_tools_enabled && this.app.isToolsModelSelected()) {
|
||||
await this.updateModelState(ModelType.Tools);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async checkModelHealth(modelType: ModelType) {
|
||||
let healthState = await this.app.llamaServer.checkHealth(modelType, this.app.getModel(modelType));
|
||||
if (healthState.toLowerCase() == "ok" || healthState.toLowerCase() == "healthy") vscode.window.showInformationMessage(modelType.charAt(0).toUpperCase() + modelType.slice(1) + " model health is OK.");
|
||||
else vscode.window.showErrorMessage("Error with " + modelType + " model:" + healthState);
|
||||
this.app.setModelState(modelType, healthState);
|
||||
}
|
||||
|
||||
private async updateModelState(modelType: ModelType) {
|
||||
let healthState = await this.app.llamaServer.checkHealth(modelType, this.app.getModel(modelType));
|
||||
let currentHealthState = this.app.getModelState(modelType);
|
||||
if ((currentHealthState == "" || currentHealthState.toLocaleLowerCase() == "ok" || currentHealthState.toLocaleLowerCase() == "healthy")
|
||||
&& healthState.toLowerCase() != "ok" && healthState.toLowerCase() != "healthy") {
|
||||
vscode.window.showErrorMessage("Error with completion model:" + healthState);
|
||||
}
|
||||
this.app.setModelState(modelType, healthState.slice(0, 150));
|
||||
}
|
||||
}
|
||||
|
|
@ -564,8 +564,8 @@ export class Tools {
|
|||
"description": "Gets the files changes since last commit",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
],
|
||||
"properties": {},
|
||||
"required": [],
|
||||
},
|
||||
"strict": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ interface AddEnvViewProps {
|
|||
completionsEnabled?: boolean;
|
||||
ragEnabled?: boolean;
|
||||
autoStartEnv?: boolean;
|
||||
healthCheckComplEnabled?: boolean;
|
||||
healthCheckChatEnabled?: boolean;
|
||||
healthCheckEmbsEnabled?: boolean,
|
||||
healthCheckToolsEnabled?: boolean
|
||||
}
|
||||
|
||||
const noModelSelected = 'No model selected';
|
||||
|
|
@ -23,11 +27,19 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
currentAgent,
|
||||
completionsEnabled = false,
|
||||
ragEnabled = false,
|
||||
autoStartEnv = false
|
||||
autoStartEnv = false,
|
||||
healthCheckComplEnabled = false,
|
||||
healthCheckChatEnabled = false,
|
||||
healthCheckEmbsEnabled = false,
|
||||
healthCheckToolsEnabled = false
|
||||
}) => {
|
||||
const [isCompletionsEnabled, setIsCompletionsEnabled] = useState(completionsEnabled);
|
||||
const [isRagEnabled, setIsRagEnabled] = useState(ragEnabled);
|
||||
const [isAutoStartEnv, setIsAutoStartEnv] = useState(autoStartEnv);
|
||||
const [isHealthCheckComplEnabled, setIsHealthCheckComplEnabled] = useState(healthCheckComplEnabled);
|
||||
const [isHealthCheckChatEnabled, setIsHealthCheckChatEnabled] = useState(healthCheckChatEnabled);
|
||||
const [isHealthCheckEmbsEnabled, setIsHealthCheckEmbsEnabled] = useState(healthCheckEmbsEnabled);
|
||||
const [isHealthCheckToolsEnabled, setIsHealthCheckToolsEnabled] = useState(healthCheckToolsEnabled);
|
||||
|
||||
// Get the VS Code setting on component mount
|
||||
useEffect(() => {
|
||||
|
|
@ -50,6 +62,30 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
key: 'env_start_last_used'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
vscode.postMessage({
|
||||
command: 'getVscodeSetting',
|
||||
key: 'health_check_compl_enabled'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
vscode.postMessage({
|
||||
command: 'getVscodeSetting',
|
||||
key: 'health_check_chat_enabled'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
vscode.postMessage({
|
||||
command: 'getVscodeSetting',
|
||||
key: 'health_check_embs_enabled'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
vscode.postMessage({
|
||||
command: 'getVscodeSetting',
|
||||
key: 'health_check_tools_enabled'
|
||||
});
|
||||
}, 1000);
|
||||
}, []);
|
||||
|
||||
// Listen for messages from the extension
|
||||
|
|
@ -57,9 +93,29 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
const handleMessage = (event: MessageEvent) => {
|
||||
const message = event.data;
|
||||
if (message.command === 'vscodeSettingValue') {
|
||||
if (message.key === 'enabled') setIsCompletionsEnabled(message.value);
|
||||
else if (message.key === 'rag_enabled') setIsRagEnabled(message.value);
|
||||
else if (message.key === 'env_start_last_used') setIsAutoStartEnv(message.value);
|
||||
switch (message.key) {
|
||||
case 'health_check_compl_enabled':
|
||||
setIsHealthCheckComplEnabled(message.value);
|
||||
break;
|
||||
case 'health_check_chat_enabled':
|
||||
setIsHealthCheckChatEnabled(message.value);
|
||||
break;
|
||||
case 'health_check_embs_enabled':
|
||||
setIsHealthCheckEmbsEnabled(message.value);
|
||||
break;
|
||||
case 'health_check_tools_enabled':
|
||||
setIsHealthCheckToolsEnabled(message.value);
|
||||
break;
|
||||
case 'enabled':
|
||||
setIsCompletionsEnabled(message.value);
|
||||
break;
|
||||
case 'rag_enabled':
|
||||
setIsRagEnabled(message.value);
|
||||
break;
|
||||
case 'env_start_last_used':
|
||||
setIsAutoStartEnv(message.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -103,6 +159,14 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
});
|
||||
};
|
||||
|
||||
const handleHealthCheck = (model: string) => {
|
||||
vscode.postMessage({
|
||||
command: 'checkModelHealth',
|
||||
model
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const handleMoreChatModel = () => {
|
||||
vscode.postMessage({
|
||||
command: 'moreChatModel'
|
||||
|
|
@ -258,6 +322,16 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
</button>
|
||||
)}
|
||||
<span className="model-text">{currentCompletionModel}</span>
|
||||
{currentCompletionModel != noModelSelected && isHealthCheckComplEnabled && (
|
||||
<button
|
||||
onClick={()=>handleHealthCheck("completion")}
|
||||
title={`Check Health of Completion Model`}
|
||||
className="modern-btn secondary"
|
||||
style={{ color: currentCompletionModel.includes("Error") ? "red" : "green" }}
|
||||
>
|
||||
{currentCompletionModel.includes("Error") ? "X": "V"}
|
||||
</button>
|
||||
)}
|
||||
{currentCompletionModel === noModelSelected && (
|
||||
<button
|
||||
onClick={handleMoreCompletionModel}
|
||||
|
|
@ -300,6 +374,16 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
</button>
|
||||
)}
|
||||
<span className="model-text">{currentChatModel}</span>
|
||||
{currentChatModel != noModelSelected && isHealthCheckChatEnabled && (
|
||||
<button
|
||||
onClick={()=>handleHealthCheck("chat")}
|
||||
title={`Check Health of Chat Model`}
|
||||
className="modern-btn secondary"
|
||||
style={{ color: currentChatModel.includes("Error") ? "red" : "green" }}
|
||||
>
|
||||
{currentChatModel.includes("Error") ? "X": "V"}
|
||||
</button>
|
||||
)}
|
||||
{currentChatModel === noModelSelected && (
|
||||
<button
|
||||
onClick={handleMoreChatModel}
|
||||
|
|
@ -342,6 +426,16 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
</button>
|
||||
)}
|
||||
<span className="model-text">{currentEmbeddingsModel}</span>
|
||||
{currentEmbeddingsModel != noModelSelected && isHealthCheckEmbsEnabled && (
|
||||
<button
|
||||
onClick={()=>handleHealthCheck("embeddings")}
|
||||
title={`Check Health of Embeddings Model`}
|
||||
className="modern-btn secondary"
|
||||
style={{ color: currentEmbeddingsModel.includes("Error") ? "red" : "green" }}
|
||||
>
|
||||
{currentEmbeddingsModel.includes("Error") ? "X": "V"}
|
||||
</button>
|
||||
)}
|
||||
{currentEmbeddingsModel === noModelSelected && (
|
||||
<button
|
||||
onClick={handleMoreEmbeddingsModel}
|
||||
|
|
@ -385,6 +479,16 @@ const AddEnvView: React.FC<AddEnvViewProps> = ({
|
|||
</button>
|
||||
)}
|
||||
<span className="model-text">{currentToolsModel}</span>
|
||||
{currentToolsModel != noModelSelected && isHealthCheckToolsEnabled && (
|
||||
<button
|
||||
onClick={()=>handleHealthCheck("tools")}
|
||||
title={`Check Health of Tools Model`}
|
||||
className="modern-btn secondary"
|
||||
style={{ color: currentToolsModel.includes("Error") ? "red" : "green" }}
|
||||
>
|
||||
{currentToolsModel.includes("Error") ? "X": "V"}
|
||||
</button>
|
||||
)}
|
||||
{currentToolsModel === noModelSelected && (
|
||||
<button
|
||||
onClick={handleMoreToolsModel}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue