Function
writeJson
(res: ServerResponse, status: number, body: unknown)
Source from the content-addressed store, hash-verified
| 100 | } |
| 101 | |
| 102 | function writeJson(res: ServerResponse, status: number, body: unknown): void { |
| 103 | const text = JSON.stringify(body); |
| 104 | res.writeHead(status, { |
| 105 | "Content-Type": "application/json", |
| 106 | "Content-Length": Buffer.byteLength(text), |
| 107 | }); |
| 108 | res.end(text); |
| 109 | } |
| 110 | |
| 111 | function chatCompletion(model: string, content: string): Record<string, unknown> { |
| 112 | return { |
Tested by
no test coverage detected