M7-14 P1 | sendMessageStream aiGateway 非空断言导致 null 时 crash #102
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
发现位置
rag-chat.service.tsL233sendMessageStream方法。问题
aiGateway是@Optional()注入,可能为null。使用!非空断言会导致运行时 crash。对比同步方法
sendMessage(L151-177) 有正确的 fallback:但
sendMessageStream在context.text为空时做了 fallback,但在aiGateway为 null 时没有保护。修复方案
在
context.text非空且this.aiGateway存在时才调用generateStream,否则 yield fallback:涉及文件
修复
涉及: rag-chat.service.ts