MCPcopy Create free account
hub / github.com/dabit3/react-native-ai / getEventSource

Function getEventSource

app/src/utils.ts:5–24  ·  view source on GitHub ↗
({
  headers,
  body,
  type
} : {
  headers?: any,
  body: any,
  type: string
})

Source from the content-addressed store, hash-verified

3import { Model, Provider } from '../types'
4
5const PROVIDER_ROUTES: Record<Provider, string> = {
6 anthropic: 'claude',
7 openai: 'gpt',
8 google: 'gemini',
9 zai: 'glm',
10 moonshot: 'kimi'
11}
12
13export function getChatRoute(model: Model): string {
14 return PROVIDER_ROUTES[model.provider] || 'claude'
15}
16
17export 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: {

Callers 3

generateGptResponseFunction · 0.90
generateGeminiResponseFunction · 0.90
generateClaudeResponseFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected