Skip to content

feat(config): Add support for XAI providers and migrate config files - #663

Merged
haiphucnguyen merged 2 commits into
mainfrom
feature/migrate-app-config-file
Aug 22, 2026
Merged

feat(config): Add support for XAI providers and migrate config files#663
haiphucnguyen merged 2 commits into
mainfrom
feature/migrate-app-config-file

Conversation

@haiphucnguyen

Copy link
Copy Markdown
Collaborator
  • Enables integration with XAI provider settings and metadata.
  • Automatically migrates legacy configuration entries to use OPENAI_COMPATIBLE provider type.
  • Ensures configuration compatibility across provider updates.

- Enables integration with XAI provider settings and metadata.
- Automatically migrates legacy configuration entries to use OPENAI_COMPATIBLE provider type.
- Ensures configuration compatibility across provider updates.

BREAKING CHANGE: Old configuration files referencing removed local providers will be migrated to use the OPENAI_COMPATIBLE provider type.
Copilot AI lite review requested due to automatic review settings August 22, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds configuration support for the XAI provider and introduces a one-time migration path for legacy “local provider” config entries so they continue to work under the OPENAI_COMPATIBLE provider type.

Changes:

  • Added one-time YAML migration logic to convert legacy provider_type values to OPENAI_COMPATIBLE and backfill template_name when missing.
  • Updated CLI tests to exercise saving contexts for XAI, Anthropic, and OpenAI-compatible (Ollama) providers.
  • Updated GraalVM native-image reflection configuration (feature registration + reachability metadata) to include XAI/Anthropic settings accessors.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt Adds config migration for legacy provider entries during initial load.
cli/src/test/kotlin/io/askimo/core/config/AppConfigTest.kt Updates context save tests to include XAI/Anthropic and OpenAI-compatible template settings.
cli/src/main/resources/META-INF/native-image/io.askimo/cli/reachability-metadata.json Expands reachability metadata for XAI/Anthropic settings (methods + serializers).
cli/src/main/kotlin/io/askimo/cli/graal/AskimoFeature.kt Registers XAI settings for reflection in the native-image feature configuration.
Suppressed comments (1)

shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt:736

  • The migration regex for legacy providers is inconsistent: legacyWithNullTemplatePattern matches DOCKER but the subsequent mapping / legacyTypePattern expects DOCKER_AI. As written, a config with provider_type: DOCKER_AI will be migrated to OPENAI_COMPATIBLE without populating template_name, and a config with provider_type: DOCKER may keep an unmigrated provider type that can’t be deserialized into ModelProvider anymore. Align the patterns and make the template mapping exhaustive so template_name is always set correctly for these legacy values.
            val legacyWithNullTemplatePattern = Regex(
                """(?ms)(-\s+id:.*?provider_type\s*:\s*"?)(DOCKER|LMSTUDIO|OLLAMA|LOCALAI)("?.*?template_name\s*:\s*)(null|~|""|'')(\s*(?:\n|$))""",
            )
            val withTemplateNames = legacyWithNullTemplatePattern.replace(raw) { m ->
                val legacyType = m.groupValues[2]
                val templateName = when (legacyType) {
                    "DOCKER_AI" -> "DOCKER_AI"
                    "LMSTUDIO" -> "LMSTUDIO"
                    "OLLAMA" -> "OLLAMA"
                    "LOCALAI" -> "LOCALAI"
                    else -> ""
                }
                "${m.groupValues[1]}$legacyType${m.groupValues[3]}$templateName${m.groupValues[5]}"
            }

            val legacyTypePattern = Regex("""(provider_type\s*:\s*"?)(DOCKER_AI|LMSTUDIO|OLLAMA|LOCALAI)("?)""")

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt
Comment thread cli/src/main/kotlin/io/askimo/cli/graal/AskimoFeature.kt Outdated
@haiphucnguyen
haiphucnguyen merged commit 6afc1be into main Aug 22, 2026
9 of 10 checks passed
@haiphucnguyen
haiphucnguyen deleted the feature/migrate-app-config-file branch August 22, 2026 19:43
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.

2 participants