Skip to content

Commit

Permalink
Fix #55: prevent crashing if no response is returned when finding ent…
Browse files Browse the repository at this point in the history
…ities
  • Loading branch information
NickSavage committed Jan 4, 2025
1 parent 29569f0 commit edc2d73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion go-backend/llms/embeddings.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func ProcessQueue(c *models.LLMClient) {
}
continue
}
log.Printf("mainembeddings %v", request.Chunk)
err = StoreEmbeddings(
c.EmbeddingQueue.DB,
request.UserID,
Expand Down
3 changes: 3 additions & 0 deletions go-backend/llms/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Return only valid JSON matching the specified structure.`
log.Printf("error getting completion: %v", err)
return []models.Entity{}, err
}
if len(resp.Choices) == 0 {
continue
}
content := resp.Choices[0].Message.Content
content = strings.TrimPrefix(content, "```json")
content = strings.TrimSuffix(content, "```")
Expand Down

0 comments on commit edc2d73

Please sign in to comment.