[BUG] /chat/findMessages ignores where.key.fromMe when value is false
維護者通常 4 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 76/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- postgresql, typescript
研究方向
從 src/api/services/channel.service.ts 中的 fetchMessages 開始。issue 指出,count 和 findMany 查詢會捨棄 false 篩選條件。閱讀這些查詢條件,並檢查是否有涵蓋 where.key.fromMe 的測試;完成標準是兩個查詢在其值為 false 時都套用該篩選條件,而且端點只回傳收到的訊息。
由索引模型根據 Issue 內容生成。
描述
Welcome!
- Yes, I have searched for similar issues on GitHub and found none.
Related: #1797 reported this same bug and was closed as completed on 2025-09-09, but no fix was merged. The code is unchanged on main, develop and 2.4.0-rc2.
What did you do?
Called POST /chat/findMessages/{instance} to get only received messages:
{
"where": {
"key": {
"fromMe": false
}
}
}
What did you expect?
Only messages with key.fromMe === false are returned.
What did you observe instead of what you expected?
The filter is ignored. The response has every message of the instance (total is the full count, and records include fromMe: true). fromMe: true works.
Cause, in src/api/services/channel.service.ts (fetchMessages, both the count and the findMany query):
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
false is falsy, so the condition becomes {} and the filter is dropped. Suggested fix:
keyFilters?.fromMe !== undefined ? { key: { path: ['fromMe'], equals: keyFilters.fromMe } } : {},
Checked on a real instance: the API returns 48569 records with fromMe: false, while the database has 39762 rows where key->>'fromMe' = 'false'.
Which version of the API are you using?
2.1.1. Same code on main (2.3.7), develop and 2.4.0-rc2 (lines 627 and 651).
What is your environment?
Docker
Other environment specifications
Image evoapicloud/evolution-api:v2.1.1, PostgreSQL 16.
Additional Notes
Workaround until fixed: query the Message table directly, or filter on the client side.
- 主要語言
- TypeScript
- 星號
- 10.2k
- 分支
- 7.5k
- 平均合併
- 6 天 19 小時
- 30 天內合併 PR
- 4
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
evolution-foundation/evolution-api 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
evolution-foundation/evolution-api#2795 ·
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
evolution-foundation/evolution-api#2782 ·
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
evolution-foundation/evolution-api#2723 ·
維護者通常 4 天內回覆
-
難度 1/5 1-3 小時 新手友好度 88/100
evolution-foundation/evolution-api#2704 ·
維護者通常 4 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
evolution-foundation/evolution-api#2702 · 3 則留言 · 3 個 reaction ·
維護者通常 4 天內回覆
查看 evolution-foundation/evolution-api 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
abhigyanpatwari/GitNexus#4124 ·
維護者通常 1 天內回覆
-
good first issue
難度 2/5 1-3 小時 新手友好度 72/100
laaielichter/Godotwright#250 ·
維護者通常 1 天內回覆
-
An Antigravity tab can quote an old Assist message as the owner's words in a resumed conversation未關閉
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
-
Retry an empty final answer when Gemini reports MALFORMED_RESPONSE (gemini-4-hydrogen)可能已有人在做 @waleedkadous 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
-
[Bug]: Manager UI logo fails to load — broken external URL可能已有人在做 @kavindu-udara 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 68/100