mirror of
https://github.com/ggml-org/llama.vscode.git
synced 2026-05-07 01:15:23 +00:00
Compare commits
1 commit
master
...
refactor_m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2535f5653e |
3 changed files with 6 additions and 20 deletions
|
|
@ -29,6 +29,8 @@ export class LlamaAgent {
|
|||
this.resetMessages();
|
||||
}
|
||||
|
||||
getAgentLogText = () => this.logText;
|
||||
|
||||
resetMessages = () => {
|
||||
let systemPromt = this.app.prompts.TOOLS_SYSTEM_PROMPT_ACTION;
|
||||
if (this.app.menu.isAgentSelected()) systemPromt = this.app.menu.getAgent().systemInstruction.join("\n")
|
||||
|
|
@ -66,7 +68,7 @@ export class LlamaAgent {
|
|||
this.messages = chat.messages??[];
|
||||
this.logText = chat.log??"";
|
||||
}
|
||||
this.app.llamaWebviewProvider.logInUi(this.logText);
|
||||
// this.app.llamaWebviewProvider.logInUi(this.logText);
|
||||
this.resetContextProjectFiles();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
|
|||
this.updateAgent();
|
||||
this.updateEnv();
|
||||
this.updateSettingsInView();
|
||||
this.logInUi(this.app.llamaAgent.getAgentLogText())
|
||||
}
|
||||
|
||||
public updateContextFilesInfo() {
|
||||
|
|
|
|||
|
|
@ -142,9 +142,6 @@ export class ModelService {
|
|||
["launch_tools", "endpoint_tools"]
|
||||
]);
|
||||
|
||||
// for (let mdl of PREDEFINED_LISTS.get(type) as LlmModel[]){
|
||||
// modelsItems.push({ label: (modelsItems.length + 1) + ". (predefined) " + mdl.name, description: mdl.localStartCommand ?? "" });
|
||||
// }
|
||||
modelsItems.push({ label: (modelsItems.length + 1) + ". Use settings", description: "" });
|
||||
|
||||
const selectedModelItem = await vscode.window.showQuickPick(modelsItems);
|
||||
|
|
@ -167,17 +164,6 @@ export class ModelService {
|
|||
model = allModels[index];
|
||||
}
|
||||
|
||||
// if (parseInt(selectedModelItem.label.split(". ")[0], 10) == modelsItems.length) {
|
||||
// model = {
|
||||
// name: "Use settings",
|
||||
// isKeyRequired: false,
|
||||
// endpoint: this.app.configuration[launchToEndpoint.get(details.launchSettingName) as keyof Configuration] as string,
|
||||
// localStartCommand: this.app.configuration[details.launchSettingName as keyof Configuration ] as string
|
||||
// } as LlmModel;
|
||||
// } else {
|
||||
// const index = parseInt(selectedModelItem.label.split(". ")[0], 10) - 1;
|
||||
// model = allModels[index] as LlmModel;
|
||||
// }
|
||||
await this.selectStartModel(model, type, details);
|
||||
|
||||
return model;
|
||||
|
|
@ -378,14 +364,11 @@ export class ModelService {
|
|||
|
||||
sanitizeCommand = (command: string): string => {
|
||||
if (!command) return '';
|
||||
return command.trim().replace(/[`#$&*;\<>\?\\|~!{}()[\]^"]/g, '\\$&');
|
||||
// TODO Consider escaping some chars: return command.trim().replace(/[`#$\<>\?\\|!{}()[\]^"]/g, '\\$&');
|
||||
return command.trim();
|
||||
}
|
||||
|
||||
public sanitizeInput(input: string): string {
|
||||
return input ? input.trim() : '';
|
||||
}
|
||||
|
||||
// For selectModel, adjust to return model
|
||||
// In the code above, I have return model; at the end of if.
|
||||
// Yes.
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue