refactor(entries): simplify stdin reading with node:stream/consumers
This commit is contained in:
parent
19272bc0b4
commit
7652e62d47
2 changed files with 6 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
import consumers from "node:stream/consumers";
|
||||
import util from "node:util";
|
||||
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
||||
import { streamText } from "ai";
|
||||
|
|
@ -72,8 +73,10 @@ async function main() {
|
|||
if (modelFlag) convo.model = modelFlag;
|
||||
}
|
||||
|
||||
let input = positionals.join(" ").trim();
|
||||
if (input === "-") input = await consumers.text(process.stdin);
|
||||
|
||||
let prompt = "Introduce yourself.";
|
||||
const input = positionals.join(" ").trim();
|
||||
if (messageFlag) prompt = Prompts.commit(input);
|
||||
else if (reviewFlag) prompt = Prompts.review(input);
|
||||
else if (input) prompt = input;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue