|
@@ -69,7 +69,7 @@ function formatChapters(chapters: any[]) {
|
|
|
}
|
|
}
|
|
|
export async function genChapters(tools: LLMTools, major, title, desc) {
|
|
export async function genChapters(tools: LLMTools, major, title, desc) {
|
|
|
const pRetry = (await eval("import('p-retry')")).default
|
|
const pRetry = (await eval("import('p-retry')")).default
|
|
|
- const chapters = await pRetry(() => _genChapters(tools, major, title, desc), {
|
|
|
|
|
|
|
+ let chapters = await pRetry(() => _genChapters(tools, major, title, desc), {
|
|
|
retries: 5,
|
|
retries: 5,
|
|
|
onFailedAttempt: (e) => console.log(e.stack)
|
|
onFailedAttempt: (e) => console.log(e.stack)
|
|
|
})
|
|
})
|
|
@@ -79,5 +79,22 @@ export async function genChapters(tools: LLMTools, major, title, desc) {
|
|
|
// return pRetry(() => genSections(major, tools, title, desc, chapters, index), { retries: 5 })
|
|
// return pRetry(() => genSections(major, tools, title, desc, chapters, index), { retries: 5 })
|
|
|
// })
|
|
// })
|
|
|
// )
|
|
// )
|
|
|
- return formatChapters(chapters)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ chapters = formatChapters(chapters)
|
|
|
|
|
+
|
|
|
|
|
+ if (!chapters.find((i) => i.title.includes('参考文献'))) {
|
|
|
|
|
+ chapters.push({
|
|
|
|
|
+ title: '参考文献',
|
|
|
|
|
+ children: []
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!chapters.find((i) => i.title.includes('附录'))) {
|
|
|
|
|
+ chapters.push({
|
|
|
|
|
+ title: '附录',
|
|
|
|
|
+ children: []
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return chapters
|
|
|
}
|
|
}
|