@victor-software-house/pi-openai-proxy 0.2.0 → 0.2.1
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/extensions/proxy.ts +33 -28
- package/package.json +1 -1
package/extensions/proxy.ts
CHANGED
|
@@ -483,42 +483,47 @@ export default function proxyExtension(pi: ExtensionAPI): void {
|
|
|
483
483
|
|
|
484
484
|
await ctx.ui.custom<void>(
|
|
485
485
|
(tui, theme, _kb, done) => {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
486
|
+
function build(): { container: Container; settingsList: SettingsList } {
|
|
487
|
+
const container = new Container();
|
|
488
|
+
container.addChild(new Text(theme.fg("accent", theme.bold("Proxy Settings")), 1, 0));
|
|
489
|
+
container.addChild(new Text(theme.fg("dim", getConfigPath()), 1, 0));
|
|
490
|
+
|
|
491
|
+
const settingsList = new SettingsList(
|
|
492
|
+
buildSettingItems(),
|
|
493
|
+
10,
|
|
494
|
+
getSettingsListTheme(),
|
|
495
|
+
(id, newValue) => {
|
|
496
|
+
applySetting(id, newValue);
|
|
497
|
+
current = build();
|
|
498
|
+
tui.requestRender();
|
|
499
|
+
},
|
|
500
|
+
() => done(undefined),
|
|
501
|
+
{ enableSearch: true },
|
|
502
|
+
);
|
|
503
|
+
|
|
504
|
+
container.addChild(settingsList);
|
|
505
|
+
container.addChild(
|
|
506
|
+
new Text(
|
|
507
|
+
theme.fg("dim", "Esc: close | Arrow keys: navigate | Space: toggle | Restart proxy to apply"),
|
|
508
|
+
1,
|
|
509
|
+
0,
|
|
510
|
+
),
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
return { container, settingsList };
|
|
514
|
+
}
|
|
503
515
|
|
|
504
|
-
|
|
505
|
-
container.addChild(
|
|
506
|
-
new Text(
|
|
507
|
-
theme.fg("dim", "Esc: close | Arrow keys: navigate | Space: toggle | Restart proxy to apply"),
|
|
508
|
-
1,
|
|
509
|
-
0,
|
|
510
|
-
),
|
|
511
|
-
);
|
|
516
|
+
let current = build();
|
|
512
517
|
|
|
513
518
|
return {
|
|
514
519
|
render(width: number): string[] {
|
|
515
|
-
return container.render(width);
|
|
520
|
+
return current.container.render(width);
|
|
516
521
|
},
|
|
517
522
|
invalidate(): void {
|
|
518
|
-
container.invalidate();
|
|
523
|
+
current.container.invalidate();
|
|
519
524
|
},
|
|
520
525
|
handleInput(data: string): void {
|
|
521
|
-
settingsList.handleInput?.(data);
|
|
526
|
+
current.settingsList.handleInput?.(data);
|
|
522
527
|
tui.requestRender();
|
|
523
528
|
},
|
|
524
529
|
};
|