blob: bb7522cbbd9d7de7fb0bc5dbfde28a7d4659aec5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { hc } from "hono/client";
import type { Server } from "../src/server/server";
const message = process.argv.slice(2).join(" ");
console.log(message);
const client = hc<Server.App>(`http://localhost:16713`);
const session = await client.session_create.$post().then((res) => res.json());
const result = await client.session_chat
.$post({
json: {
sessionID: session.id,
parts: [
{
type: "text",
text: message,
},
],
},
})
.then((res) => res.json());
for (const part of result.parts) {
if (part.type === "text") {
console.log(part.text);
}
}
|