add ai bridge#76
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🧰 Additional context used🪛 YAMLlint (1.38.0)bridgeconfig/ai.tpl.yaml[error] 22-22: syntax error: expected '', but found '{' (syntax) 🔇 Additional comments (7)
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThis PR adds support for a new "ai" bridge type to the bridge-manager system. The change registers the bridge with aliases, enables websocket support, configures its startup command and network address mapping, provides a configuration template, and documents the bridge in the README. ChangesAI Bridge Type Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
| } | ||
|
|
||
| var officialBridges = []bridgeTypeToNames{ | ||
| {"ai", []string{"ai", "aichats", "openai"}}, |
There was a problem hiding this comment.
Latent: substring auto-detection collision. guessOrAskBridgeType (lines 89-100) walks officialBridges top-down and matches via strings.Contains(bridge, name), returning the first hit. With "ai" (2 chars) at the top of the list, any user-chosen bridge name containing the substring ai — sh-mail, sh-rain, sh-paid, sh-bait, etc. — will now silently be classified as the ai bridge type when --type is omitted, rendering ai.tpl.yaml instead of prompting for the real type.
None of the other declared aliases collide today, so this isn't a current bug, but it's a footgun the moment someone names a self-hosted bridge with ai anywhere in it. Suggested fixes: drop the bare "ai" alias and rely on "aichats"/"openai", or special-case short aliases to require exact equality rather than substring.
| startupCommand = "ai" | ||
| if outputPath != "config.yaml" && outputPath != "<config file>" { | ||
| startupCommand += " -c " + outputPath | ||
| } |
There was a problem hiding this comment.
Nit: the imessage,whatsapp,discord,… branch above sets installInstructions = https://docs.mau.fi/bridges/go/setup.html?bridge=…, so users get a docs link printed to stderr. The new ai case (like imessagego) leaves it empty, so bbctl config ai only prints the startup command. If there's a public/internal docs page for ai-bridge, wiring it here would match the bridgev2 UX; otherwise this is intentional and fine.
No description provided.