-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feat/live2d model3json url loader #638
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: main
Are you sure you want to change the base?
Feat/live2d model3json url loader #638
Conversation
- Add URL import dialog for VRM and Live2D models - Support VPM JSON format parsing - Implement model caching with IndexedDB - Auto-detect model format from URL extension - Support direct .vrm, .zip, and .json URLs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix CORS font loading from jsdelivr.net by using local Kiwi Maru - Add smart WebSocket URL detection (disabled in production) - Add CORS headers to Vercel configuration - Support auto-switching between ws:// and wss:// protocols Fixes font loading errors and WebSocket connection failures on deployed instances. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Auto-select default chat provider when configured - Auto-select default speech provider when configured - Auto-select default transcription provider when configured - Add watcher to set active provider from env variables Improves onboarding UX by pre-selecting providers based on deployment configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add provider API keys to Vite define config - Add default provider selection environment variables - Update .gitignore for build artifacts - Update stage-web README and type definitions Enables deploying with pre-configured provider credentials via environment variables. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive Vercel deployment section to README - Document all LLM provider environment variables - Add default provider selection variables - Include configuration examples - Support multiple languages (EN, ZH-CN, JA-JP, FR) This helps users deploy AIRI to Vercel with pre-configured providers, improving the deployment experience. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add globalEnv variables to turbo.json to pass environment to build - Add dependsOn to build task to ensure proper dependency order - Fix vercel.json buildCommand to use 'pnpm run build:web' Fixes: - Turborepo warning about missing environment variables - Build command execution issues on Vercel 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Change buildCommand to use 'pnpm -w run build:web' - Ensures build script runs at workspace root level - Fixes 'ERR_PNPM_NO_SCRIPT Missing script: build:web' error - Add all provider env vars to turbo.json globalEnv - Add build task dependencies to turbo.json 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…nings - Change globalEnv to globalPassThroughEnv in turbo.json - Prevents warnings for optional provider environment variables - These variables are not required and warnings are unnecessary 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Disable Turbo remote cache to fix 400 error with Vercel artifacts API - Update build command to use turbo filter syntax for better integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Set vite output directory to project root dist folder for Vercel - Add empty env array to turbo build task to suppress unnecessary environment variable warnings - Update vercel.json outputDirectory to match new build output location 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add empty passThroughEnv array to build task to override globalPassThroughEnv, preventing unnecessary environment variable warnings for packages that don't need them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Revert to original output directory setup where Vite outputs to apps/stage-web/dist to match Turbo's outputs configuration and ensure proper build artifact tracking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
helper loads
Fix build error where @proj-airi/memory-system was imported but not declared as a dependency in server-runtime/package.json. This caused unresolved import warnings during build: [UNRESOLVED_IMPORT] Could not resolve '@proj-airi/memory-system' in src/services/memory.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Merged latest changes from moeru-ai/airi upstream including: - feat(injecta): new dependency injection package - refactor(stage-tamagotchi): improved structure - Various fixes and improvements Preserved local changes: - Memory system (@proj-airi/memory-system) - Memory UI components and configuration - All memory-related functionality Resolved conflicts by regenerating pnpm-lock.yaml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive Chinese (Simplified) translations for memory-related settings pages, including: - Short-term memory configuration (providers, TTL, namespace, etc.) - Long-term memory configuration (database, embeddings, search, etc.) - All labels, descriptions, hints, and error messages Translations follow the existing i18n patterns and terminology used throughout the project. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… fetching Add comprehensive support for loading Live2D models directly from model3.json URLs (including GitHub blob URLs): Features: - Auto-convert GitHub blob URLs to raw URLs - Parse model3.json and collect all referenced resources (textures, motions, physics, expressions, sounds, etc.) - Batch download all resources from the same base directory - Package everything into a zip file using JSZip - Cache the packaged model for offline use - Generate preview images for imported models This enables users to load Live2D models directly from GitHub or other hosting services by simply pasting the model3.json URL, without needing to manually download and package all the files. Example URL support: https://github.com/user/repo/blob/main/model/model.model3.json 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for airi-vtuber ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for airi-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @inoribea, 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 application's capabilities by introducing a robust memory system for managing conversation context and long-term knowledge, alongside comprehensive support for importing Live2D models from URLs. It also refines the deployment process by enabling extensive environment variable configuration for LLM providers and memory settings, improving overall flexibility and ease of use. Highlights
Ignored Files
Using Gemini Code AssistThe 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
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 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
|
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.
Code Review
This pull request introduces two major features: a comprehensive conversation memory system and a Live2D model loader that can fetch models and their resources from a model3.json URL. The memory system is a significant addition, providing both short-term and long-term storage options with various backends like Redis, Postgres, and Qdrant, complete with a new settings UI. The model loader intelligently handles GitHub URLs and packages all necessary Live2D resources into a zip for caching. My review focuses on the correctness and robustness of these new, complex features. I've identified a critical bug in the memory system's configuration factory, a type error in the UI store, and a suggestion to improve the robustness of the model resource fetching logic. Overall, these are powerful additions to the project.
| if (config.provider !== 'postgres-pgvector') { | ||
| throw new Error(`Unsupported long-term memory provider: ${config.provider}`) | ||
| } |
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.
This conditional check incorrectly prevents the use of the qdrant provider when creating a long-term memory provider from a configuration object. The condition config.provider !== 'postgres-pgvector' will be true for qdrant, causing an error to be thrown before the qdrant implementation is reached. This check appears to be a logic error and should be removed to allow all supported providers to be configured. The throw at the end of the function already handles unsupported providers.
| } | ||
| }) | ||
|
|
||
| await Promise.all(fetchPromises) |
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.
When fetching resources for a model3.json, a failure to fetch an individual resource is only logged as a warning. While this is acceptable for non-essential files, if a critical file like the .moc3 file fails to download, the process will still succeed, resulting in a broken model entry. It would be more robust to identify critical files and throw an error if they fail to download, preventing the creation of a non-functional model.
| await Promise.all(fetchPromises) | |
| await Promise.all(fetchPromises) | |
| // Verify that critical files have been added to the zip | |
| if (fileRefs?.Moc && !zip.file(fileRefs.Moc)) { | |
| throw new Error(`Failed to fetch critical model file: ${fileRefs.Moc}`) | |
| } |
| longTerm: enabledLongTerm.value | ||
| ? longTermProvider.value === 'qdrant' | ||
| ? { | ||
| enabled: true, | ||
| provider: 'qdrant', | ||
| qdrant: { | ||
| url: longTermQdrantUrl.value, | ||
| apiKey: longTermQdrantApiKey.value || undefined, | ||
| collectionName: longTermQdrantCollection.value || 'memory_entries', | ||
| vectorSize: Number(longTermQdrantVectorSize.value) || undefined, | ||
| }, | ||
| embedding: { | ||
| provider: embeddingProvider.value, | ||
| apiKey: embeddingApiKey.value, | ||
| baseUrl: embeddingBaseUrl.value || undefined, | ||
| accountId: embeddingAccountId.value || undefined, | ||
| model: embeddingModel.value, | ||
| }, | ||
| } satisfies QdrantLongTermPayload | ||
| : { | ||
| enabled: true, | ||
| provider: 'postgres-pgvector', | ||
| connection: { | ||
| connectionString: longTermConnectionString.value || undefined, | ||
| host: longTermHost.value || undefined, | ||
| port: Number(longTermPort.value) || undefined, | ||
| database: longTermDatabase.value || undefined, | ||
| user: longTermUser.value || undefined, | ||
| password: longTermPassword.value || undefined, | ||
| ssl: Boolean(longTermSsl.value), | ||
| }, | ||
| embedding: { | ||
| provider: embeddingProvider.value, | ||
| apiKey: embeddingApiKey.value, | ||
| baseUrl: embeddingBaseUrl.value || undefined, | ||
| accountId: embeddingAccountId.value || undefined, | ||
| model: embeddingModel.value, | ||
| }, | ||
| } satisfies PostgresLongTermPayload | ||
| : longTermProvider.value === 'qdrant' | ||
| ? { | ||
| enabled: false, | ||
| provider: 'qdrant', | ||
| qdrant: { | ||
| url: longTermQdrantUrl.value, | ||
| apiKey: longTermQdrantApiKey.value || undefined, | ||
| collectionName: longTermQdrantCollection.value || 'memory_entries', | ||
| vectorSize: Number(longTermQdrantVectorSize.value) || undefined, | ||
| }, | ||
| } satisfies QdrantLongTermPayload | ||
| : { | ||
| enabled: false, | ||
| provider: 'postgres-pgvector', | ||
| connection: {}, | ||
| } satisfies PostgresLongTermPayload, | ||
| } |
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.
There are a couple of issues in this block:
- The types
QdrantLongTermPayloadandPostgresLongTermPayloadused with thesatisfieskeyword are not defined. This will cause a TypeScript error. The correct types seem to beQdrantLongTermConfigurationandPostgresLongTermConfigurationfrom@proj-airi/memory-system. - The logic for constructing the
longTermpayload is duplicated for theenabled: trueandenabled: falsecases. This could be refactored to be more concise and maintainable by building the main object first and then setting theenabledproperty.
Summary
Add comprehensive support for loading Live2D models directly from model3.json URLs, including automatic resource fetching and
packaging.
Features
github.com/user/repo/blob/main/model.model3.json→raw.githubusercontent.com/user/repo/main/model.model3.json.png).motion3.json).physics3.json).pose3.json).exp3.json).mp3,.wav)Usage
Users can now simply paste a model3.json URL from GitHub or other hosting services:
https://github.com/Eikanya/Live2d-model/blob/master/xxxxxx/xxx/xxxx.model3.json
The system will:
Technical Details
convertGitHubBlobUrlToRaw()function for URL transformationloadModel3JsonAndResources()function for resource collectionaddDisplayModelFromURL()to detect and handle.model3.jsonURLs.model3.jsonsupportTesting