mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import axios from './config'
|
|
|
|
// export const SERVER_URL = 'http://localhost:5000'
|
|
export const SERVER_URL = (import.meta.env.MODE === 'development') ? '/api' : 'https://server.pptist.cn'
|
|
export const ASSET_URL = 'https://asset.pptist.cn'
|
|
|
|
export default {
|
|
getMockData(filename: string): Promise<any> {
|
|
return axios.get(`./mocks/${filename}.json`)
|
|
},
|
|
|
|
getFileData(filename: string): Promise<any> {
|
|
return axios.get(`${ASSET_URL}/data/${filename}.json`)
|
|
},
|
|
|
|
AIPPT_Outline(
|
|
content: string,
|
|
language: string,
|
|
model: string,
|
|
): Promise<any> {
|
|
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<any> {
|
|
return fetch(`${SERVER_URL}/tools/aippt`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
content,
|
|
language,
|
|
model,
|
|
stream: true,
|
|
}),
|
|
})
|
|
},
|
|
} |