chore: rename platform to channel

This commit is contained in:
Acbox
2026-02-06 20:01:04 +08:00
parent 208dda8956
commit 3bee018d45
8 changed files with 42 additions and 34 deletions
+10 -2
View File
@@ -17,7 +17,7 @@ const AgentModel = z.object({
skills: z.array(z.string()),
query: z.string(),
identity: IdentityContextModel,
attachments: z.array(AttachmentModel),
attachments: z.array(AttachmentModel).optional().default([]),
})
export const chatModule = new Elysia({ prefix: '/chat' })
@@ -42,7 +42,8 @@ export const chatModule = new Elysia({ prefix: '/chat' })
body: AgentModel,
})
.post('/stream', async function* ({ body, bearer }) {
const authFetcher = createAuthFetcher(bearer)
try {
const authFetcher = createAuthFetcher(bearer)
const { stream } = createAgent({
model: body.model as ModelConfig,
activeContextTime: body.activeContextTime,
@@ -59,6 +60,13 @@ export const chatModule = new Elysia({ prefix: '/chat' })
})) {
yield sse(JSON.stringify(action))
}
} catch (error) {
console.error(error)
yield sse(JSON.stringify({
type: 'error',
message: 'Internal server error',
}))
}
}, {
body: AgentModel,
})