Commit 61a7aaa
committed
🐛 修复 Provider 注册被 tree-shake 导致 e2e 失败
package.json 限制 sideEffects 到 CSS 文件,生产构建时 rspack 会
tree-shake 纯副作用导入。原本 providers/index.ts 用
\`import "./openai"\` 的副作用导入触发 provider 注册,在生产
bundle 中被剥离,导致运行时报 "Unsupported LLM provider: openai"。
修复:把内置 provider 注册移到 registry.ts 模块内,与
providerRegistry 单例同模块。消费者 import providerRegistry 时
必然会触发 registry.ts 的顶层语句,注册就一定发生。
验证:
- dist bundle 现在包含 d7.register({name:"openai",...}) 和
d7.register({name:"anthropic",...})
- 6 个 agent e2e 测试全部恢复通过
- 1736/1736 单元测试通过1 parent 41e92c1 commit 61a7aaa
File tree
4 files changed
+10
-12
lines changed- src/app/service/agent/core/providers
4 files changed
+10
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
328 | 327 | | |
329 | | - | |
| 328 | + | |
330 | 329 | | |
331 | 330 | | |
332 | 331 | | |
333 | 332 | | |
334 | 333 | | |
335 | | - | |
336 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
| 1 | + | |
5 | 2 | | |
6 | 3 | | |
7 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
261 | 260 | | |
262 | | - | |
| 261 | + | |
263 | 262 | | |
264 | 263 | | |
265 | 264 | | |
266 | 265 | | |
267 | 266 | | |
268 | | - | |
269 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments