feat(llm): introduce unified LlmProvider abstraction for AI chat backends#1
Draft
feat(llm): introduce unified LlmProvider abstraction for AI chat backends#1
Conversation
…leLlmProvider Agent-Logs-Url: https://github.com/VM8gkAs/WISE-API/sessions/0edbae90-5525-4e1b-8a67-448c4592fc5f Co-authored-by: VM8gkAs <61822684+VM8gkAs@users.noreply.github.com>
Agent-Logs-Url: https://github.com/VM8gkAs/WISE-API/sessions/0edbae90-5525-4e1b-8a67-448c4592fc5f Co-authored-by: VM8gkAs <61822684+VM8gkAs@users.noreply.github.com>
Agent-Logs-Url: https://github.com/VM8gkAs/WISE-API/sessions/0edbae90-5525-4e1b-8a67-448c4592fc5f Co-authored-by: VM8gkAs <61822684+VM8gkAs@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Introduce unified AI provider abstraction for WISE
feat(llm): introduce unified LlmProvider abstraction for AI chat backends
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both
AWSBedrockControllerandChatGptControllercontained identical inline HTTP call logic, tightly coupling the AI chat path to specific backends with no seam for future provider extension.Changes
LlmProviderinterface (org.wise.portal.service.llm) — uniformchat(String requestBody)+getName()contract for all AI backendsOpenAiCompatibleLlmProvider— single concrete impl covering any OpenAI-compatible endpoint: AWS Bedrock's runtime, the real OpenAI API, and local gateways (Ollama, vLLM, LM Studio)LlmProviderConfig— Spring@Configurationthat wires two named beans from existing app properties; no property renamesAWSBedrockControllerandChatGptControllerdrop ~50 lines of duplicated HTTP code each; now delegate via@Qualifier-injectedLlmProvider.produces = APPLICATION_JSON_VALUEadded to both to enforce correctContent-Typeand prevent XSSOpenAiCompatibleLlmProvidercovering name retrieval and misconfiguration error paths (missing/null key and URL)application_sample.properties— expanded AI provider docs; notes the local-gateway override path foropenai.chat.api.urlAdding a future provider (Gemini, Claude, local model)
LlmProvider(or reuseOpenAiCompatibleLlmProviderfor any OpenAI-compat endpoint)@Bean("geminiLlmProvider")inLlmProviderConfigwired from new properties@Qualifier("geminiLlmProvider")wherever neededExisting endpoints (
/api/aws-bedrock/chat,/api/chat-gpt) and all config property names are unchanged.Original prompt
Implement the first safe iteration of a unified AI provider abstraction for WISE, targeting the forked repositories discussed in this conversation. The user will test locally after the PR is created.
Repository:
VM8gkAs/WISE-APIBase branch:
developGoal:
Scope requirements:
LlmProvider(name can vary if a better repo-consistent naming is preferred).Non-goals:
Success criteria:
Suggested implementation approach:
Please create a pull request in the user's fork with a concise title describing the provider abstraction refactor.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: @copilot Accepted Confirmation: Are you sure?
Assistant: 已整理:以下提案刻意避開 WISE 專案中已明示「開發中 / 預定開發」的 AI 功能,避免衝突。
先講結論
目前應避免與下列已知方向重疊:
已明示「預定開發 / 未來規劃」
AI Assistant 的 context awareness
### 5. Context Awareness (Planned for future release) In the future, the assistant will know which part of the curriculum you are currently working on.OpenAI provider 支援
已完成、正在延伸中的方向
教師端 AI 翻譯
教師端 AI 摘要 / 總結
AI 功能強化提案表
下面是避開既有規劃後,我認為較有價值的增強方向。
This pull request was created from Copilot chat.