Skip to content

Add AI integration framework (Ollama, LM Studio, OpenAI, Anthropic, Universal) - #28

Closed
Xenne93 wants to merge 1 commit into
mainfrom
feature/ai-integration
Closed

Add AI integration framework (Ollama, LM Studio, OpenAI, Anthropic, Universal)#28
Xenne93 wants to merge 1 commit into
mainfrom
feature/ai-integration

Conversation

@Xenne93

@Xenne93 Xenne93 commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Lays the groundwork for AI-powered features (server monitoring, script/mod troubleshooting, rule-breaker detection, admin notifications) - this PR is just the plumbing, no actual AI features built on top of it yet.

Backend:

  • New AiIntegrationSettings table (per SystemProfile): provider, base URL, encrypted API key, model, enabled flag
  • New IAiService/AiService: sends chat requests to whichever provider is configured. OpenAI/LM Studio/Universal share one OpenAI-compatible implementation; Anthropic and Ollama each have their own since their request shapes differ
  • New AiIntegrationController: admin-only settings CRUD + a test-connection endpoint

Frontend:

  • New 'AI Integration' page, linked from Panel Settings: provider dropdown, conditional base URL, masked API key (same configured/remove pattern as the existing Steam API key), model name, enable toggle, and a Test Connection button
  • Test Connection deliberately ignores the enable toggle - it's an explicit admin action, not an automated feature, so you can verify credentials before switching AI on for real (caught this as a real UX bug during testing and fixed it)

Testing: ran the whole flow end-to-end in Docker, including a real call to the actual OpenAI API with a deliberately invalid key - confirmed the request reaches api.openai.com with the correct auth header and body, and OpenAI's real error response ('Incorrect API key provided...') surfaces back to the admin. Also verified settings persist across a reload and the base URL/API key guidance updates per provider (e.g. Ollama shows http://localhost:11434 as a placeholder and marks the base URL required).

…niversal)

Lays the groundwork for AI-powered features (server monitoring, script/mod
troubleshooting, rule-breaker detection, admin notifications) without
building any of those features yet - this is just the plumbing:

- New AiIntegrationSettings table (one row per SystemProfile): provider,
  base URL, encrypted API key, model name, enabled flag. API key is
  encrypted at rest via the existing IRconPasswordsCryptoService, same
  scheme as PanelSettings' Steam API key
- New IAiService/AiService: sends chat-style requests to whichever
  provider is configured. OpenAI, LM Studio, and a generic "Universal"
  OpenAI-compatible endpoint all share one implementation (same
  request/response shape); Anthropic and Ollama each get their own, since
  their APIs differ (Anthropic separates the system prompt out; Ollama
  uses its own native /api/chat format instead of OpenAI's)
- New "AI Integration" page, reachable via a link from Panel Settings:
  provider dropdown, conditional base URL (required for
  Ollama/LM Studio/Universal, optional override for OpenAI/Anthropic),
  masked API key with the same configured/remove pattern as the Steam key,
  model name, enable toggle, and a Test Connection button
- Test Connection intentionally works regardless of the enable toggle -
  it's an explicit, admin-initiated diagnostic action, not an automated
  AI feature firing on its own, so requiring the feature to be "on" just
  to verify credentials would be backwards

Tested end-to-end against the real OpenAI API with a deliberately invalid
key: confirmed the request reaches api.openai.com, the Bearer auth header
and JSON body are built correctly, and OpenAI's actual error response
("Incorrect API key provided...") surfaces back to the admin. Also
verified settings persist across a reload and the base URL/API key
guidance updates correctly per provider.
@Xenne93 Xenne93 closed this Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant