Skip to content

feat(console): add Ollama endpoint quick-fill and environment-aware hints#1482

Open
futuremeng wants to merge 2 commits intoagentscope-ai:mainfrom
futuremeng:feat/upstream/ollama-endpoint-ux
Open

feat(console): add Ollama endpoint quick-fill and environment-aware hints#1482
futuremeng wants to merge 2 commits intoagentscope-ai:mainfrom
futuremeng:feat/upstream/ollama-endpoint-ux

Conversation

@futuremeng
Copy link
Contributor

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:

  • Add one-click Ollama endpoint quick-fill options in ProviderConfigModal.
  • Add environment-aware recommendation hints (local / Docker / remote) based on current runtime context.
  • Add conservative visual highlight only when the URL field is empty and the user has not manually edited it.
  • Show a lightweight success toast when a quick-fill option is applied.
  • Add/update i18n keys in en/zh/ja/ru for the new hint and quick-fill copy.
  • Include small lint/type cleanups in the same touched area (regex escape and type narrowing).

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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

Testing

  1. Open Console Settings -> Models -> Provider config modal for Ollama.
  2. Verify quick-fill endpoint buttons are visible and clickable.
  3. Verify recommendation text changes appropriately for local vs Docker/remote context.
  4. Verify highlight appears only when URL is empty and disappears after manual edit.
  5. Click quick-fill and confirm URL is populated and success toast appears.
  6. Switch language (en/zh/ja/ru) and verify all new copy is translated and rendered correctly.
  7. Run frontend lint check to ensure no regressions in touched files.

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.

…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).
Copilot AI review requested due to automatic review settings March 14, 2026 07:00
@github-actions github-actions bot added the first-time-contributor PR created by a first time contributor label Mar 14, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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

  • Ollama Endpoint Quick-Fill: Introduced one-click quick-fill options for Ollama endpoints in the ProviderConfigModal, simplifying setup.
  • Environment-Aware Recommendations: Added intelligent hints for Ollama endpoint recommendations based on the current runtime environment (local, Docker, remote).
  • Dynamic UI Highlighting: Implemented conservative visual highlighting for the Ollama URL field when it's empty and unedited, guiding users to recommended options.
  • Localization Updates: Added and updated i18n keys across English, Chinese, Japanese, and Russian locales for the new Ollama hints and quick-fill copy, as well as new MCP client runtime statuses.
  • Code Quality Improvements: Included minor linting and type cleanups, such as regex escaping and type narrowing, in the touched areas of the codebase.

🧠 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
  • console/src/locales/en.json
    • Added new localization keys for Ollama quick-fill options and environment-aware hints.
    • Included new keys for MCP client runtime statuses.
  • console/src/locales/ja.json
    • Added new Japanese localization keys for Ollama quick-fill options and environment-aware hints.
    • Included new keys for MCP client runtime statuses.
  • console/src/locales/ru.json
    • Added new Russian localization keys for Ollama quick-fill options and environment-aware hints.
    • Included new keys for MCP client runtime statuses.
  • console/src/locales/zh.json
    • Added new Chinese localization keys for Ollama quick-fill options and environment-aware hints.
    • Included new keys for MCP client runtime statuses.
  • console/src/pages/Settings/Models/components/modals/ProviderConfigModal.tsx
    • Implemented Ollama endpoint quick-fill buttons and associated logic.
    • Added environment-aware recommendation logic for Ollama endpoints.
    • Introduced state to track user edits to the base URL for dynamic highlighting.
    • Updated type definition for activeModels to ActiveModelsInfo.
    • Refined a regex pattern for JSON highlighting.
  • console/src/pages/Settings/Models/index.module.less
    • Added new CSS styles for the Ollama endpoint hint block, quick-fill row, label, and recommendation text to support the new UI elements.
Activity
  • The pull request was created by futuremeng.
  • The author provided a detailed description outlining the feature, security considerations, and testing steps.
  • The PR is categorized as a 'New feature' affecting the 'Console (frontend web UI)' component.
  • The author confirmed local pre-commit checks and linting passed.
  • The pull request is marked as 'Ready for review'.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

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 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 anyActiveModelsInfo type 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.

Comment on lines 109 to +124
@@ -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",
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +283 to +330
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",
};
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve maintainability and reduce magic strings, you could extract the hardcoded Ollama URLs into constants. This would make them easier to update in the future and prevent potential inconsistencies between ollamaHostOptions and ollamaRecommendation.

@xieyxclack
Copy link
Member

@garyzhang99
Copy link
Collaborator

Thanks for the contribution! The quick-fill buttons are a nice UX improvement for Ollama setup. A couple of thoughts on the environment detection:

  1. Browser hostname doesn't reflect the backend environment. window.location.hostname tells us how the user accesses the frontend, not where the backend runs. Even when CoPaw runs inside Docker, Ollama could be on the host or in another container, and users typically still access Console via localhost through port mapping. So the detection can easily point to the wrong address.

  2. Rather than "Detected …", neutral hints would be more appropriate, briefly explaining when each address option applies and letting users choose.

Would you be open to adjusting the hints? Or we can pick it up on our side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time-contributor PR created by a first time contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants