-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Basic/WIP implementation of Copliot into the AI System, as well as Support for Scratch projects. #8088
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
base: master
Are you sure you want to change the base?
Conversation
…PI key support Co-authored-by: charlieduzstuf <[email protected]>
Co-authored-by: charlieduzstuf <[email protected]>
Co-authored-by: charlieduzstuf <[email protected]>
Co-authored-by: charlieduzstuf <[email protected]>
Co-authored-by: charlieduzstuf <[email protected]>
Co-authored-by: charlieduzstuf <[email protected]>
Co-authored-by: charlieduzstuf <[email protected]>
…ebGPU acceleration Co-authored-by: charlieduzstuf <[email protected]>
Co-authored-by: charlieduzstuf <[email protected]>
…are assistance Co-authored-by: charlieduzstuf <[email protected]>
…and-api-keys Add local AI model support with unlimited requests, custom API keys, production-ready local inference with WebGPU acceleration, Scratch project import, and VS Code Copilot Chat integration
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.
Pull request overview
This PR adds three major features to GDevelop: local AI model support, custom API key integration, and Scratch project import functionality. The implementation provides unlimited AI requests through local models and user-provided API keys.
Key Changes:
- Local AI model infrastructure with download scripts and management UI
- Custom API key configuration for OpenAI, Anthropic, Google AI, and HuggingFace
- Scratch (.sb3) project import with block-to-event conversion
- GitHub Copilot-inspired chat interface with specialized agents
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Local AI Models (18 files) | Infrastructure for downloading and running local LLMs with transformers.js |
| Scratch Importer (4 files) | Parser and converter for importing Scratch projects into GDevelop |
| Copilot Chat (3 files) | VS Code Copilot-inspired agent system for code assistance |
| UI Integration (3 files) | Dialog components and AI request routing with unlimited request support |
| Configuration (2 files) | AI preset configuration with local model detection |
| Tests & Docs (5 files) | Unit tests and comprehensive documentation |
| CI/CD (1 file) | GitHub Actions workflow for model downloads |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (isUsingCustomKeys && !isLocal) { | ||
| // Use direct API call with custom keys | ||
| return createDirectAiRequest(params); | ||
| } | ||
|
|
||
| // Use GDevelop's backend (default) | ||
| return gdCreateAiRequest(getAuthorizationHeader, params); | ||
| }; | ||
|
|
Copilot
AI
Dec 22, 2025
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.
Duplicate code block detected. Lines 66-73 are identical to lines 54-63, creating unreachable code. The second block will never execute.
| if (isUsingCustomKeys && !isLocal) { | |
| // Use direct API call with custom keys | |
| return createDirectAiRequest(params); | |
| } | |
| // Use GDevelop's backend (default) | |
| return gdCreateAiRequest(getAuthorizationHeader, params); | |
| }; |
| export { | ||
| saveApiKeys, | ||
| loadApiKeys, | ||
| getApiKeyForProvider, | ||
| clearApiKeys, | ||
| setActiveLocalModel, | ||
| getActiveLocalModel, | ||
| setUseLocalModel, | ||
| shouldUseLocalModel, | ||
| type ApiKeyConfig, | ||
| } from './LocalStorage'; |
Copilot
AI
Dec 22, 2025
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.
Missing type export. The type ApiKeyConfig is imported from './CustomApiKeysDialog' but the CustomApiKeysDialog file exports it. However, this export is then re-exported in LocalStorage.js line 7, but the index.js file should export it from LocalStorage, not from CustomApiKeysDialog to maintain consistency.
| export const saveApiKeys = (apiKeys: Array<ApiKeyConfig>): void => { | ||
| try { | ||
| localStorage.setItem(API_KEYS_STORAGE_KEY, JSON.stringify(apiKeys)); | ||
| } catch (error) { | ||
| console.error('Failed to save API keys:', error); | ||
| } | ||
| }; |
Copilot
AI
Dec 22, 2025
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.
Security concern: API keys are stored in plain text in localStorage. While mentioned as "encrypted by browser," localStorage does not encrypt data by default. Any script running on the page can access these keys. Consider using a more secure storage mechanism or warning users about this limitation.
| .filter(([_, key]) => key && key.trim() !== '') | ||
| .map(([provider, apiKey]) => ({ | ||
| provider, | ||
| // $FlowFixMe - We know apiKey is a string |
Copilot
AI
Dec 22, 2025
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.
The Flow type suppression comment "// $FlowFixMe - We know apiKey is a string" is unnecessary. The Object.entries() return type is correct, and the filter ensures only non-empty strings remain. Remove this suppression as the type is already correct.
| // $FlowFixMe - We know apiKey is a string |
| @@ -0,0 +1,59 @@ | |||
| // @flow | |||
Copilot
AI
Dec 22, 2025
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.
The PR title and description contain a spelling error: "Copliot" should be "Copilot".
- Enable optional chaining in .flowconfig - Fix export syntax for type exports (separate type exports) - Fix orphaned code in AiRequestWrapper.js - Fix Partial type usage (use $Shape instead) - Fix exact type mismatches - Add type guards for transformersModule, navigator.gpu, performance.memory - Fix TextField and Column component prop usage - Fix default parameter exact type issues - Fix LocalStorage return type - Fix fs.rmSync property check with FlowFixMe Remaining: Test file errors and a few minor issues. Co-authored-by: charlieduzstuf <[email protected]>
- Fix test mock in AiConfiguration.spec.js (add missing properties) - Fix Object.entries type issue in CustomApiKeysDialog.js - Fix exponential spread warning in ConversationManager.js (use Object.assign) - Fix exact type issues in DirectApiClient.js (explicit object construction) Flow type checking now passing except for 1 pre-existing test module error unrelated to AI changes. Co-authored-by: charlieduzstuf <[email protected]>
- Auto-format all AI generation and Scratch importer files - Ensures code follows project formatting standards Co-authored-by: charlieduzstuf <[email protected]>
- Add conditionals to build-storybook workflow to skip AWS steps when secrets unavailable - Add conditionals to extract-translations workflow to skip Crowdin steps when secrets unavailable - This allows workflows to pass in forked repositories while still working normally in the main repo Co-authored-by: charlieduzstuf <[email protected]>
Fix Flow type errors and GitHub Actions workflows in AI generation modules
Very basic/wip, but what this does:
Seemed like a cool PR to make tbh.