mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
fix: 暂时切换AI服务到doubao-1.5-pro
This commit is contained in:
parent
95c86924b0
commit
9f40217183
@ -217,6 +217,13 @@ export default () => {
|
|||||||
if (match) return match[1].trim()
|
if (match) return match[1].trim()
|
||||||
return content.replace('```markdown', '').replace('```', '')
|
return content.replace('```markdown', '').replace('```', '')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getJSONContent = (content: string) => {
|
||||||
|
const regex = /```json([^```]*)```/
|
||||||
|
const match = content.match(regex)
|
||||||
|
if (match) return match[1].trim()
|
||||||
|
return content.replace('```json', '').replace('```', '')
|
||||||
|
}
|
||||||
|
|
||||||
const AIPPT = (templateSlides: Slide[], _AISlides: AIPPTSlide[], imgs?: PexelsImage[]) => {
|
const AIPPT = (templateSlides: Slide[], _AISlides: AIPPTSlide[], imgs?: PexelsImage[]) => {
|
||||||
if (imgs) imgPool.value = imgs
|
if (imgs) imgPool.value = imgs
|
||||||
@ -480,5 +487,6 @@ export default () => {
|
|||||||
return {
|
return {
|
||||||
AIPPT,
|
AIPPT,
|
||||||
getMdContent,
|
getMdContent,
|
||||||
|
getJSONContent,
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,7 +12,11 @@ export default {
|
|||||||
return axios.get(`${ASSET_URL}/data/${filename}.json`)
|
return axios.get(`${ASSET_URL}/data/${filename}.json`)
|
||||||
},
|
},
|
||||||
|
|
||||||
AIPPT_Outline(content: string, language: string): Promise<any> {
|
AIPPT_Outline(
|
||||||
|
content: string,
|
||||||
|
language: string,
|
||||||
|
model = 'doubao-1.5-pro-32k'
|
||||||
|
): Promise<any> {
|
||||||
return fetch(`${SERVER_URL}/tools/aippt_outline`, {
|
return fetch(`${SERVER_URL}/tools/aippt_outline`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -21,12 +25,21 @@ export default {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
content,
|
content,
|
||||||
language,
|
language,
|
||||||
|
model,
|
||||||
stream: true,
|
stream: true,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
AIPPT(content: string, language: string) {
|
AIPPT(
|
||||||
return axios.post(`${SERVER_URL}/tools/aippt`, { content, language })
|
content: string,
|
||||||
|
language: string,
|
||||||
|
model = 'doubao-1.5-pro-32k'
|
||||||
|
) {
|
||||||
|
return axios.post(`${SERVER_URL}/tools/aippt`, {
|
||||||
|
content,
|
||||||
|
language,
|
||||||
|
model,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
@ -68,7 +68,7 @@ import FullscreenSpin from '@/components/FullscreenSpin.vue'
|
|||||||
|
|
||||||
const mainStore = useMainStore()
|
const mainStore = useMainStore()
|
||||||
const { templates } = storeToRefs(useSlidesStore())
|
const { templates } = storeToRefs(useSlidesStore())
|
||||||
const { AIPPT } = useAIPPT()
|
const { AIPPT, getJSONContent } = useAIPPT()
|
||||||
|
|
||||||
const language = ref<'zh' | 'en'>('zh')
|
const language = ref<'zh' | 'en'>('zh')
|
||||||
const keyword = ref('')
|
const keyword = ref('')
|
||||||
@ -137,7 +137,7 @@ const createPPT = async () => {
|
|||||||
|
|
||||||
// const AISlides: AIPPTSlide[] = await api.getMockData('AIPPT')
|
// const AISlides: AIPPTSlide[] = await api.getMockData('AIPPT')
|
||||||
const AISlides: AIPPTSlide[] = await api.AIPPT(outline.value, language.value).then(ret => {
|
const AISlides: AIPPTSlide[] = await api.AIPPT(outline.value, language.value).then(ret => {
|
||||||
const obj = JSON.parse(ret.data[0].content)
|
const obj = JSON.parse(getJSONContent(ret.data[0].content))
|
||||||
return obj.data
|
return obj.data
|
||||||
})
|
})
|
||||||
const templateSlides: Slide[] = await api.getFileData(selectedTemplate.value).then(ret => ret.slides)
|
const templateSlides: Slide[] = await api.getFileData(selectedTemplate.value).then(ret => ret.slides)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user