mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Clean up assertions in summary job
This commit is contained in:
parent
6924b9c462
commit
6861d271bd
1 changed files with 9 additions and 4 deletions
|
|
@ -28,7 +28,9 @@ export const aiSummarize = async (jobData: AISummarizeJobData) => {
|
|||
)
|
||||
if (!libraryItem || libraryItem.state !== LibraryItemState.Succeeded) {
|
||||
logger.info(
|
||||
`Not ready to summarize library item job state: ${libraryItem?.state}`
|
||||
`Not ready to summarize library item job state: ${
|
||||
libraryItem?.state ?? 'null'
|
||||
}`
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
@ -52,10 +54,13 @@ export const aiSummarize = async (jobData: AISummarizeJobData) => {
|
|||
input_documents: docs,
|
||||
})
|
||||
|
||||
const summary = response.text
|
||||
console.log('SUMMARY: ', summary)
|
||||
if (typeof response.text !== 'string') {
|
||||
logger.error(`AI summary did not return text`)
|
||||
return
|
||||
}
|
||||
|
||||
const aiSummary = await authTrx(
|
||||
const summary = response.text
|
||||
const _ = await authTrx(
|
||||
async (t) => {
|
||||
return t.getRepository(AISummary).save({
|
||||
user: { id: jobData.userId },
|
||||
|
|
|
|||
Loading…
Reference in a new issue