[Beta]Refactor: Decompose Models.swift + WebUI Local Fallback fix#6
Merged
[Beta]Refactor: Decompose Models.swift + WebUI Local Fallback fix#6
Conversation
Performance: AI engine racing + bounded avatar caches AI Engine Racing (DiscordAIService.swift): - Replace sequential AI fallback with TaskGroup parallel execution - Race Apple Intelligence, OpenAI, and Ollama simultaneously - Take first successful response, cancel remaining tasks - Expected latency improvement: 30s+ → <5s worst case - Add comment documenting preference order is starting order only Bounded Avatar Caches (AppModel.swift): - Add maxAvatarCacheCount limit (1000 entries per cache) - Add cacheUserAvatar() and cacheGuildAvatar() helpers with FIFO eviction - Prevent unbounded memory growth during extended operation - Update syncVoicePresenceFromGuildSnapshot() and cacheGuildMembers() QA/Test Updates: - stripLeadingSpeakerPrefix made nonisolated for TaskGroup closure - DiscordAIServiceTests updated for racing semantics - Test asserts set membership not order (deterministic winner) Files Changed: - Services/DiscordAIService.swift (AI racing implementation) - AppModel.swift (cache eviction + helpers) - Services/DiscordAIServiceTests.swift (test updates) Build: ✅ GREEN Tests: ✅ ALL PASSED
…wiftBot into Code-Refactor-Phase2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor: Decompose Models.swift (4,263 → 16 lines) + WebUI fixes
MODELS.SWIFT DECOMPOSITION (Phase 3):
Extract 99.6% of Models.swift into domain-specific files:
Models.swift: 4,263 → 16 lines (99.6% reduction)
WEBUI LOCAL FALLBACK FIX:
BUILD FIXES:
PREVIOUS SESSION WORK (Phase 2):
Files: 9 new Models/*.swift files, AdminWebServer.swift, AppModel.swift,
DiscordService.swift, Resources/admin/index.html, project.pbxproj