@monotykamary/pi-better-openai 0.1.31 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +19 -3
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -96,6 +96,20 @@ const requireSettingsListTheme = (): SettingsListTheme => {
|
|
|
96
96
|
return loadedSettingsListTheme;
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
+
class DynamicBorder {
|
|
100
|
+
readonly #color: (text: string) => string;
|
|
101
|
+
|
|
102
|
+
constructor(color: (text: string) => string = (str) => str) {
|
|
103
|
+
this.#color = color;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
invalidate(): void {}
|
|
107
|
+
|
|
108
|
+
render(width: number): string[] {
|
|
109
|
+
return [this.#color("\u2500".repeat(Math.max(1, width)))];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
99
113
|
const COMMAND = "fast";
|
|
100
114
|
const OPENAI_STATUS_COMMAND = "openai-usage";
|
|
101
115
|
const OPENAI_SETTINGS_COMMAND = "openai-settings";
|
|
@@ -452,7 +466,7 @@ export default function betterOpenAI(pi: ExtensionAPI): void {
|
|
|
452
466
|
const current = currentItems();
|
|
453
467
|
const selected = selectedItem();
|
|
454
468
|
if (!closed) options?.onSelection?.(selected);
|
|
455
|
-
const lines = [title, "", `> ${searchQuery}`, ""];
|
|
469
|
+
const lines = [theme.label(title, true), "", `> ${searchQuery}`, ""];
|
|
456
470
|
const maxVisible = 8;
|
|
457
471
|
const startIndex = Math.max(
|
|
458
472
|
0,
|
|
@@ -843,13 +857,14 @@ export default function betterOpenAI(pi: ExtensionAPI): void {
|
|
|
843
857
|
await ctx.ui.custom((tui, theme, _kb, done) => {
|
|
844
858
|
petController.setSettingsRenderRequest(() => tui.requestRender());
|
|
845
859
|
const container = new Container();
|
|
860
|
+
container.addChild(new DynamicBorder((text) => theme.fg("border", text)));
|
|
846
861
|
container.addChild(
|
|
847
862
|
new (class {
|
|
848
863
|
render(_width: number) {
|
|
849
864
|
const cfg = config(ctx);
|
|
850
865
|
return [
|
|
851
|
-
theme.fg("accent",
|
|
852
|
-
theme.fg("
|
|
866
|
+
theme.bold(theme.fg("accent", "Better OpenAI Settings")),
|
|
867
|
+
theme.fg("muted", cfg.configPath),
|
|
853
868
|
"",
|
|
854
869
|
];
|
|
855
870
|
}
|
|
@@ -873,6 +888,7 @@ export default function betterOpenAI(pi: ExtensionAPI): void {
|
|
|
873
888
|
{ enableSearch: true },
|
|
874
889
|
);
|
|
875
890
|
container.addChild(settingsList);
|
|
891
|
+
container.addChild(new DynamicBorder((text) => theme.fg("border", text)));
|
|
876
892
|
return {
|
|
877
893
|
render(width: number) {
|
|
878
894
|
return container.render(width);
|
package/package.json
CHANGED