change cursorAccent to cursor to match xtermjs. (#968)

also add more feedback for waveai -- tooltips + icon for local/cloud.
also use 'ai:name' correctly
This commit is contained in:
Mike Sawka 2024-10-06 12:42:25 -07:00 committed by GitHub
parent 1bd2fe83cb
commit b490113a87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 42 additions and 13 deletions

View File

@ -110,18 +110,47 @@ export class WaveAiModel implements ViewModel {
set(this.updateLastMessageAtom, "", false);
});
this.viewText = atom((get) => {
const viewTextChildren: HeaderElem[] = [];
const settings = get(atoms.settingsAtom);
const isCloud = isBlank(settings?.["ai:apitoken"]) && isBlank(settings?.["ai:baseurl"]);
let modelText = "gpt-4o-mini";
if (!isCloud && !isBlank(settings?.["ai:model"])) {
if (!isBlank(settings?.["ai:name"])) {
modelText = settings["ai:name"];
} else {
modelText = settings["ai:model"];
}
const viewTextChildren: HeaderElem[] = [
{
}
if (isCloud) {
viewTextChildren.push({
elemtype: "iconbutton",
icon: "cloud",
title: "Using Wave's AI Proxy (gpt-4o-mini)",
disabled: true,
});
} else {
const baseUrl = settings["ai:baseurl"] ?? "OpenAI Default Endpoint";
const modelName = settings["ai:model"];
if (baseUrl.startsWith("http://localhost") || baseUrl.startsWith("http://127.0.0.1")) {
viewTextChildren.push({
elemtype: "iconbutton",
icon: "location-dot",
title: "Using Local Model @ " + baseUrl + " (" + modelName + ")",
disabled: true,
});
} else {
viewTextChildren.push({
elemtype: "iconbutton",
icon: "globe",
title: "Using Remote Model @ " + baseUrl + " (" + modelName + ")",
disabled: true,
});
}
}
viewTextChildren.push({
elemtype: "text",
text: modelText,
},
];
});
return viewTextChildren;
});
}

View File

@ -515,7 +515,7 @@ declare global {
foreground: string;
selectionBackground: string;
background: string;
cursorAccent: string;
cursor: string;
};
// wshrpc.TimeSeriesData

View File

@ -23,7 +23,7 @@
"foreground": "#c1c1c1",
"selectionBackground": "",
"background": "#00000077",
"cursorAccent": ""
"cursor": ""
},
"dracula": {
"display:name": "Dracula",
@ -49,7 +49,7 @@
"foreground": "#F8F8F2",
"selectionBackground": "#44475a",
"background": "#282a36",
"cursorAccent": "#f8f8f2"
"cursor": "#f8f8f2"
},
"monokai": {
"display:name": "Monokai",
@ -75,7 +75,7 @@
"foreground": "#F8F8F2",
"selectionBackground": "#49483E",
"background": "#272822",
"cursorAccent": "#F8F8F2"
"cursor": "#F8F8F2"
},
"campbell": {
"display:name": "Campbell",
@ -101,6 +101,6 @@
"foreground": "#CCCCCC",
"selectionBackground": "#3A96DD",
"background": "#0C0C0C",
"cursorAccent": "#CCCCCC"
"cursor": "#CCCCCC"
}
}

View File

@ -392,5 +392,5 @@ type TermThemeType struct {
Foreground string `json:"foreground"`
SelectionBackground string `json:"selectionBackground"`
Background string `json:"background"`
CursorAccent string `json:"cursorAccent"`
Cursor string `json:"cursor"`
}