Skip to content

Commit

Permalink
fix: ocr incorrect when no queue enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
oott123 committed Oct 24, 2021
1 parent 1bcc2f0 commit 355129c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 2 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

- [x] MeiliSearch 单条消息添加索引效率似乎十分不佳。需要有个打包机制,满 100 条或者 60 秒打包提交一次之类的。
- [x] 如果有打包提交机制,那就需要有 graceful 退出,或者缓存
- [ ] 支持 OCR 图片搜索
- [x] 支持 OCR 图片搜索
- [ ] 支持图片归档到 S3
- [ ] 支持多条记录合并上下文搜索,应对说话喜欢换行的人
- [ ] 为没有头像的人生成基于名字的默认头像
- [ ] 配置消息队列分批大小和超时
Expand Down
16 changes: 7 additions & 9 deletions src/bot/bot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,16 @@ export class BotService {
timestamp: msg.date * 1000,
}

if (msg?.photo?.length) {
await this.handlePhoto(msg.photo, baseMessage)
if (searchable) {
await this.index.queueMessage({
...baseMessage,
text: searchable,
})
}

if (!searchable) {
return
if (msg?.photo?.length) {
await this.handlePhoto(msg.photo, baseMessage)
}

await this.index.queueMessage({
...baseMessage,
text: searchable,
})
}

private async handlePhoto(
Expand Down

0 comments on commit 355129c

Please sign in to comment.