feat(console): add Ollama endpoint quick-fill and environment-aware hints#1482
feat(console): add Ollama endpoint quick-fill and environment-aware hints#1482futuremeng wants to merge 2 commits intoagentscope-ai:mainfrom
Conversation
…recommendations - Add three quick-fill buttons (127.0.0.1 / localhost / host.docker.internal) below the Base URL field in the Ollama provider config modal, so users can fill common endpoints with a single click. - Detect the current runtime environment (local / containerized / remote) from window.location.hostname and highlight the recommended endpoint button. Recommendation highlight is suppressed once the user manually edits the field. - Show a toast confirming which address was applied after clicking a button. - Update i18n strings for en/zh/ja/ru. - Fix two pre-existing lint issues in ProviderConfigModal: unnecessary regex escape and activeModels typed as any (now ActiveModelsInfo).
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience for configuring Ollama endpoints within the Console. By providing context-aware recommendations and one-click fill options, it streamlines the setup process and reduces potential errors, making it easier for users to integrate Ollama across various deployment scenarios. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR enhances the Ollama provider configuration UX in the Console frontend by adding quick-fill endpoint buttons and environment-aware recommendation hints. It detects whether the app is running locally, in Docker, or remotely, and highlights the appropriate Ollama endpoint option.
Changes:
- Added one-click quick-fill buttons for common Ollama endpoints (127.0.0.1, localhost, host.docker.internal) with environment detection logic and visual highlighting.
- Updated i18n locale files (en/zh/ja/ru) with new Ollama hint and quick-fill translations, plus unrelated MCP runtime status keys.
- Minor lint cleanups: regex character class escaping fix and
any→ActiveModelsInfotype narrowing.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| console/src/pages/Settings/Models/components/modals/ProviderConfigModal.tsx | Core logic: quick-fill buttons, environment detection, highlight state, type narrowing, regex cleanup |
| console/src/pages/Settings/Models/index.module.less | CSS classes for endpoint hint block, quick-fill row, label, and recommendation text |
| console/src/locales/en.json | English translations for Ollama quick-fill + unrelated MCP runtime status keys |
| console/src/locales/zh.json | Chinese translations (same scope as en.json) |
| console/src/locales/ja.json | Japanese translations (same scope as en.json) |
| console/src/locales/ru.json | Russian translations (same scope as en.json) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| @@ -115,6 +116,12 @@ | |||
| "updateError": "Failed to update MCP client", | |||
| "enableSuccess": "MCP client enabled successfully", | |||
| "disableSuccess": "MCP client disabled successfully", | |||
| "runtimeActive": "Connected", | |||
| "runtimeUnavailable": "Unavailable", | |||
| "runtimeUnknown": "Unknown", | |||
| "runtimeChecking": "Checking", | |||
| "runtimeQueued": "Queued", | |||
| "runtimeDisabled": "Disabled", | |||
There was a problem hiding this comment.
Code Review
This pull request introduces a great user experience improvement for configuring the Ollama provider. The addition of quick-fill buttons and environment-aware hints will make setup much easier for users in different deployment scenarios (local, Docker, remote). The implementation is well-structured, using React hooks effectively to manage state and memoize calculations. The logic for highlighting recommendations is thoughtful, providing a gentle nudge to the user without being intrusive. Internationalization has been correctly updated for all new UI text. I have one minor suggestion to improve maintainability.
| const ollamaHostOptions = useMemo( | ||
| () => [ | ||
| { | ||
| label: "127.0.0.1", | ||
| url: "http://127.0.0.1:11434", | ||
| }, | ||
| { | ||
| label: "localhost", | ||
| url: "http://localhost:11434", | ||
| }, | ||
| { | ||
| label: "host.docker.internal", | ||
| url: "http://host.docker.internal:11434", | ||
| }, | ||
| ], | ||
| [], | ||
| ); | ||
|
|
||
| const ollamaRecommendation = useMemo(() => { | ||
| const defaultOption = { | ||
| hintKey: "models.ollamaEnvHintLocal", | ||
| recommendedUrl: "http://127.0.0.1:11434", | ||
| }; | ||
|
|
||
| if (typeof window === "undefined") { | ||
| return defaultOption; | ||
| } | ||
|
|
||
| const hostname = window.location.hostname.toLowerCase(); | ||
| if ( | ||
| hostname === "host.docker.internal" || | ||
| hostname.includes("docker") | ||
| ) { | ||
| return { | ||
| hintKey: "models.ollamaEnvHintDocker", | ||
| recommendedUrl: "http://host.docker.internal:11434", | ||
| }; | ||
| } | ||
|
|
||
| if (hostname === "localhost" || hostname === "127.0.0.1") { | ||
| return defaultOption; | ||
| } | ||
|
|
||
| return { | ||
| hintKey: "models.ollamaEnvHintRemote", | ||
| recommendedUrl: "http://127.0.0.1:11434", | ||
| }; | ||
| }, []); |
|
Please format the code, refer to: https://github.com/agentscope-ai/CoPaw/blob/main/CONTRIBUTING.md#4-code-and-quality |
|
Thanks for the contribution! The quick-fill buttons are a nice UX improvement for Ollama setup. A couple of thoughts on the environment detection:
Would you be open to adjusting the hints? Or we can pick it up on our side. |
Description
This PR improves the Ollama configuration UX in Console by making endpoint setup faster and less error-prone across local, Docker, and remote deployment scenarios.
Changes included:
Related Issue: Relates to #(issue_number)
Security Considerations: No auth/channel/token changes. This is UI-only guidance plus endpoint field autofill; no secrets are introduced or persisted beyond existing config flow.
Type of Change
Component(s) Affected
Checklist
Testing
Local Verification Evidence
npm run lint
pass in touched frontend files (including ProviderConfigModal and locale changes)
Additional Notes
This PR is intentionally scoped to frontend UX and localization only, with no backend behavior change.