Skip to content

Conversation

@adelin-b
Copy link

No description provided.

Add support for using Claude Agent SDK as a local AI provider for GDevelop's
AI generation features. This allows users with Claude Pro/Max subscriptions
to use Claude directly instead of GDevelop's cloud AI.

New files:
- localAIServer/: Express server wrapping Claude Agent SDK
  - GDevelop-compatible tool definitions
  - API endpoints matching GDevelop Generation API
- AiGenerationRouter.js: Routes requests to local or cloud based on preset
- LocalGeneration.js: API client for local AI server
- LocalAiToggle.js: Preferences UI for enabling local AI

Modified files:
- AiConfiguration.js: Added local Claude presets and isLocalAiPreset helper
- ApiConfigs.js: Added LocalAiApi configuration
- PreferencesDialog.js: Added local AI toggle UI

Usage:
1. Run: cd localAIServer && npm install && npm start
2. Enable in GDevelop: Preferences > Advanced > Other > "Use local Claude AI"
3. Select "Claude Agent (Local)" preset when using AI features
Updated AskAiEditorContainer.js and AskAiStandAloneForm.js to import
createAiRequest and addMessageToAiRequest from AiGenerationRouter
instead of directly from Generation.js. This ensures requests are
properly routed to local AI server when local preset is selected.
The Utils.js watcher was still calling getPartialAiRequest from
Generation.js, causing 404 errors when polling for local request
status. Now uses routed versions for all AI request operations.
Claude outputs function calls in markdown code blocks (```json ... ```)
which the previous regex couldn't parse. Updated extraction to:
1. First try extracting JSON from code blocks
2. Fall back to inline JSON matching
3. Handle nested objects in args properly
Claude was asking for clarification instead of creating games directly.
Updated prompt to:
- Tell Claude to NOT ask for clarification
- Tell Claude to NOT explain, just output function calls
- Be explicit about creating complete playable games
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