({
headers,
body,
type
} : {
headers?: any,
body: any,
type: string
})
| 3 | import { Model, Provider } from '../types' |
| 4 | |
| 5 | const PROVIDER_ROUTES: Record<Provider, string> = { |
| 6 | anthropic: 'claude', |
| 7 | openai: 'gpt', |
| 8 | google: 'gemini', |
| 9 | zai: 'glm', |
| 10 | moonshot: 'kimi' |
| 11 | } |
| 12 | |
| 13 | export function getChatRoute(model: Model): string { |
| 14 | return PROVIDER_ROUTES[model.provider] || 'claude' |
| 15 | } |
| 16 | |
| 17 | export function getEventSource({ |
| 18 | headers, |
| 19 | body, |
| 20 | type |
| 21 | } : { |
| 22 | headers?: Record<string, string>, |
| 23 | body: object, |
| 24 | type: string |
| 25 | }) { |
| 26 | const es = new EventSource(`${DOMAIN}/chat/${type}`, { |
| 27 | headers: { |
no outgoing calls
no test coverage detected