mirror of
https://github.com/pionxzh/chatgpt-exporter.git
synced 2026-09-21 13:37:42 -05:00
@@ -1,5 +1,5 @@
|
||||
import urlcat from 'urlcat'
|
||||
import { baseUrl } from './constants'
|
||||
import { apiUrl, baseUrl } from './constants'
|
||||
import { getChatIdFromUrl } from './page'
|
||||
|
||||
interface ApiSession {
|
||||
@@ -113,8 +113,6 @@ export interface ApiConversations {
|
||||
total: number
|
||||
}
|
||||
|
||||
const apiUrl = `${baseUrl}/backend-api`
|
||||
|
||||
const sessionApi = urlcat(baseUrl, '/api/auth/session')
|
||||
const conversationApi = (id: string) => urlcat(apiUrl, '/conversation/:id', { id })
|
||||
const conversationsApi = (offset: number, limit: number) => urlcat(apiUrl, '/conversations', { offset, limit })
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
export const baseUrl = 'https://chat.openai.com'
|
||||
const API_MAPPING: Record<string, string> = {
|
||||
'https://chat.openai.com': 'https://chat.openai.com/backend-api',
|
||||
'https://chat.zhile.io': 'https://chat-api.zhile.io/api',
|
||||
}
|
||||
|
||||
// export const baseUrl = 'https://chat.openai.com'
|
||||
export const baseUrl = new URL(location.href).origin
|
||||
export const apiUrl = API_MAPPING[baseUrl]
|
||||
|
||||
export const LEGACY_KEY_FILENAME_FORMAT = 'exporter-format'
|
||||
export const KEY_LANGUAGE = 'exporter:language'
|
||||
|
||||
@@ -36,6 +36,10 @@ export default defineConfig({
|
||||
'https://chat.openai.com/?model=*',
|
||||
// support https://chat.openai.com/c/123456789
|
||||
'https://chat.openai.com/c/*',
|
||||
|
||||
'https://chat.zhile.io/',
|
||||
'https://chat.zhile.io/?model=*',
|
||||
'https://chat.zhile.io/c/*',
|
||||
],
|
||||
'icon': 'https://chat.openai.com/favicon.ico',
|
||||
'run-at': 'document-end',
|
||||
|
||||
Reference in New Issue
Block a user