refactor: convert render module to StreamRenderer class
This commit is contained in:
parent
bcd9771cd5
commit
2ec00018bd
2 changed files with 71 additions and 69 deletions
9
index.ts
9
index.ts
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue