Improve logging.
This commit is contained in:
parent
ba61f6b0cf
commit
0172b20207
2 changed files with 4 additions and 2 deletions
|
@ -14,6 +14,7 @@ export class History {
|
|||
}
|
||||
|
||||
public static async load(path: string, limit: number) {
|
||||
console.log("Loading history from", path)
|
||||
try {
|
||||
const content = await Deno.readTextFile(path)
|
||||
const { messages } = JSON.parse(content)
|
||||
|
@ -25,6 +26,7 @@ export class History {
|
|||
}
|
||||
|
||||
public static async create(path: string, limit: number) {
|
||||
console.log("Creating history at", path)
|
||||
const result = new History([], path, limit)
|
||||
await result.save()
|
||||
return result
|
||||
|
|
|
@ -24,14 +24,14 @@ export async function session(conn: Deno.TcpConn, name: string, history: History
|
|||
for await (const line of lines) {
|
||||
if (line === "") continue
|
||||
if (line.length > 10_000) return
|
||||
console.log("user", conn.remoteAddr.hostname, "promoted", line)
|
||||
console.log("user", conn.remoteAddr.hostname, "prompted", line)
|
||||
if (line.startsWith("/nick ")) {
|
||||
name = line.slice("/nick ".length)
|
||||
console.log("Changed name of", conn.remoteAddr.hostname, "to", name)
|
||||
await write_encoded(conn, "\n> ")
|
||||
continue
|
||||
}
|
||||
await write_encoded(conn, "\n[kub] ")
|
||||
await write_encoded(conn, "\n[kub]\n")
|
||||
const user_message = make_message(name, line)
|
||||
const response_parts = await get_response_parts(history, user_message)
|
||||
let content = "", role = "assistant"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue