12 Commits

Author SHA1 Message Date
RedwindA
fe0ff4726d 🐛 fix(api): include group in payload for playground 2025-06-16 01:12:18 +08:00
Apple\Apple
624fdecc6e feat: implement GET request deduplication in API layer
Add request deduplication mechanism to prevent duplicate GET requests
to the same endpoint within the same timeframe, significantly reducing
unnecessary network overhead.

**Changes:**
- Add `patchAPIInstance()` function to intercept and deduplicate GET requests
- Implement in-flight request tracking using Map with URL+params as unique keys
- Apply deduplication patch to both initial API instance and `updateAPI()` recreated instances
- Add `disableDuplicate: true` config option to bypass deduplication when needed

**Benefits:**
- Eliminates redundant API calls caused by component re-renders or rapid user interactions
- Reduces server load and improves application performance
- Provides automatic protection against accidental duplicate requests
- Maintains backward compatibility with existing code

**Technical Details:**
- Uses Promise sharing for identical concurrent requests
- Automatically cleans up completed requests from tracking map
- Preserves original axios functionality with minimal overhead
- Zero breaking changes to existing API usage

Addresses the issue observed in EditChannel.js where multiple calls
were made to the same endpoints during component lifecycle.
2025-06-10 02:32:50 +08:00
Apple\Apple
d98fb70328 ♻️ refactor(helpers): refactor the components/utils.js to helpers/api.js and related imports 2025-06-04 00:11:06 +08:00
Apple\Apple
4794a7cadc 🐛 fix(api): resolve missing imports in buildApiPayload function
Fix ReferenceError caused by undefined `isValidMessage` and `MESSAGE_ROLES`
in the buildApiPayload function within api.js.

Changes:
- Add missing `isValidMessage` import from utils.js
- Add missing `MESSAGE_ROLES` import from playground constants
- Consolidate duplicate `formatMessageForAPI` import
- Clean up import statements organization

Resolves: ReferenceError: isValidMessage is not defined at buildApiPayload (api.js:39:13)
2025-06-04 00:01:41 +08:00
Apple\Apple
61d1add156 ♻️ refactor(helpers): refactor the helpers folder and related imports 2025-06-03 23:56:39 +08:00
QuentinHsu
775b1c458b style(web): format code 2025-04-04 17:37:27 +08:00
CalciumIon
4cf9ba46b8 feat: add Cache-Control header to API requests 2024-12-04 20:51:55 +08:00
1808837298@qq.com
5083eaab85 fix: first login error (close #385) 2024-07-23 18:25:43 +08:00
CalciumIon
28397c5d82 fix: 修复nginx缓存导致串用户问题 2024-07-19 13:39:05 +08:00
CaIon
eb955ae4b1 chore: lint fix 2024-03-23 21:24:39 +08:00
CaIon
80695f3c05 feat: vite 2024-03-23 19:09:09 +08:00
JustSong
4cbef0780e Initial commit 2023-04-22 20:39:27 +08:00