forked from hunkimForks/chatgpt-arxiv-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.ts
32 lines (28 loc) · 820 Bytes
/
api.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { getExtensionVersion } from './utils'
const API_HOST = 'https://chatgpt4google.com'
// const API_HOST = 'http://localhost:3000'
export interface PromotionResponse {
url: string
title?: string
text?: string
image?: { url: string; size?: number }
footer?: { text: string; url: string }
label?: { text: string; url: string }
}
export async function fetchPromotion(): Promise<PromotionResponse | null> {
return fetch(`${API_HOST}/api/p`, {
headers: {
'x-version': getExtensionVersion(),
},
}).then((r) => r.json())
}
export async function fetchExtensionConfigs(): Promise<{
chatgpt_webapp_model_name: string
openai_model_names: string[]
}> {
return fetch(`${API_HOST}/api/config`, {
headers: {
'x-version': getExtensionVersion(),
},
}).then((r) => r.json())
}