-
Notifications
You must be signed in to change notification settings - Fork 614
feat: custom clientId for github copilot #1195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis PR enables customizable GitHub Copilot Client IDs throughout the application. Users can override the default client ID via settings, which is threaded through OAuth and Device Flow authentication mechanisms, backed by type definitions, i18n support across 13 languages, and provider rebuild configuration. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (10)
src/renderer/src/i18n/pt-BR/settings.json (1)
413-414: Localize new Copilot Client ID strings to pt-BRKeys and placement look correct, but the values are still in English in this pt-BR file. Consider translating for consistency with the rest of the locale, for example:
Suggested pt-BR translations
- "githubCopilotClientId": "Custom Client ID", - "githubCopilotClientIdHint": "Optional. Leave empty to use the built-in default Client ID. Only affects GitHub Copilot auth.", + "githubCopilotClientId": "ID de Cliente Personalizado", + "githubCopilotClientIdHint": "Opcional. Deixe em branco para usar o ID de Cliente padrão integrado. Afeta apenas a autenticação do GitHub Copilot."src/renderer/src/i18n/fr-FR/settings.json (1)
413-414: Localize new Copilot Client ID strings to fr-FRThe new keys are correct structurally, but the values remain in English in this fr-FR file. For consistency, consider translating them, for example:
Suggested fr-FR translations
- "githubCopilotClientId": "Custom Client ID", - "githubCopilotClientIdHint": "Optional. Leave empty to use the built-in default Client ID. Only affects GitHub Copilot auth.", + "githubCopilotClientId": "ID client personnalisé", + "githubCopilotClientIdHint": "Facultatif. Laissez vide pour utiliser l’ID client par défaut intégré. N’affecte que l’authentification GitHub Copilot."src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.ts (1)
42-47: Device flow correctly wired to provider-specific Copilot Client IDPassing
this.provider.copilotClientIdintogetGlobalGitHubCopilotDeviceFlowmakes the GitHub Copilot device flow respect the per-provider client ID while still falling back to the default env client ID when unset. This is aligned with the newcopilotClientIdfield onLLM_PROVIDERand the factory’sclientIdOverridebehavior.If you ever revisit this method, you might consider moving
this.isInitialized = trueto afterdeviceFlowand model initialization succeed so the flag more accurately reflects a fully initialized provider, but that’s pre-existing and non-blocking.src/renderer/src/i18n/fa-IR/settings.json (1)
413-414: Localize new Copilot Client ID strings for fa-IR for consistencyKeys and placement look right, but the values are still English in an otherwise Persian locale. Consider translating the label and hint to Persian to keep UX consistent with the rest of this file.
src/renderer/src/i18n/da-DK/settings.json (1)
401-402: Consider translating Copilot Client ID strings to DanishThe new
githubCopilotClientIdandgithubCopilotClientIdHintkeys are structurally correct and aligned with other locales, but their values are still English in a Danish file. If full localization is a goal, consider providing Danish translations.src/renderer/src/i18n/ko-KR/settings.json (1)
413-414: Optional: localize Copilot Client ID label/hint to KoreanThe newly added
githubCopilotClientIdandgithubCopilotClientIdHintkeys are correctly placed alongside the other Copilot strings and match the cross‑locale key structure, but their values are English. For a fully localized ko-KR experience, consider providing Korean translations. Based on learnings, this keeps the i18n surface consistent across locales.src/renderer/src/i18n/ja-JP/settings.json (1)
413-414: Translate Copilot Client ID strings to Japanese for consistencyThe new
githubCopilotClientIdandgithubCopilotClientIdHintkeys are correctly wired into the provider section, but their values remain in English in an otherwise Japanese locale file. If you aim for full ja-JP localization, consider providing Japanese text here.src/renderer/src/i18n/he-IL/settings.json (1)
413-414: Optional: Hebrew translation for Copilot Client ID strings
githubCopilotClientIdandgithubCopilotClientIdHintare added in the right place and match the shared i18n key structure, but their values are still English. To keep he-IL UX consistent, you may want to translate these strings to Hebrew.src/renderer/settings/components/GitHubCopilotOAuth.vue (1)
167-172: Consider watching a specific property for precision.The watcher watches the entire
props.providerobject reference. While this works when the provider object is replaced, consider watching the specific property for more precise reactivity:watch( - () => props.provider, - (next) => { - copilotClientId.value = next.copilotClientId || '' + () => props.provider.copilotClientId, + (next) => { + copilotClientId.value = next || '' } )This ensures the watcher only triggers when
copilotClientIdchanges, not when other provider properties change.src/main/presenter/githubCopilotOAuth.ts (1)
231-248: Consider reducing verbose logging in production.The current implementation logs detailed OAuth configuration information including environment variable status. While helpful for debugging, this verbose output may clutter logs in production.
Consider guarding the detailed logs with a development check:
+if (is.dev) { console.log('GitHub OAuth Configuration:') console.log('- Client ID configured:', clientId ? '✅' : '❌') console.log('- Client ID override provided:', clientIdOverride ? '✅' : '❌') // ... remaining log statements +}This aligns with the existing pattern at line 268 where
is.devguards the final config log.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
src/main/presenter/githubCopilotDeviceFlow.ts(3 hunks)src/main/presenter/githubCopilotOAuth.ts(2 hunks)src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.ts(1 hunks)src/main/presenter/oauthPresenter.ts(2 hunks)src/renderer/settings/components/GitHubCopilotOAuth.vue(3 hunks)src/renderer/src/i18n/da-DK/settings.json(1 hunks)src/renderer/src/i18n/en-US/settings.json(1 hunks)src/renderer/src/i18n/fa-IR/settings.json(1 hunks)src/renderer/src/i18n/fr-FR/settings.json(1 hunks)src/renderer/src/i18n/he-IL/settings.json(1 hunks)src/renderer/src/i18n/ja-JP/settings.json(1 hunks)src/renderer/src/i18n/ko-KR/settings.json(1 hunks)src/renderer/src/i18n/pt-BR/settings.json(1 hunks)src/renderer/src/i18n/ru-RU/settings.json(1 hunks)src/renderer/src/i18n/zh-CN/settings.json(1 hunks)src/renderer/src/i18n/zh-HK/settings.json(1 hunks)src/renderer/src/i18n/zh-TW/settings.json(1 hunks)src/shared/provider-operations.ts(1 hunks)src/shared/types/presenters/legacy.presenters.d.ts(1 hunks)src/shared/types/presenters/llmprovider.presenter.d.ts(1 hunks)src/types/i18n.d.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (25)
src/renderer/src/i18n/**/*.json
📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)
src/renderer/src/i18n/**/*.json: Translation key naming convention: use dot-separated hierarchical structure with lowercase letters and descriptive names (e.g., 'common.button.submit')
Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)
Files:
src/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/he-IL/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/da-DK/settings.jsonsrc/renderer/src/i18n/pt-BR/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.json
src/**/*
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
New features should be developed in the
srcdirectory
Files:
src/renderer/src/i18n/zh-HK/settings.jsonsrc/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/he-IL/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/da-DK/settings.jsonsrc/renderer/src/i18n/pt-BR/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/settings/components/GitHubCopilotOAuth.vuesrc/renderer/src/i18n/fr-FR/settings.jsonsrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
src/renderer/**
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Use lowercase with dashes for directories (e.g., components/auth-wizard)
Files:
src/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/he-IL/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/da-DK/settings.jsonsrc/renderer/src/i18n/pt-BR/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/settings/components/GitHubCopilotOAuth.vuesrc/renderer/src/i18n/fr-FR/settings.json
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/renderer/settings/components/GitHubCopilotOAuth.vuesrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and maintain strict TypeScript type checking for all files
**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Write logs and comments in English
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
src/shared/**/*.d.ts
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Define type definitions in shared/*.d.ts files for objects exposed by the main process to the renderer process
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
src/shared/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Shared type definitions and utilities between main and renderer processes should be placed in
src/shared
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/shared/types/presenters/legacy.presenters.d.ts
src/shared/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Shared types and utilities should be placed in
src/shared/
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/shared/types/presenters/legacy.presenters.d.ts
src/**/*.{ts,tsx,vue,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with single quotes, no semicolons, and 100 character width
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/renderer/settings/components/GitHubCopilotOAuth.vuesrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use OxLint for linting JavaScript and TypeScript files
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use EventBus for inter-process communication events
Files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/provider-operations.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/types/i18n.d.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/shared/types/presenters/legacy.presenters.d.tssrc/main/presenter/githubCopilotOAuth.ts
src/main/presenter/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Organize core business logic into dedicated Presenter classes, with one presenter per functional domain
Files:
src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/main/presenter/githubCopilotOAuth.ts
src/main/presenter/llmProviderPresenter/providers/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
src/main/presenter/llmProviderPresenter/providers/*.ts: Each LLM provider must implement thecoreStreammethod following the standardized event interface for tool calling and response streaming
Convert MCP tools to provider-specific formats and normalize streaming responses to standard events in each provider implementation
src/main/presenter/llmProviderPresenter/providers/*.ts: In Provider implementations (src/main/presenter/llmProviderPresenter/providers/*.ts), thecoreStream(messages, modelId, temperature, maxTokens)method should perform a single-pass streaming API request for each conversation round without containing multi-turn tool call loop logic
In Provider implementations, handle native tool support by converting MCP tools to Provider format usingconvertToProviderToolsand including them in the API request; for Providers without native function call support, prepare messages usingprepareFunctionCallPromptbefore making the API call
In Provider implementations, parse Provider-specific data chunks from the streaming response andyieldstandardizedLLMCoreStreamEventobjects conforming to the standard stream event interface, including text, reasoning, tool calls, usage, errors, stop reasons, and image data
In Provider implementations, include helper methods for Provider-specific operations such asformatMessages,convertToProviderTools,parseFunctionCalls, andprepareFunctionCallPrompt
Files:
src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.ts
src/main/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use EventBus from
src/main/eventbus.tsfor main-to-renderer communication, broadcasting events viamainWindow.webContents.send()
src/main/**/*.ts: Use EventBus pattern for inter-process communication within the main process to decouple modules
Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
src/main/**/*.ts: Electron main process code belongs insrc/main/with presenters inpresenter/(Window/Tab/Thread/Mcp/Config/LLMProvider) andeventbus.tsfor app events
Use the Presenter pattern in the main process for UI coordination
Files:
src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/main/presenter/githubCopilotOAuth.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Files:
src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/main/presenter/githubCopilotOAuth.ts
src/main/presenter/llmProviderPresenter/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/llm-agent-loop.mdc)
Define the standardized
LLMCoreStreamEventinterface with fields:type(text | reasoning | tool_call_start | tool_call_chunk | tool_call_end | error | usage | stop | image_data),content(for text),reasoning_content(for reasoning),tool_call_id,tool_call_name,tool_call_arguments_chunk(for streaming),tool_call_arguments_complete(for complete arguments),error_message,usageobject with token counts,stop_reason(tool_use | max_tokens | stop_sequence | error | complete), andimage_dataobject with Base64-encoded data and mimeType
Files:
src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.ts
src/main/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Main process code for Electron should be placed in
src/main
Files:
src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/main/presenter/oauthPresenter.tssrc/main/presenter/githubCopilotDeviceFlow.tssrc/main/presenter/githubCopilotOAuth.ts
**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.vue: Use Vue 3 Composition API for all components instead of Options API
Use Tailwind CSS with scoped styles for component styling
Files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
src/renderer/**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/**/*.vue: All user-facing strings must use i18n keys via vue-i18n for internationalization
Ensure proper error handling and loading states in all UI components
Implement responsive design using Tailwind CSS utilities for all UI components
src/renderer/**/*.vue: Use composition API and declarative programming patterns; avoid options API
Structure files: exported component, composables, helpers, static content, types
Use PascalCase for component names (e.g., AuthWizard.vue)
Use Vue 3 with TypeScript, leveraging defineComponent and PropType
Use template syntax for declarative rendering
Use Shadcn Vue, Radix Vue, and Tailwind for components and styling
Implement responsive design with Tailwind CSS; use a mobile-first approach
Use Suspense for asynchronous components
Use <script setup> syntax for concise component definitions
Prefer 'lucide:' icon family as the primary choice for Iconify icons
Import Icon component from '@iconify/vue' and use with lucide icons following pattern '{collection}:{icon-name}'
Files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
src/renderer/**/*.{vue,js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Renderer process code should be placed in
src/renderer(Vue 3 application)
Files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Avoid enums; use const objects instead
Use arrow functions for methods and computed properties
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statementsVue 3 app code in
src/renderer/srcshould be organized intocomponents/,stores/,views/,i18n/,lib/directories with shell UI insrc/renderer/shell/
Files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching
Leverage ref, reactive, and computed for reactive state management
Use provide/inject for dependency injection when appropriate
Use Iconify/Vue for icon implementation
Files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
🧠 Learnings (22)
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)
Applied to files:
src/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/he-IL/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/pt-BR/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.json
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Implement separation of concerns where `src/main/presenter/llmProviderPresenter/index.ts` manages the Agent loop and conversation history, while Provider files handle LLM API interactions, Provider-specific request/response formatting, tool definition conversion, and native vs non-native tool call mechanisms
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Applies to src/main/presenter/llmProviderPresenter/**/*.ts : Define the standardized `LLMCoreStreamEvent` interface with fields: `type` (text | reasoning | tool_call_start | tool_call_chunk | tool_call_end | error | usage | stop | image_data), `content` (for text), `reasoning_content` (for reasoning), `tool_call_id`, `tool_call_name`, `tool_call_arguments_chunk` (for streaming), `tool_call_arguments_complete` (for complete arguments), `error_message`, `usage` object with token counts, `stop_reason` (tool_use | max_tokens | stop_sequence | error | complete), and `image_data` object with Base64-encoded data and mimeType
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : In Provider implementations, include helper methods for Provider-specific operations such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt`
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Convert MCP tools to provider-specific formats and normalize streaming responses to standard events in each provider implementation
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each LLM provider must implement the `coreStream` method following the standardized event interface for tool calling and response streaming
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:27:39.200Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/provider-guidelines.mdc:0-0
Timestamp: 2025-11-25T05:27:39.200Z
Learning: Applies to **/*Provider**/index.ts : Output only discriminated union `LLMCoreStreamEvent` in Provider implementations, do not use single interface with optional fields
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : In Provider implementations, handle native tool support by converting MCP tools to Provider format using `convertToProviderTools` and including them in the API request; for Providers without native function call support, prepare messages using `prepareFunctionCallPrompt` before making the API call
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : In Provider implementations, parse Provider-specific data chunks from the streaming response and `yield` standardized `LLMCoreStreamEvent` objects conforming to the standard stream event interface, including text, reasoning, tool calls, usage, errors, stop reasons, and image data
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.tssrc/shared/types/presenters/legacy.presenters.d.ts
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : In `src/main/presenter/llmProviderPresenter/index.ts`, listen for standardized events yielded by `coreStream` and handle them accordingly: buffer text content (`currentContent`), handle `tool_call_start/chunk/end` events by collecting tool details and calling `presenter.mcpPresenter.callTool`, send frontend events via `eventBus` with tool call status, format tool results for the next LLM call, and set `needContinueConversation = true`
Applied to files:
src/shared/types/presenters/llmprovider.presenter.d.ts
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Translation key naming convention: use dot-separated hierarchical structure with lowercase letters and descriptive names (e.g., 'common.button.submit')
Applied to files:
src/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/pt-BR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.json
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to **/*.{ts,tsx,js,jsx,vue} : Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Applied to files:
src/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system
Applied to files:
src/types/i18n.d.tssrc/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Import and use useI18n() composable with the t() function to access translations in Vue components and TypeScript files
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/composables/*.ts : Use VueUse for common composables and utility functions
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/*.{ts,vue} : Use Iconify/Vue for icon implementation
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/*.vue : Import Icon component from 'iconify/vue' and use with lucide icons following pattern '{collection}:{icon-name}'
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/*.vue : Use Shadcn Vue, Radix Vue, and Tailwind for components and styling
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/*.{ts,vue} : Leverage ref, reactive, and computed for reactive state management
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:27:45.545Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:45.545Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Use the Composition API for better code organization and reusability in Vue.js applications
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/*.vue : Use composition API and declarative programming patterns; avoid options API
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/(components|composables)/**/*.{ts,vue} : Utilize Nuxt's auto-imports feature for components and composables
Applied to files:
src/renderer/settings/components/GitHubCopilotOAuth.vue
🧬 Code graph analysis (2)
src/main/presenter/llmProviderPresenter/providers/githubCopilotProvider.ts (1)
src/main/presenter/githubCopilotDeviceFlow.ts (1)
getGlobalGitHubCopilotDeviceFlow(622-634)
src/main/presenter/oauthPresenter.ts (2)
src/main/presenter/githubCopilotDeviceFlow.ts (1)
getGlobalGitHubCopilotDeviceFlow(622-634)src/main/presenter/githubCopilotOAuth.ts (1)
createGitHubCopilotOAuth(224-278)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (16)
src/renderer/src/i18n/zh-TW/settings.json (1)
413-414: LGTM! Translation is accurate and well-positioned.The Traditional Chinese translations for the GitHub Copilot Client ID settings are clear and grammatically correct. The keys follow the existing camelCase naming convention used throughout the provider section, and they're logically placed alongside other GitHub Copilot authentication settings.
The translations appropriately:
- Preserve technical terms like "Client ID" in English
- Clearly convey the optional nature of the setting
- Explain the default behavior and scope of impact
Based on the AI summary, similar keys have been added across 13 language files. While I cannot verify all locales in this review, the implementation here is consistent with the established patterns in the codebase.
src/renderer/src/i18n/zh-CN/settings.json (1)
480-481: LGTM for new Copilot Client ID i18n entriesKeys are consistent with other locales and the i18n type definition, and the Chinese strings clearly describe the optional custom Client ID behavior.
src/types/i18n.d.ts (1)
846-847: Provider i18n typings correctly extended for Copilot Client IDAdding
githubCopilotClientIdandgithubCopilotClientIdHintunderproviderkeeps the TypeScript locale message shape aligned with the new i18n keys; no issues.src/shared/types/presenters/legacy.presenters.d.ts (1)
709-717: LLM_PROVIDER extended with copilotClientId is consistent and backward compatibleAdding
copilotClientId?: stringtoLLM_PROVIDERcleanly exposes the new configuration without breaking existing code (field is optional and inherited by the provider-specific types). This matches how the Copilot provider and device/OAuth flows consume the client ID.src/shared/types/presenters/llmprovider.presenter.d.ts (1)
45-61: Type surface forcopilotClientIdonLLM_PROVIDERlooks correctAdding
copilotClientId?: stringtoLLM_PROVIDERcleanly exposes a per‑provider Copilot client ID override and composes correctly into the AWS/Vertex provider types andPartial<LLM_PROVIDER>update paths.src/shared/provider-operations.ts (1)
39-57: IncludingcopilotClientIdin rebuild-triggering fields is appropriateTreating
copilotClientIdas aREBUILD_REQUIRED_FIELDSentry ensures provider instances are rebuilt whenever the Copilot Client ID override changes, keeping auth/device‑flow state in sync with configuration.src/renderer/src/i18n/zh-HK/settings.json (1)
413-414: Copilot Client ID i18n keys are well-integrated for zh-HK
githubCopilotClientIdandgithubCopilotClientIdHintare correctly named, localized, and placed next to the existing GitHub Copilot auth strings, matching the shared i18n structure across locales.src/renderer/src/i18n/en-US/settings.json (1)
413-414: LGTM!The new translation keys follow the existing naming convention in this file (camelCase within the
providersection) and provide clear, helpful text for the custom Client ID feature.src/main/presenter/oauthPresenter.ts (2)
46-49: LGTM!The device flow login correctly retrieves the provider and passes the
copilotClientIdto reinitialize the global device flow instance when needed.
100-101: LGTM!The OAuth login path correctly fetches the provider configuration and passes the
copilotClientIdto the OAuth factory function, enabling provider-specific client ID support.src/renderer/settings/components/GitHubCopilotOAuth.vue (2)
7-22: LGTM!The Client ID input UI is well-structured with proper labeling, hint text, and event handlers. The implementation uses Shadcn components and follows Vue 3 best practices.
174-189: LGTM!The
saveClientIdfunction properly trims the input, updates the local state, persists via the store, and handles errors with user-friendly feedback throughvalidationResult.src/main/presenter/githubCopilotOAuth.ts (1)
224-226: LGTM!The factory function correctly accepts an optional
clientIdOverride, trims whitespace, and falls back to the environment variable when not provided.src/main/presenter/githubCopilotDeviceFlow.ts (3)
594-600: LGTM!The factory function correctly accepts an optional
clientIdOverride, prioritizes it over the environment variable, and provides a clear error message when no client ID is available.
620-634: LGTM!The global device flow singleton is correctly managed:
- Tracks the active client ID separately
- Disposes the existing instance before creating a new one when the client ID changes
- Properly handles the case where no override is provided by falling back to the environment variable
636-641: LGTM!The dispose function properly cleans up both the instance and the tracked client ID state.
| "githubCopilotClientId": "Custom Client ID", | ||
| "githubCopilotClientIdHint": "Optional. Leave empty to use the built-in default Client ID. Only affects GitHub Copilot auth.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation values are in English, not Russian.
The keys githubCopilotClientId and githubCopilotClientIdHint have English values instead of Russian translations. For consistency with the rest of the file, these should be translated.
Suggested Russian translations:
githubCopilotClientId:"Пользовательский Client ID"githubCopilotClientIdHint:"Необязательно. Оставьте пустым для использования встроенного Client ID по умолчанию. Влияет только на авторизацию GitHub Copilot."
🤖 Prompt for AI Agents
In src/renderer/src/i18n/ru-RU/settings.json around lines 413 to 414, the values
for githubCopilotClientId and githubCopilotClientIdHint are in English; replace
them with the provided Russian translations: set githubCopilotClientId to
"Пользовательский Client ID" and githubCopilotClientIdHint to "Необязательно.
Оставьте пустым для использования встроенного Client ID по умолчанию. Влияет
только на авторизацию GitHub Copilot.", preserving the JSON key names and
quoting/escaping exactly as the surrounding entries.
users can customize the GitHub Client Id to handle Copilot's authorization
link #1073
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.