fix: update pi-ai/pi-tui usage

This commit is contained in:
Peter Steinberger
2026-01-20 16:37:57 +00:00
parent 842be7b864
commit 8bf484bdad
3 changed files with 5 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import type { Api, Model, OpenAICompletionsCompat } from "@mariozechner/pi-ai";
import type { Api, Model, OpenAICompat } from "@mariozechner/pi-ai";
function isOpenAiCompletionsModel(model: Model<Api>): model is Model<"openai-completions"> {
return model.api === "openai-completions";
@@ -10,7 +10,7 @@ export function normalizeModelCompat(model: Model<Api>): Model<Api> {
if (!isZai || !isOpenAiCompletionsModel(model)) return model;
const openaiModel = model as Model<"openai-completions">;
const compat = openaiModel.compat as OpenAICompletionsCompat | undefined;
const compat = openaiModel.compat as OpenAICompat | undefined;
if (compat?.supportsDeveloperRole === false) return model;
openaiModel.compat = compat

View File

@@ -1,10 +1,8 @@
import {
Editor,
type EditorOptions,
type EditorTheme,
Key,
matchesKey,
type TUI,
} from "@mariozechner/pi-tui";
export class CustomEditor extends Editor {
@@ -19,8 +17,8 @@ export class CustomEditor extends Editor {
onShiftTab?: () => void;
onAltEnter?: () => void;
constructor(tui: TUI, theme: EditorTheme, options?: EditorOptions) {
super(tui, theme, options);
constructor(theme: EditorTheme) {
super(theme);
}
handleInput(data: string): void {
if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {

View File

@@ -193,7 +193,7 @@ export async function runTui(opts: TuiOptions) {
const statusContainer = new Container();
const footer = new Text("", 1, 0);
const chatLog = new ChatLog();
const editor = new CustomEditor(tui, editorTheme);
const editor = new CustomEditor(editorTheme);
const root = new Container();
root.addChild(header);
root.addChild(chatLog);