feat: 功能
This commit is contained in:
@@ -1,17 +1,32 @@
|
||||
import http from '@/api/http'
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source'
|
||||
import { getAuthHeader } from '@/utils/token-manager'
|
||||
import { API_BASE } from '@/api/config'
|
||||
import { getAuthHeader } from '@gold/utils/token-manager'
|
||||
// 使用公共配置和 API 服务创建器
|
||||
import { API_BASE } from '@gold/config/api'
|
||||
import { createApiService } from '@gold/api/services'
|
||||
// 初始化公共 hook 的 API 服务
|
||||
import { setApiService } from '@gold/hooks/web/useVoiceText'
|
||||
|
||||
// 使用本地代理前缀 /tikhub,开发环境通过 Vite 代理到 https://api.tikhub.io
|
||||
const SERVER_BASE = API_BASE.TIKHUB
|
||||
// 注意:API_BASE.TIKHUB 不存在,应该使用 TIKHUB_APP
|
||||
const SERVER_BASE = API_BASE.TIKHUB_APP || API_BASE.TIKHUB || ''
|
||||
|
||||
// 创建公共 API 服务实例
|
||||
const apiService = createApiService({
|
||||
http,
|
||||
getAuthHeader,
|
||||
baseUrl: SERVER_BASE,
|
||||
})
|
||||
|
||||
// 设置全局 API 服务(供 useVoiceText hook 使用)
|
||||
setApiService(apiService)
|
||||
|
||||
export const CommonService = {
|
||||
videoToCharacters(data) {
|
||||
return http.post(`${SERVER_BASE}/videoToCharacters2`, data)
|
||||
return apiService.videoToCharacters(data)
|
||||
},
|
||||
callWorkflow(data) {
|
||||
return http.post(`${SERVER_BASE}/callWorkflow`, data)
|
||||
return apiService.callWorkflow(data)
|
||||
},
|
||||
|
||||
// 流式调用 workflow
|
||||
|
||||
Reference in New Issue
Block a user