Skip to content

Conversation

@charlieduzstuf
Copy link

Very basic/wip, but what this does:

  1. Users can use Local Models or their own API keys to use the GDevelop AI Features more than the capped amount.
  2. Parts of Vscode/Github Copilot are built into the AI now
  3. GDevelop can open projects made in the Scratch Engine

Seemed like a cool PR to make tbh.

Copilot AI and others added 12 commits December 22, 2025 14:35
…PI key support

Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
…ebGPU acceleration

Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
…are assistance

Co-authored-by: charlieduzstuf <99685295+charlieduzstuf@users.noreply.github.com>
…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
Copilot AI review requested due to automatic review settings December 22, 2025 19:29
@charlieduzstuf charlieduzstuf requested a review from 4ian as a code owner December 22, 2025 19:29
Copy link

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

Comment on lines +66 to +74
if (isUsingCustomKeys && !isLocal) {
// Use direct API call with custom keys
return createDirectAiRequest(params);
}

// Use GDevelop's backend (default)
return gdCreateAiRequest(getAuthorizationHeader, params);
};

Copy link

Copilot AI Dec 22, 2025

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.

Suggested change
if (isUsingCustomKeys && !isLocal) {
// Use direct API call with custom keys
return createDirectAiRequest(params);
}
// Use GDevelop's backend (default)
return gdCreateAiRequest(getAuthorizationHeader, params);
};

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +28
export {
saveApiKeys,
loadApiKeys,
getApiKeyForProvider,
clearApiKeys,
setActiveLocalModel,
getActiveLocalModel,
setUseLocalModel,
shouldUseLocalModel,
type ApiKeyConfig,
} from './LocalStorage';
Copy link

Copilot AI Dec 22, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +22
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);
}
};
Copy link

Copilot AI Dec 22, 2025

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.

Copilot uses AI. Check for mistakes.
.filter(([_, key]) => key && key.trim() !== '')
.map(([provider, apiKey]) => ({
provider,
// $FlowFixMe - We know apiKey is a string
Copy link

Copilot AI Dec 22, 2025

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.

Suggested change
// $FlowFixMe - We know apiKey is a string

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,59 @@
// @flow
Copy link

Copilot AI Dec 22, 2025

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".

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant