-
Notifications
You must be signed in to change notification settings - Fork 92
add ai bridge #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add ai bridge #76
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Network-specific config options. | ||
| # | ||
| # ai-bridge owns the defaults for this section. Keep these commented unless | ||
| # this generated config intentionally needs to override bridge defaults. | ||
| # | ||
| # Supported override fields: | ||
| # | ||
| # network: | ||
| # default_system_prompt: | | ||
| # Custom system prompt. | ||
| # default_reasoning_level: "off" | ||
| # fetch: | ||
| # timeout_ms: 10000 | ||
| # max_bytes: 2097152 | ||
| # max_chars: 20000 | ||
| # compaction: | ||
| # enabled: true | ||
| # reserve_tokens: 16384 | ||
| # keep_recent_tokens: 20000 | ||
|
|
||
| {{ setfield . "CommandPrefix" "!ai" -}} | ||
| {{ setfield . "DatabaseFileName" "ai" -}} | ||
| {{ setfield . "BridgeTypeName" "AI Chats" -}} | ||
| {{ setfield . "BridgeTypeIcon" "mxc://beeper.com/51a668657dd9e0132cc823ad9402c6c2d0fc3321" -}} | ||
| {{ setfield . "DefaultPickleKey" "mautrix.bridge.e2ee" -}} | ||
| {{ template "bridgev2.tpl.yaml" . }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,6 +207,7 @@ type generatedBridgeConfig struct { | |
|
|
||
| // These should match the last 2 digits of https://mau.fi/ports | ||
| var bridgeIPSuffix = map[string]string{ | ||
| "ai": "44", | ||
| "telegram": "17", | ||
| "whatsapp": "18", | ||
| "meta": "19", | ||
|
|
@@ -352,6 +353,11 @@ func generateBridgeConfig(ctx *cli.Context) error { | |
| startupCommand += " -c " + outputPath | ||
| } | ||
| installInstructions = fmt.Sprintf("https://docs.mau.fi/bridges/go/setup.html?bridge=%s#installation", cfg.BridgeType) | ||
| case "ai": | ||
| startupCommand = "ai" | ||
| if outputPath != "config.yaml" && outputPath != "<config file>" { | ||
| startupCommand += " -c " + outputPath | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: the |
||
| case "imessagego": | ||
| startupCommand = "beeper-imessage" | ||
| if outputPath != "config.yaml" && outputPath != "<config file>" { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latent: substring auto-detection collision.
guessOrAskBridgeType(lines 89-100) walksofficialBridgestop-down and matches viastrings.Contains(bridge, name), returning the first hit. With"ai"(2 chars) at the top of the list, any user-chosen bridge name containing the substringai—sh-mail,sh-rain,sh-paid,sh-bait, etc. — will now silently be classified as the ai bridge type when--typeis omitted, renderingai.tpl.yamlinstead 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
aianywhere 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.