mirror of
https://github.com/ArthurDanjou/artagents.git
synced 2026-01-14 20:19:33 +01:00
- Introduced new API endpoints for chat management including posting and retrieving chat messages. - Implemented file upload and deletion functionalities for chat and other files. - Added utility functions for streaming text and loading chat data. - Created TypeScript types for models and agents used in the application. - Configured TypeScript settings for server and project. - Added favicon and workspace configuration for pnpm.
14 lines
326 B
TypeScript
14 lines
326 B
TypeScript
export async function streamToText(stream: ReadableStream<Uint8Array>) {
|
|
const reader = stream.getReader()
|
|
const decoder = new TextDecoder()
|
|
let result = ''
|
|
|
|
while (true) {
|
|
const { done, value } = await reader.read()
|
|
if (done) break
|
|
result += decoder.decode(value, { stream: true })
|
|
}
|
|
|
|
return result
|
|
}
|