Commit graph

44 commits

Author SHA1 Message Date
Innei
346fc4617e
♻️ refactor: migrate AI Rules to Claude Code Skills (#11737)
♻️ refactor: migrate AI Rules to Claude Code Skills system

Migrate all AI Rules from .cursor/rules/ to .agents/skills/ directory:
- Move 23 skills to .agents/skills/ (main directory)
- Update symlinks: .claude/skills, .cursor/skills, .codex/skills
- Create project-overview skill from project documentation
- Add references/ subdirectories for complex skills
- Remove LobeChat references from skill descriptions
- Delete obsolete .cursor/rules/ and .claude/commands/prompts/ directories

Skills structure enables better portability and maintainability across AI tools.
2026-01-23 22:30:18 +08:00
YuTengjing
395595a2c8
feat: remove Clerk authentication code (#11711) 2026-01-23 14:41:22 +08:00
Innei
e999851592
perf: optimize first-screen rendering (#11718)
* ♻️ refactor: migrate SkillStore and IntegrationDetailModal to imperative API

- Refactor SkillStore to use createModal imperative API instead of declarative Modal
- Refactor IntegrationDetailModal to use createModal with IntegrationDetailContent
- Remove open/setOpen state management from all calling components
- Add modal-imperative.mdc rule for modal best practices
- Reduce code complexity and improve maintainability

* 🐛 fix: keep modal open during OAuth flow until connection completes

Close modal only after isConnected becomes true, not immediately after
handleConnect returns. This ensures useSkillConnect listeners stay alive
to detect OAuth completion via postMessage/polling.

* 🔧 chore: update dependencies and refactor markdown handling

- Updated "@lobehub/ui" to version "^4.27.4" in package.json.
- Replaced "markdown-to-txt" with a local utility "markdownToTxt" for converting markdown to plain text across multiple components.
- Refactored imports in various files to utilize the new markdownToTxt utility, improving code consistency and maintainability.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-23 14:41:07 +08:00
Innei
6df77315b9
♻️ refactor: move vercel-react-best-practices skills to .agents directory (#11703)
Consolidate skill files into a unified .agents directory structure.
- Move skills from .cursor/skills/ to .agents/
- Create symlinks in .codex/skills and .cursor/skills pointing to .agents
2026-01-22 17:39:01 +08:00
René Wang
dc7f7d212b
opti: address favicon performance issue (#11635)
* build: Add skills

* opti: context usage

* lint: Remove unused files
2026-01-20 16:19:16 +08:00
YuTengjing
d44616354e
♻️ refactor: use fallbackData to prevent useActionSWR auto-fetch (#11514) 2026-01-15 17:34:49 +08:00
YuTengjing
ddca1652bb
feat(share): add topic sharing functionality (#11448) 2026-01-13 22:10:48 +08:00
René Wang
b9f9d6158e
fix: final patch for resource (#11398)
* refacotr: Clean up explorer entry

* fix: Cannot add page to a library

* fix: Cannot open newly created page

* fix: Page title

* fix: Page title

* fix: Recent pages jump

* fix: Column width

* fix: Column width

* style: Add visual guide

* lint: Break down files

* fix: Visual guide not disappear

* style: File name turncate

* fix: Remove chunking button for page

* fix: Upload style missing

* fix: Folder state lagging

* fix: Folder state lagging

* fix: File didn't shown up

* fix: Type error

* fix: Lint error

* fix: Lint error
2026-01-12 15:07:29 +08:00
Innei
57e725cbb3
🐛 fix(desktop): prevent duplicate CORS headers in response (#11350)
* refactor: reduce unused code

Signed-off-by: Innei <tukon479@gmail.com>

* 🐛 fix(desktop): prevent duplicate CORS headers in response

Only add CORS headers if they don't already exist in the server response.
This fixes issues with CDN resources (like cdn.jsdelivr.net) that already
return CORS headers, causing "multiple values" errors.

Fixes LOBE-2765

* 🔧 refactor(desktop): remove IpcServerMethod decorator and related metadata

This update simplifies the IPC method handling by removing the IpcServerMethod decorator and its associated metadata management. The changes include updates to documentation and code references, ensuring a cleaner and more maintainable IPC implementation.

No functional changes were introduced, but the codebase is now more streamlined for future development.

Signed-off-by: Innei <tukon479@gmail.com>

*  feat(desktop): introduce HTTP headers utility functions

Added a new utility module for managing HTTP response headers in Electron, addressing case sensitivity issues. This includes functions to set, get, check existence, and delete headers. Updated the Browser class to utilize these utilities for setting CORS headers, ensuring no duplicates are present.

This enhancement improves code maintainability and simplifies header management in the application.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-08 22:14:40 +08:00
YuTengjing
de1504cf7b
fix(image): not show reference image (#11338) 2026-01-08 17:00:03 +08:00
CanisMinor
d865e27d58
♻️ refactor: refactor static style (#11010)
* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style

* refactor: refactor static style
2025-12-27 23:51:21 +08:00
CanisMinor
024aeb2e4e 💄 style: Update i18n microcopy (#10905)
* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n translations and placeholders across multiple components

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update i18n translations for consistency in terminology across chat, onboarding, and settings components

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update i18n translations to replace 'assistant' with 'agent' and ensure consistency across all components

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update model descriptions in locales for clarity and accuracy

Signed-off-by: Innei <tukon479@gmail.com>

* feat: extract hard code string

Signed-off-by: Innei <tukon479@gmail.com>

* feat: enhance Chinese localization with new proxy and sync settings, update dialog messages for version checks and OAuth authorization

Signed-off-by: Innei <tukon479@gmail.com>

* chore: flatten

* chore: standardize localization keys by flattening nested structures across multiple languages

Signed-off-by: Innei <tukon479@gmail.com>

* chore: refine i18n documentation by consolidating key naming conventions and workflow guidelines for translation management

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update i18n

* feat: add chat title localization for improved user experience in Chinese

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
Co-authored-by: Innei <tukon479@gmail.com>
2025-12-24 12:55:12 +08:00
Innei
95c6840162 fix(import): fix lobehub ui es import path (#10893)
chore: update package dependencies and import paths

* Updated @lobehub/ui from version 3.4.2 to 3.4.4 in package.json.
* Adjusted import paths for components from '@lobehub/ui/es/' to include '.mjs' extension where necessary.
* Refactored imports for motion library to use 'motion/react-m' instead of 'motion/react'.
* Cleaned up import statements in various components for consistency.

Signed-off-by: Innei <tukon479@gmail.com>
2025-12-24 12:54:46 +08:00
Innei
86dd27b0e1 chore: update references from react-layout-kit to @lobehub/ui for Flexbox and Center components in documentation and rules
Signed-off-by: Innei <tukon479@gmail.com>
2025-12-24 12:54:44 +08:00
Arvin Xu
3c4ef8a837
🔨 chore: update agent coding rule (#10856)
update agent coding rule
2025-12-19 23:05:15 +08:00
Innei
f74befadc9
♻️ refactor(electron-main): client ipc decorate (#10679)
* refactor: client ipc

* refactor: server ipc

refactor: update IPC method names for consistency

Signed-off-by: Innei <tukon479@gmail.com>

fix: cast IPC return type to DesktopIpcServices for type safety

Signed-off-by: Innei <tukon479@gmail.com>

chore: add new workspace for desktop application in package.json

Signed-off-by: Innei <tukon479@gmail.com>

fix: export FileMetadata interface for improved accessibility

Signed-off-by: Innei <tukon479@gmail.com>

refactor: unify IPC mocking across test files for consistency

Signed-off-by: Innei <tukon479@gmail.com>

feat: enhance type-safe IPC flow with context propagation and service registry

- Introduced `getIpcContext()` and `runWithIpcContext()` for improved context management in IPC handlers.
- Updated `BrowserWindowsCtr` methods to utilize the new context handling.
- Added `McpInstallCtr` to the IPC constructors registry.
- Enhanced README with details on the new type-safe IPC features.

Signed-off-by: Innei <tukon479@gmail.com>

refactor: enhance IPC method registration for improved type safety

- Updated `registerMethod` in `IpcHandler` and `IpcService` to accept variable argument types, enhancing flexibility in method signatures.
- Simplified the `ExtractMethodSignature` type to support multiple arguments.

Signed-off-by: Innei <tukon479@gmail.com>

chore: add global type definitions and refactor import statements

- Introduced a new global type definition file to support Vite client imports.
- Refactored import statements in `App.ts` and `App.test.ts` to remove unnecessary type casting for `import.meta.glob`, improving code clarity.

Signed-off-by: Innei <tukon479@gmail.com>

* refactor: make groupName in BrowserWindowsCtr readonly for better encapsulation

Signed-off-by: Innei <tukon479@gmail.com>

* refactor: update IPC method registration and usage for improved type safety and consistency

- Replaced `@ipcClientEvent` with `@IpcMethod()` in various controllers to standardize IPC method definitions.
- Enhanced the usage of `ensureElectronIpc()` for type-safe IPC calls in service layers.
- Updated `BrowserWindowsCtr` and `NotificationCtr` to utilize the new IPC method structure, improving encapsulation and clarity.
- Refactored service methods to eliminate manual string concatenation for IPC event names, ensuring better maintainability.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2025-12-09 15:01:18 +08:00
YuTengjing
7449b2913f
feat: email provider support resend (#10557) 2025-12-02 19:05:08 +08:00
YuTengjing
dc62cc969d
feat: support better-auth (#10215) 2025-11-27 20:10:40 +08:00
Arvin Xu
0a8c80dfd2
🐛 fix: fix duplicate tools id issue and fix link dialog issue (#9731)
* add

* baseline

*  test(store): add tests for discover store plugin and mcp slices

- Add comprehensive tests for discover/slices/plugin/action.ts (15 tests)
- Add comprehensive tests for discover/slices/mcp/action.ts (11 tests)
- Update test-coverage.md with new metrics and completed work
- Coverage: 74.24% overall (+26 tests, 2 new test files)
- Action files coverage: 29/40 tested (72.5%, +2 files)

Features tested:
- Plugin/MCP categories, detail, identifiers, and list fetching
- SWR key generation with locale and parameters
- SWR configuration verification
- Service integration with discoverService

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* 📝 docs(testing): add SWR hooks testing guide and subagent workflow

Testing Guide Updates:
- Add comprehensive SWR hooks testing section with examples
- Document key differences from regular action tests
- Add examples for testing SWR key generation and configuration
- Add examples for testing conditional fetching
- Update references to include SWR hook test examples

Test Coverage Guide Updates:
- Add detailed subagent workflow for parallel testing
- Document when and how to use subagents for testing
- Add complete workflow example using subagents
- Add benefits and best practices for subagent usage
- Clarify that subagents should NOT commit or update docs
- Add step-by-step guide for launching parallel subagents

Key improvements:
- Better documentation for testing SWR-based store actions
- Clear workflow for efficient parallel testing using subagents
- Single atomic commit strategy after all subagents complete
- Improved testing efficiency and organization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* ♻️ refactor(test): fix SWR mock strategy to properly test fetcher

Previously, tests were hardcoding return values instead of calling
the fetcher function. This bypassed the actual service call logic.

Changes:
- Fix useSWR mock to call fetcher and return its Promise
- Update assertions to await Promise results
- Update testing guide with correct mock pattern
- Add explanation of why this approach is correct

Before (incorrect):
```typescript
useSWRMock.mockImplementation(((key, fetcher) => {
  fetcher?.(); // Call but ignore result
  return { data: mockData }; // Hardcoded
}) as any);
expect(result.current.data).toEqual(mockData);
```

After (correct):
```typescript
useSWRMock.mockImplementation(((key, fetcher) => {
  const data = fetcher?.(); // Get Promise from fetcher
  return { data }; // Return Promise
}) as any);
const resolvedData = await result.current.data;
expect(resolvedData).toEqual(mockData);
```

Benefits:
-  Actually tests the fetcher function
-  Mirrors real SWR behavior (data is Promise)
-  Service calls are properly verified
-  Tests are more accurate and maintainable

Updated files:
- .cursor/rules/testing-guide/zustand-store-action-test.mdc
- src/store/discover/slices/plugin/action.test.ts
- src/store/discover/slices/mcp/action.test.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* 🐛 fix(test): correct SWR mock strategy to match project standards

- Remove useSWR mocking, use real SWR implementation instead
- Only mock service methods (fetchers) with vi.spyOn
- Use waitFor for async assertions
- Update testing guide with correct SWR pattern
- Add reference to src/store/chat/slices/message/action.test.ts

This fixes the incorrect mocking approach from previous commits.
All 13 tests pass with the corrected strategy.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

*  test(store): add comprehensive tests for high priority action files

- Add mcpStore action tests (41 tests, 624 LOC covered)
  - MCP plugin installation flow (normal, resume, dependencies, config)
  - Connection testing (HTTP and STDIO)
  - Plugin lifecycle management
  - Error handling and cancellation flows

- Add fileManager action tests (35 tests, 205 LOC covered)
  - File upload and processing workflows
  - Chunk embedding and parsing
  - File list management and refresh
  - SWR data fetching

Testing approach:
- Used parallel subagents for efficient development
- Followed zustand testing patterns from guide
- Proper test layering and per-test mocking
- All tests pass type-check and lint

Coverage improvement: 74.24% → ~76% (+76 tests, 2 files)
Action files: 29/40 → 31/40 tested (77.5%)

🏆 Milestone: All high priority files (>200 LOC) now have tests!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

*  test(store): complete 100% action file coverage with 160 new tests

Added comprehensive tests for all remaining 9 medium-priority action files:

Discovery Store (33 tests):
- assistant/action.ts: 10 tests (SWR hooks, categories, detail, identifiers, list)
- provider/action.ts: 11 tests (SWR hooks, detail with readme, identifiers, list with filters)
- model/action.ts: 12 tests (SWR hooks, categories, detail, identifiers, list with params)

Knowledge Base Store (29 tests):
- crud/action.ts: 19 tests (create, update, remove, refresh, loading states, SWR hooks)
- content/action.ts: 10 tests (add files, remove files, error handling)

File Store (36 tests):
- upload/action.ts: 18 tests (base64 upload, file upload with progress, type detection, KB integration)
- chunk/action.ts: 18 tests (drawer management, highlight, semantic search)

AI Infrastructure Store (23 tests):
- aiModel/action.ts: 23 tests (CRUD, batch operations, remote sync, toggle enabled, SWR hooks)

Chat Store (39 tests):
- thread/action.ts: 39 tests (CRUD, messaging, AI title generation, validation, loading states)

Testing approach:
- Used 9 parallel subagents for efficient development
- Followed zustand testing patterns from guide
- SWR hook testing for discovery slices
- Complex async flows with proper error handling
- File operations with progress callbacks
- Semantic search and RAG integration

Coverage improvement: ~76% → ~80% (+160 tests, 9 files)
Action files: 31/40 → 40/40 tested (100%)

🎉 MILESTONE: All 40 action files now have comprehensive test coverage!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix test

* fix test

* fix context-engine

* add tests

* remove

* remove tools bar

* pin bun version

* fix

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-15 22:38:53 +08:00
YuTengjing
de7368bc25
feat: add new setting for default image num (#9618) 2025-10-12 23:56:17 +08:00
YuTengjing
ca033420b9
🐛 fix(desktop): macos26 small icon (#9421)
* 🐛 fix(desktop): macos26 icon small

* Revert "🐛 fix(desktop): macos26 icon small"

This reverts commit 4a4b7b230c.

*  feat(desktop): support Liquid Glass icons for macOS 26

- Add pre-generated Assets.car files for all build variants
- Configure afterPack hook to copy Assets.car during build
- Maintain backward compatibility with .icns fallback for older macOS

Reference: https://github.com/electron-userland/electron-builder/issues/9254

* docs: optimize comments

* fix: update deprecated macos-13 to macos-15-intel

* docs: optimize ai rules
2025-10-08 23:30:35 +08:00
YuTengjing
6325602480
📝 docs(rules): optimize agent rules and documentation structure (#9486) 2025-09-30 16:07:32 +08:00
Arvin Xu
273e0277d1
🔨 chore: pre-merge group chat relative implement (#9432)
* pre-merge code

* fix tests

* fix circular

* remove redirectUri

* fix types

* improve sql

* fix docs

* fix lint

* update model runtime
2025-09-26 03:47:25 +08:00
YuTengjing
1762dc9148
♻️ chore: refactor router runtime (#9306) 2025-09-17 23:30:04 +08:00
Arvin Xu
d942a635b3
🔨 chore: add agent-runtime (#9206)
* add agent runtime

* add agent runtime

* support finish reason

* update workflow

* 支持中断

* 支持 token usage 统计

* refactor

* add example

* add docs

* update
2025-09-14 17:29:19 +08:00
Arvin Xu
2c677e597a
🐛 fix: fix open chat page with float link modal (#9235)
* refactor @lobechat/database

* move config/file and llm to envs

* move config/auth to envs

* refactor

* fix tests

* fix tests

* upgrade
2025-09-13 17:03:10 +08:00
YuTengjing
b00e6d7817
feat(image): implement model selection memory functionality (#9160) 2025-09-08 23:46:47 +08:00
YuTengjing
58e19f856c
feat: add nano banana Chinese prompt notify (#9038) 2025-09-03 16:29:13 +08:00
YuTengjing
9a6657e52e
📝 docs(workflow): optimize documentation structure and development setup (#8934) 2025-08-26 18:21:22 +08:00
YuTengjing
0efe28d122
feat(image): polish ai image (#8915) 2025-08-25 22:38:41 +08:00
YuTengjing
96b7508e01
refactor(pricing): Introduce new pricing system (#8681) 2025-08-09 00:21:07 +08:00
Arvin Xu
022d858cbc
feat: support mcp plugin install from web (#8680)
* refactor modal

* improve mcp plugin display

* fix marketplace modal

* refactor install modal

* support official install

* fix types

* clean

* clean

* clean

* fix types

* fix protocol condition

* update state
2025-08-06 13:23:27 +08:00
YuTengjing
3a3e73e419
🐛 fix: provider config checker uses outdated API key (#8666) 2025-08-05 21:36:07 +08:00
YuTengjing
9d7c6014fd
chore: improve image display quality (#8571) 2025-07-25 17:42:23 +08:00
YuTengjing
768ee2bf23
🐛 fix: use server env config image models (#8478)
* docs: update fal provider invalid image links

* docs: add FAL model provider environment variables documentation

* 🐛 fix: update model type assignment in parseModels.ts to use dynamic lookup

* 📝 docs: add FAQ for resolving AI image generation timeout issues on Vercel

*  feat: implement getModelPropertyWithFallback utility for dynamic model property retrieval

* 📝 docs: expand testing guide with best practices for mock data strategies, error handling, and module pollution prevention

* 🐛 fix: update model type in LobeOpenAICompatibleFactory tests to 'chat'
2025-07-18 02:41:27 +08:00
YuTengjing
25bfc802b5
🐛 fix: desktop local db can't upload image (#8459) 2025-07-17 01:49:11 +08:00
YuTengjing
2bb1506ea2
🐛 fix: chat model list should not show image model (#8448) 2025-07-16 16:36:43 +08:00
YuTengjing
095de57675
feat: support AI Image (#8312)
Co-authored-by: canisminor1990 <i@canisminor.cc>
2025-07-14 20:29:57 +08:00
Arvin Xu
987b633336
📝 docs: add some cursor rules (#8338) 2025-07-04 19:07:16 +08:00
Arvin Xu
ca417f86d5
️ perf: refactor Typography to Text (#8250) 2025-06-22 14:55:26 +08:00
YuTengjing
c94e97c45a
📝 docs: add more cursor rules (#8047)
* 📝 docs: add some more cursor rules

* 📝 docs: fix greptile reported issue
2025-06-02 22:08:37 +08:00
YuTengjing
ed2ce8d32f
📝 docs: add some cursor rules & optimize codebase indexing (#7999)
* 📝 docs: add some cursor rules & optimize codebase indexing

* 📝 docs: some code reviews issue by greptile
2025-05-29 15:46:27 +08:00
Arvin Xu
a16fa0265b
🐛 fix: auto sync theme mode in desktop (#7970)
* auto sync theme

* improve style

* improve code
2025-05-26 14:53:02 +08:00
Arvin Xu
5cdf0e2146
🔨 chore: pre-merge desktop implement (#7516)
* update locale

* update code
2025-04-23 00:54:22 +08:00