import axios from './config' // export const SERVER_URL = 'http://localhost:5000' export const SERVER_URL = (import.meta.env.MODE === 'development') ? '/api' : '/api' export const ASSET_URL = '/data' // 修改为本地路径 export default { getMockData(filename: string): Promise { return axios.get(`./mocks/${filename}.json`) }, getFileData(filename: string): Promise { return axios.get(`${ASSET_URL}/${filename}.json`) }, AIPPT_Outline( content: string, language: string, model: string, ): Promise { return fetch(`${SERVER_URL}/tools/aippt_outline`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ content, language, model, stream: true, }), }) }, AIPPT( content: string, language: string, model: string, ): Promise { return fetch(`${SERVER_URL}/tools/aippt`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ content, language, model, stream: true, }), }) }, // 用户认证 login(username: string, password: string): Promise { return axios.post(`${SERVER_URL}/auth/login`, { username, password }) }, verifyToken(): Promise { return axios.get(`${SERVER_URL}/auth/verify`) }, getUserInfo(): Promise { return axios.get(`${SERVER_URL}/auth/user`) }, // PPT管理 getPPTList(): Promise { return axios.get(`${SERVER_URL}/ppt/list`) }, getPPT(pptId: string): Promise { return axios.get(`${SERVER_URL}/ppt/${pptId}`) }, savePPT(pptData: any): Promise { return axios.post(`${SERVER_URL}/ppt/save`, pptData) }, createPPT(title: string): Promise { return axios.post(`${SERVER_URL}/ppt/create`, { title }) }, deletePPT(pptId: string): Promise { return axios.delete(`${SERVER_URL}/ppt/${pptId}`) }, copyPPT(pptId: string, title: string): Promise { return axios.post(`${SERVER_URL}/ppt/${pptId}/copy`, { title }) }, // 公共分享 generateShareLink(userId: string, pptId: string, slideIndex?: number): Promise { return axios.post(`${SERVER_URL}/public/generate-share-link`, { userId, pptId, slideIndex }) }, getPublicPPT(userId: string, pptId: string): Promise { return axios.get(`${SERVER_URL}/public/ppt/${userId}/${pptId}`) }, getPublicSlide(userId: string, pptId: string, slideIndex: number): Promise { return axios.get(`${SERVER_URL}/public/view/${userId}/${pptId}/${slideIndex}`) } }