refactor: convert render module to StreamRenderer class

This commit is contained in:
mitchell 2026-04-16 16:15:38 -04:00
parent bcd9771cd5
commit 2ec00018bd
2 changed files with 71 additions and 69 deletions

View file

@ -2,10 +2,8 @@ import os from "node:os";
import { parseArgs } from "node:util";
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { type ModelMessage, streamText } from "ai";
import { renderStream } from "./src/render";
const home = os.homedir();
const convoFile = Bun.file(`${home}/.aicl_convo.json`);
import StreamRenderer from "./src/render";
const { values: args, positionals } = parseArgs({
args: Bun.argv,
@ -21,6 +19,9 @@ const { values: args, positionals } = parseArgs({
allowPositionals: true,
});
const home = os.homedir();
const convoFile = Bun.file(`${home}/.aicl_convo.json`);
async function main() {
const provider = createOpenAICompatible({
name: "llama.cpp",
@ -48,7 +49,7 @@ async function main() {
const start = Date.now();
const streamRender = renderStream(fullStream);
const streamRender = new StreamRenderer().renderStream(fullStream);
const [width] = process.stdout.getWindowSize();
const glow = Bun.spawn({