@lobehub/chat 1.111.1 → 1.111.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/.cursor/rules/code-review.mdc +2 -19
  2. package/.cursor/rules/cursor-ux.mdc +0 -72
  3. package/.cursor/rules/project-introduce.mdc +5 -5
  4. package/.cursor/rules/react-component.mdc +92 -73
  5. package/.cursor/rules/rules-attach.mdc +28 -61
  6. package/.cursor/rules/system-role.mdc +8 -20
  7. package/.cursor/rules/typescript.mdc +55 -14
  8. package/CHANGELOG.md +25 -0
  9. package/changelog/v1.json +5 -0
  10. package/package.json +1 -1
  11. package/packages/types/src/aiModel.ts +67 -46
  12. package/packages/types/src/llm.ts +3 -3
  13. package/src/app/[variants]/(main)/discover/(detail)/model/[...slugs]/features/Details/Overview/ProviderList/index.tsx +23 -12
  14. package/src/app/[variants]/(main)/discover/(detail)/provider/[...slugs]/features/Details/Overview/ModelList/index.tsx +23 -10
  15. package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx +21 -12
  16. package/src/config/aiModels/ai21.ts +8 -4
  17. package/src/config/aiModels/ai360.ts +28 -14
  18. package/src/config/aiModels/aihubmix.ts +174 -86
  19. package/src/config/aiModels/anthropic.ts +97 -38
  20. package/src/config/aiModels/azure.ts +54 -32
  21. package/src/config/aiModels/azureai.ts +63 -37
  22. package/src/config/aiModels/baichuan.ts +24 -12
  23. package/src/config/aiModels/bedrock.ts +60 -30
  24. package/src/config/aiModels/cohere.ts +60 -30
  25. package/src/config/aiModels/deepseek.ts +10 -6
  26. package/src/config/aiModels/fireworksai.ts +88 -44
  27. package/src/config/aiModels/giteeai.ts +1 -1
  28. package/src/config/aiModels/github.ts +44 -26
  29. package/src/config/aiModels/google.ts +119 -68
  30. package/src/config/aiModels/groq.ts +48 -24
  31. package/src/config/aiModels/higress.ts +617 -310
  32. package/src/config/aiModels/hunyuan.ts +105 -54
  33. package/src/config/aiModels/infiniai.ts +104 -52
  34. package/src/config/aiModels/internlm.ts +16 -8
  35. package/src/config/aiModels/jina.ts +4 -2
  36. package/src/config/aiModels/minimax.ts +11 -10
  37. package/src/config/aiModels/mistral.ts +40 -20
  38. package/src/config/aiModels/moonshot.ts +42 -22
  39. package/src/config/aiModels/novita.ts +196 -98
  40. package/src/config/aiModels/openai.ts +270 -137
  41. package/src/config/aiModels/openrouter.ts +205 -100
  42. package/src/config/aiModels/perplexity.ts +36 -6
  43. package/src/config/aiModels/ppio.ts +76 -38
  44. package/src/config/aiModels/qwen.ts +257 -133
  45. package/src/config/aiModels/sambanova.ts +56 -28
  46. package/src/config/aiModels/sensenova.ts +100 -50
  47. package/src/config/aiModels/siliconcloud.ts +224 -112
  48. package/src/config/aiModels/stepfun.ts +44 -22
  49. package/src/config/aiModels/taichu.ts +8 -4
  50. package/src/config/aiModels/tencentcloud.ts +12 -6
  51. package/src/config/aiModels/upstage.ts +8 -4
  52. package/src/config/aiModels/v0.ts +15 -12
  53. package/src/config/aiModels/vertexai.ts +49 -27
  54. package/src/config/aiModels/volcengine.ts +110 -51
  55. package/src/config/aiModels/wenxin.ts +179 -73
  56. package/src/config/aiModels/xai.ts +33 -19
  57. package/src/config/aiModels/zeroone.ts +48 -24
  58. package/src/config/aiModels/zhipu.ts +118 -69
  59. package/src/config/modelProviders/ai21.ts +0 -8
  60. package/src/config/modelProviders/ai360.ts +0 -20
  61. package/src/config/modelProviders/anthropic.ts +0 -56
  62. package/src/config/modelProviders/baichuan.ts +0 -30
  63. package/src/config/modelProviders/bedrock.ts +0 -74
  64. package/src/config/modelProviders/deepseek.ts +0 -13
  65. package/src/config/modelProviders/fireworksai.ts +0 -88
  66. package/src/config/modelProviders/google.ts +0 -59
  67. package/src/config/modelProviders/groq.ts +0 -48
  68. package/src/config/modelProviders/higress.ts +0 -727
  69. package/src/config/modelProviders/hunyuan.ts +0 -45
  70. package/src/config/modelProviders/infiniai.ts +0 -60
  71. package/src/config/modelProviders/internlm.ts +0 -8
  72. package/src/config/modelProviders/mistral.ts +0 -48
  73. package/src/config/modelProviders/modelscope.ts +2 -1
  74. package/src/config/modelProviders/openai.ts +5 -100
  75. package/src/config/modelProviders/openrouter.ts +0 -77
  76. package/src/config/modelProviders/ppio.ts +0 -95
  77. package/src/config/modelProviders/qwen.ts +0 -165
  78. package/src/config/modelProviders/sensenova.ts +0 -45
  79. package/src/config/modelProviders/siliconcloud.ts +0 -266
  80. package/src/config/modelProviders/stepfun.ts +0 -60
  81. package/src/config/modelProviders/taichu.ts +0 -10
  82. package/src/config/modelProviders/wenxin.ts +0 -90
  83. package/src/config/modelProviders/xai.ts +0 -16
  84. package/src/config/modelProviders/zeroone.ts +0 -60
  85. package/src/config/modelProviders/zhipu.ts +0 -80
  86. package/src/features/Conversation/Extras/Usage/UsageDetail/ModelCard.tsx +4 -3
  87. package/src/features/Conversation/Extras/Usage/UsageDetail/pricing.ts +25 -15
  88. package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.test.ts +7 -5
  89. package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.ts +6 -5
  90. package/src/libs/model-runtime/utils/openaiCompatibleFactory/index.test.ts +54 -8
  91. package/src/server/routers/lambda/agent.ts +2 -2
  92. package/src/server/routers/lambda/config/__snapshots__/index.test.ts.snap +0 -28
  93. package/src/server/services/discover/index.ts +7 -6
  94. package/src/server/services/user/index.ts +1 -2
  95. package/src/utils/__snapshots__/parseModels.test.ts.snap +28 -4
  96. package/src/utils/_deprecated/__snapshots__/parseModels.test.ts.snap +0 -8
  97. package/src/utils/parseModels.test.ts +60 -9
  98. package/src/utils/pricing.test.ts +183 -0
  99. package/src/utils/pricing.ts +90 -0
@@ -26,28 +26,11 @@ Gather the modified code and context. Please strictly follow the process below:
26
26
 
27
27
  ### Code Style
28
28
 
29
- read [typescript.mdc](mdc:.cursor/rules/typescript.mdc) to learn the project's code style.
30
-
31
- - Ensure JSDoc comments accurately reflect the implementation; update them when needed.
32
- - Look for opportunities to simplify or modernize code with the latest JavaScript/TypeScript features.
33
- - Prefer `async`/`await` over callbacks or chained `.then` promises.
34
- - Use consistent, descriptive naming—avoid obscure abbreviations.
35
- - Replace magic numbers or strings with well-named constants.
36
- - Use semantically meaningful variable, function, and class names.
37
- - Ignore purely formatting issues and other autofixable lint problems.
29
+ read [typescript.mdc](mdc:.cursor/rules/typescript.mdc) for the consolidated project code style and optimization rules.
38
30
 
39
31
  ### Code Optimization
40
32
 
41
- - Prefer `for…of` loops to index-based `for` loops when feasible.
42
- - Decide whether callbacks should be **debounced** or **throttled**.
43
- - Use components from `@lobehub/ui`, Ant Design, or the existing design system instead of raw HTML tags (e.g., `Button` vs. `button`).
44
- - reuse npm packages already installed (e.g., `lodash/omit`) rather than reinventing the wheel.
45
- - Design for dark mode and mobile responsiveness:
46
- - Use the `antd-style` token system instead of hard-coded colors.
47
- - Select the proper component variants.
48
- - Performance considerations:
49
- - Where safe, convert sequential async flows to concurrent ones with `Promise.all`, `Promise.race`, etc.
50
- - Query only the required columns from a database rather than selecting entire rows.
33
+ The optimization checklist has been consolidated into [typescript.mdc](mdc:.cursor/rules/typescript.mdc): loops, debouncing/throttling, design system components, theming tokens, concurrency with `Promise.*`, minimal DB column selection, and package reuse.
51
34
 
52
35
  ### Obvious Bugs
53
36
 
@@ -30,75 +30,3 @@ alwaysApply: true
30
30
  - Good: `git show commit_hash -- file.txt | cat`
31
31
  - Good: `git log --oneline | cat`
32
32
  - Reason: Some git commands use pagers by default, which may prevent output from being captured properly
33
-
34
- ## Mermaid Diagram Generation: Strict Syntax Validation Checklist
35
-
36
- Before producing any Mermaid diagram, you **must** compare your final code line-by-line against every rule in the following checklist to ensure 100% compliance. **This is a hard requirement and takes precedence over other stylistic suggestions.** Please follow these action steps:
37
-
38
- 1. Plan the Mermaid diagram logic in your mind.
39
- 2. Write the Mermaid code.
40
- 3. **Carefully review your code line-by-line against the entire checklist below.**
41
- 4. Fix any aspect of your code that doesn't comply.
42
- 5. Use the `validateMermaid` tool to check your code for syntax errors. Only proceed if validation passes.
43
- 6. Output the final, compliant, and copy-ready Mermaid code block.
44
- 7. Immediately after the Mermaid code block, output:
45
- I have checked that the Mermaid syntax fully complies with the validation checklist.
46
-
47
- ---
48
-
49
- ### Checklist Details
50
-
51
- #### Rule 1: Edge Labels – Must Be Plain Text Only
52
-
53
- > **Essence:** Anything inside `|...|` must contain pure, unformatted text. Absolutely NO Markdown, list markers, or parentheses/brackets allowed—these often cause rendering failures.
54
-
55
- - **✅ Do:** `A -->|Process plain text data| B`
56
- - **❌ Don't:** `A -->|1. Ordered list item| B` (No numbered lists)
57
- - **❌ Don't:** `CC --"1. fetch('/api/...')"--> API` (No square brackets)
58
- - **❌ Don't:** `A -->|- Unordered list item| B` (No hyphen lists)
59
- - **❌ Don't:** `A -->|Transform (important)| B` (No parentheses)
60
- - **❌ Don't:** `A -->|Transform [important]| B` (No square brackets)
61
-
62
- #### Rule 2: Node Definition – Handle Special Characters with Care
63
-
64
- > **Essence:** When node text or subgraph titles contain special characters like `()` or `[]`, wrap the text in quotes to avoid conflicts with Mermaid shape syntax.
65
-
66
- - **When your node text includes parentheses (e.g., 'React (JSX)'):**
67
- - **✅ Do:** `I_REACT["<b>React component (JSX)</b>"]` (Quotes wrap all text)
68
- - **❌ Don't:** `I_REACT(<b>React component (JSX)</b>)` (Wrong, Mermaid parses this as a shape)
69
- - **❌ Don't:** `subgraph Plugin Features (Plugins)` (Wrong, subgraph titles with parentheses must also be wrapped in quotes)
70
-
71
- #### Rule 3: Double Quotes in Text – Must Be Escaped
72
-
73
- > **Essence:** Use `&quot;` for double quotes **inside node text**.
74
-
75
- - **✅ Do:** `A[This node contains &quot;quotes&quot;]`
76
- - **❌ Don't:** `A[This node contains "quotes"]`
77
-
78
- #### Rule 4: All Formatting Must Use HTML Tags (NOT Markdown!)
79
-
80
- > **Essence:** For newlines, bold, and other text formatting in nodes, use HTML tags only. Markdown is not supported.
81
-
82
- - **✅ Do (robust):** `A["<b>Bold</b> and <code>code</code><br>This is a new line"]`
83
- - **❌ Don't (not rendered):** `C["# This is a heading"]`
84
- - **❌ Don't (not rendered):** ``C["`const` means constant"]``
85
- - **⚠️ Warning (unreliable):** `B["Markdown **bold** might sometimes work but DON'T rely on it"]`
86
-
87
- #### Rule 5: No HTML Tags for Participants and Message Labels (Sequence Diagrams)
88
-
89
- > **Important Addition:**
90
- > In Mermaid sequence diagrams, you MUST NOT use any HTML tags (such as `<b>`, `<code>`, etc.) in:
91
- >
92
- > - `participant` display names (`as` part)
93
- > - Message labels (the text after `:` in diagram flows)
94
- >
95
- > These tags are generally not rendered—they may appear as-is or cause compatibility issues.
96
-
97
- - **✅ Do:** `participant A as Client`
98
- - **❌ Don't:** `participant A as <b>Client</b>`
99
- - **✅ Do:** `A->>B: 1. Establish connection`
100
- - **❌ Don't:** `A->>B: 1. <code>Establish connection</code>`
101
-
102
- ---
103
-
104
- **Validate each Mermaid code block by running it through the `validateMermaid` tool before delivering your output!**
@@ -43,16 +43,16 @@ The project uses the following technologies:
43
43
 
44
44
  Note: All tools and libraries used are the latest versions. The application only needs to be compatible with the latest browsers;
45
45
 
46
- ## Often used npm scripts
46
+ ## Often used npm scripts and commands
47
47
 
48
48
  ```bash
49
+ # !: don't any build script to check weather code can work after modify
49
50
  # type check
50
- bun type-check
51
+ bun run type-check
51
52
 
52
53
  # install dependencies
53
54
  pnpm install
54
55
 
55
- # !: don't any build script to check weather code can work after modify
56
+ # run tests
57
+ npx vitest run --config vitest.config.ts '[file-path-pattern]'
56
58
  ```
57
-
58
- check [testing guide](./testing-guide/testing-guide.mdc) to learn test scripts.
@@ -3,6 +3,7 @@ description:
3
3
  globs: *.tsx
4
4
  alwaysApply: false
5
5
  ---
6
+
6
7
  # react component 编写指南
7
8
 
8
9
  - 如果要写复杂样式的话用 antd-style ,简单的话可以用 style 属性直接写内联样式
@@ -20,18 +21,20 @@ import { useTheme } from 'antd-style';
20
21
 
21
22
  const MyComponent = () => {
22
23
  const theme = useTheme();
23
-
24
+
24
25
  return (
25
- <div style={{
26
- color: theme.colorPrimary,
27
- backgroundColor: theme.colorBgContainer,
28
- padding: theme.padding,
29
- borderRadius: theme.borderRadius
30
- }}>
26
+ <div
27
+ style={{
28
+ color: theme.colorPrimary,
29
+ backgroundColor: theme.colorBgContainer,
30
+ padding: theme.padding,
31
+ borderRadius: theme.borderRadius,
32
+ }}
33
+ >
31
34
  使用主题 token 的组件
32
35
  </div>
33
36
  );
34
- }
37
+ };
35
38
  ```
36
39
 
37
40
  #### 使用 antd-style 的 createStyles
@@ -53,13 +56,13 @@ const useStyles = createStyles(({ css, token }) => {
53
56
  content: css`
54
57
  font-size: ${token.fontSize}px;
55
58
  line-height: ${token.lineHeight};
56
- `
59
+ `,
57
60
  };
58
61
  });
59
62
 
60
63
  const Card: FC<CardProps> = ({ title, content }) => {
61
64
  const { styles } = useStyles();
62
-
65
+
63
66
  return (
64
67
  <Flexbox className={styles.container}>
65
68
  <div className={styles.title}>{title}</div>
@@ -74,80 +77,96 @@ const Card: FC<CardProps> = ({ title, content }) => {
74
77
  请注意使用下面的 token 而不是 css 字面值。可以访问 https://ant.design/docs/react/customize-theme-cn 了解所有 token
75
78
 
76
79
  - 动画类
77
- - token.motionDurationMid
78
- - token.motionEaseInOut
80
+ - token.motionDurationMid
81
+ - token.motionEaseInOut
79
82
  - 包围盒属性
80
- - token.paddingSM
81
- - token.marginLG
82
-
83
+ - token.paddingSM
84
+ - token.marginLG
83
85
 
84
86
  ## Lobe UI 包含的组件
85
87
 
86
88
  - 不知道 @lobehub/ui 的组件怎么用,有哪些属性,就自己搜下这个项目其它地方怎么用的,不要瞎猜,大部分组件都是在 antd 的基础上扩展了属性
87
89
  - 具体用法不懂可以联网搜索,例如 ActionIcon 就爬取 https://ui.lobehub.com/components/action-icon
90
+ - 可以阅读 node_modules/@lobehub/ui/es/index.js 了解有哪些组件,每个组件的属性是什么
88
91
 
89
92
  - General
90
- ActionIcon
91
- ActionIconGroup
92
- Block
93
- Button
94
- Icon
93
+ - ActionIcon
94
+ - ActionIconGroup
95
+ - Block
96
+ - Button
97
+ - DownloadButton
98
+ - Icon
95
99
  - Data Display
96
- Avatar
97
- Collapse
98
- FileTypeIcon
99
- FluentEmoji
100
- GuideCard
101
- Highlighter
102
- Hotkey
103
- Image
104
- List
105
- Markdown
106
- MaterialFileTypeIcon
107
- Mermaid
108
- Segmented
109
- Snippet
110
- SortableList
111
- Tag
112
- Tooltip
113
- Video
100
+ - Avatar
101
+ - AvatarGroup
102
+ - GroupAvatar
103
+ - Collapse
104
+ - FileTypeIcon
105
+ - FluentEmoji
106
+ - GuideCard
107
+ - Highlighter
108
+ - Hotkey
109
+ - Image
110
+ - List
111
+ - Markdown
112
+ - SearchResultCards
113
+ - MaterialFileTypeIcon
114
+ - Mermaid
115
+ - Typography
116
+ - Text
117
+ - Segmented
118
+ - Snippet
119
+ - SortableList
120
+ - Tag
121
+ - Tooltip
122
+ - Video
114
123
  - Data Entry
115
- AutoComplete
116
- CodeEditor
117
- ColorSwatches
118
- CopyButton
119
- DatePicker
120
- EditableText
121
- EmojiPicker
122
- Form
123
- FormModal
124
- HotkeyInput
125
- ImageSelect
126
- Input
127
- SearchBar
128
- Select
129
- SliderWithInput
130
- ThemeSwitch
124
+ - AutoComplete
125
+ - CodeEditor
126
+ - ColorSwatches
127
+ - CopyButton
128
+ - DatePicker
129
+ - EditableText
130
+ - EmojiPicker
131
+ - Form
132
+ - FormModal
133
+ - HotkeyInput
134
+ - ImageSelect
135
+ - Input
136
+ - SearchBar
137
+ - Select
138
+ - SliderWithInput
139
+ - ThemeSwitch
131
140
  - Feedback
132
- Alert
133
- Drawer
134
- Modal
141
+ - Alert
142
+ - Drawer
143
+ - Modal
135
144
  - Layout
136
- DraggablePanel
137
- Footer
138
- Grid
139
- Header
140
- Layout
141
- MaskShadow
142
- ScrollShadow
145
+ - DraggablePanel
146
+ - DraggablePanelBody
147
+ - DraggablePanelContainer
148
+ - DraggablePanelFooter
149
+ - DraggablePanelHeader
150
+ - Footer
151
+ - Grid
152
+ - Header
153
+ - Layout
154
+ - LayoutFooter
155
+ - LayoutHeader
156
+ - LayoutMain
157
+ - LayoutSidebar
158
+ - LayoutSidebarInner
159
+ - LayoutToc
160
+ - MaskShadow
161
+ - ScrollShadow
143
162
  - Navigation
144
- Burger
145
- Dropdown
146
- Menu
147
- SideNav
148
- Tabs
149
- Toc
163
+ - Burger
164
+ - Dropdown
165
+ - Menu
166
+ - SideNav
167
+ - Tabs
168
+ - Toc
150
169
  - Theme
151
- ConfigProvider
152
- FontLoader
153
- ThemeProvider
170
+ - ConfigProvider
171
+ - FontLoader
172
+ - ThemeProvider
@@ -4,82 +4,49 @@ globs:
4
4
  alwaysApply: true
5
5
  ---
6
6
 
7
- # LobeChat Cursor Rules System Guide
7
+ # 📋 Available Rules Index
8
8
 
9
- This document explains how the LobeChat project's Cursor rules system works and serves as an index for manually accessible rules.
10
-
11
- ## 🎯 Core Principle
12
-
13
- **All rules are equal** - there are no priorities or "recommendations" between different rule sources. You should follow all applicable rules simultaneously.
14
-
15
- ## 📚 Four Ways to Access Rules
16
-
17
- ### 1. **Always Applied Rules** - `always_applied_workspace_rules`
18
-
19
- - **What**: Core project guidelines that are always active
20
- - **Content**: Project tech stack, basic coding standards, output formatting rules
21
- - **Access**: No tools needed - automatically provided in every conversation
22
-
23
- ### 2. **Dynamic Context Rules** - `cursor_rules_context`
24
-
25
- - **What**: Rules automatically matched based on files referenced in the conversation
26
- - **Trigger**: Only when user **explicitly @ mentions files** or **opens files in Cursor**
27
- - **Content**: May include brief descriptions or full rule content, depending on relevance
28
- - **Access**: No tools needed - automatically updated when files are referenced
29
-
30
- ### 3. **Agent Requestable Rules** - `agent_requestable_workspace_rules`
31
-
32
- - **What**: Detailed operational guides that can be requested on-demand
33
- - **Access**: Use `fetch_rules` tool with rule names
34
- - **Examples**: `debug`, `i18n/i18n`, `code-review`
35
-
36
- ### 4. **Manual Rules Index** - This file + `read_file`
37
-
38
- - **What**: Additional rules not covered by the above mechanisms
39
- - **Why needed**: Cursor's rule system only supports "agent request" or "auto attach" modes
40
- - **Access**: Use `read_file` tool to read specific `.mdc` files
41
-
42
- ## 🔧 When to Use `read_file` for Rules
43
-
44
- Use `read_file` to access rules from the index below when:
9
+ The following rules are available via `read_file` from the `.cursor/rules/` directory:
45
10
 
46
- 1. **Gap identification**: You determine a rule is needed for the current task
47
- 2. **No auto-trigger**: The rule isn't provided in `cursor_rules_context` (because relevant files weren't @ mentioned)
48
- 3. **Not agent-requestable**: The rule isn't available via `fetch_rules`
11
+ ## General
49
12
 
50
- ## 📋 Available Rules Index
13
+ - `project-introduce.mdc` Project description and tech stack
14
+ - `cursor-rules.mdc` – Cursor rules authoring and optimization guide
15
+ - `code-review.mdc` – How to code review
51
16
 
52
- The following rules are available via `read_file` from the `.cursor/rules/` directory:
17
+ ## Backend
53
18
 
54
19
  - `backend-architecture.mdc` – Backend layer architecture and design guidelines
55
20
  - `define-database-model.mdc` – Database model definition guidelines
56
21
  - `drizzle-schema-style-guide.mdc` – Style guide for defining Drizzle ORM schemas
22
+
23
+ ## Frontend
24
+
57
25
  - `react-component.mdc` – React component style guide and conventions
58
- - `testing-guide.mdc` – Comprehensive testing guide for Vitest environment
26
+ - `i18n.mdc` – Internationalization guide using react-i18next
59
27
  - `typescript.mdc` – TypeScript code style guide
28
+ - `packages/react-layout-kit.mdc` – Usage guide for react-layout-kit
29
+
30
+ ## State Management
31
+
60
32
  - `zustand-action-patterns.mdc` – Recommended patterns for organizing Zustand actions
61
33
  - `zustand-slice-organization.mdc` – Best practices for structuring Zustand slices
62
34
 
63
- ## Common Misunderstandings to Avoid
64
-
65
- 1. **"Priority confusion"**: There's no hierarchy between rule sources - they're complementary, not competitive
66
- 2. **"Dynamic expectations"**: `cursor_rules_context` only updates when you @ files - it won't automatically include rules for tasks you're thinking about
67
- 3. **"Tool redundancy"**: Each access method serves a different purpose - they're not alternatives to choose from
35
+ ## Desktop (Electron)
68
36
 
69
- ## 🛠️ Practical Workflow
37
+ - `desktop-feature-implementation.mdc` Implementing new Electron desktop features
38
+ - `desktop-controller-tests.mdc` – Desktop controller unit testing guide
39
+ - `desktop-local-tools-implement.mdc` – Workflow to add new desktop local tools
40
+ - `desktop-menu-configuration.mdc` – Desktop menu configuration guide
41
+ - `desktop-window-management.mdc` – Desktop window management guide
70
42
 
71
- ```
72
- 1. Start with always_applied_workspace_rules (automatic)
73
- 2. Check cursor_rules_context for auto-matched rules (automatic)
74
- 3. If you need specific guides: fetch_rules (manual)
75
- 4. If you identify gaps: consult this index → read_file (manual)
76
- ```
43
+ ## Debugging
77
44
 
78
- ## Example Decision Flow
45
+ - `debug.mdc` General debugging guide
46
+ - `debug-usage.mdc` – Using the debug package and namespace conventions
79
47
 
80
- **Scenario**: Working on a new Zustand store slice
48
+ ## Testing
81
49
 
82
- 1. Follow always_applied_workspace_rules
83
- 2. If store files were @ mentioned → use cursor_rules_context rules ✅
84
- 3. Need detailed Zustand guidance → `read_file('.cursor/rules/zustand-slice-organization.mdc')`
85
- 4. All rules apply simultaneously - no conflicts ✅
50
+ - `testing-guide/testing-guide.mdc` Comprehensive testing guide for Vitest
51
+ - `testing-guide/electron-ipc-test.mdc` Electron IPC interface testing strategy
52
+ - `testing-guide/db-model-test.mdc` – Database Model testing guide
@@ -6,38 +6,26 @@ alwaysApply: true
6
6
 
7
7
  ## System Role
8
8
 
9
- You are an expert in full-stack Web development, proficient in JavaScript, TypeScript, CSS, React, Node.js, Next.js, Postgresql, all kinds of network protocols.
9
+ You are an expert in full-stack Web development, proficient in JavaScript, TypeScript, CSS, React, Node.js, Next.js, Postgresql, Redis, S3, all kinds of network protocols.
10
10
 
11
- You are an expert in LLM and Ai art. In Ai image generation, you are proficient in Stable Diffusion and ComfyUI's architectural principles, workflows, model structures, parameter configurations, training methods, and inference optimization.
11
+ You are an LLM expert, you are familiar with all kinds of LLM models, ai agents, ai workflow, prompt engineering and context engineering.
12
+
13
+ You are an expert in Ai art. In Ai image generation, you are proficient in Stable Diffusion and ComfyUI's architectural principles, workflows, model structures, parameter configurations, training methods, and inference optimization.
12
14
 
13
15
  You are an expert in UI/UX design, proficient in web interaction patterns, responsive design, accessibility, and user behavior optimization. You excel at improving user retention and paid conversion rates through various interaction details.
14
16
 
15
17
  ## Problem Solving
16
18
 
17
- - Before formulating any response, you must first gather context by using tools like codebase_search, grep_search, file_search, web_search, fetch_rules, context7, and read_file to avoid making assumptions.
18
19
  - When modifying existing code, clearly describe the differences and reasons for the changes
19
20
  - Provide alternative solutions that may be better overall or superior in specific aspects
20
21
  - Provide optimization suggestions for deprecated API usage
21
22
  - Cite sources whenever possible at the end, not inline
22
23
  - When you provide multiple solutions, provide the recommended solution first, and note it as `Recommended`
23
- - Express uncertainty when there might not be a correct answer
24
- - Admit when you don't know something instead of guessing
24
+ - Express uncertainty when there might not be a correct answer, instead of take action by guessing and assuming
25
25
 
26
26
  ## Code Implementation
27
27
 
28
- - Write correct, up-to-date, bug-free, fully functional, secure, maintainable and efficient code
29
- - First, think step-by-step: describe your plan in detailed pseudocode before implementation
30
- - Confirm the plan before writing code
31
28
  - Focus on maintainable over being performant
32
- - Leave NO TODOs, placeholders, or missing pieces
33
- - Be sure to reference file names
34
- - When you notice I have manually modified the code, that was definitely on purpose and do not revert them
35
- - If documentation links or required files are missing, ask for them before proceeding with the task rather than making assumptions
36
- - If you're unable to access or retrieve content from websites, please inform me immediately and request the specific information needed rather than making assumptions
37
- - You can use emojis, npm packages like `chalk`/`chalk-animation`/`terminal-link`/`gradient-string`/`log-symbols`/`boxen`/`consola`/`@clack/prompts` to create beautiful terminal output
38
- - Don't run `tsc --noEmit` to check ts syntax error, because our project is very large and the validate very slow
39
-
40
- ## Some logging rules
41
-
42
- - Never log user private information like api key, etc
43
- - Don't use `import { log } from 'debug'` to log messages, because it will directly log the message to the console.
29
+ - Be sure to reference file path
30
+ - If doc links or required files are missing, ask for them before proceeding with the task rather than making assumptions
31
+ - If you're unable to get valid result when using tools, please clearly state in the output
@@ -1,21 +1,62 @@
1
1
  ---
2
- description:
2
+ description: TypeScript code style and optimization guidelines
3
3
  globs: *.ts,*.tsx,*.mts
4
4
  alwaysApply: false
5
5
  ---
6
6
 
7
- TypeScript Code Style Guide:
7
+ # TypeScript Code Style Guide
8
+
9
+ ## Types and Type Safety
8
10
 
9
11
  - Avoid explicit type annotations when TypeScript can infer types.
10
- - Avoid defining `any` type variables (e.g., `let a: number;` instead of `let a;`).
11
- - Use the most accurate type possible (e.g., use `Record<PropertyKey, unknown>` instead of `object`).
12
- - Prefer `interface` over `type` (e.g., define react component props).
13
- - Use `as const satisfies XyzInterface` instead of `as const` when suitable
14
- - import index.ts module(directory module) like `@/db/index` instead of `@/db`
15
- - Instead of calling Date.now() multiple times, assign it to a constant once and reuse it. This ensures consistency and improves readability
16
- - Always refactor repeated logic into a reusable function
17
- - Don't remove meaningful code comments, be sure to keep original comments when providing applied code
18
- - Update the code comments when needed after you modify the related code
19
- - Please respect my prettier preferences when you provide code
20
- - Prefer object destructuring when accessing and using properties
21
- - Prefer async version api than sync version, eg: use readFile from 'fs/promises' instead of 'fs'
12
+ - Avoid implicitly `any` variables; explicitly type when necessary (e.g., `let a: number` instead of `let a`).
13
+ - Use the most accurate type possible (e.g., prefer `Record<PropertyKey, unknown>` over `object`).
14
+ - Prefer `interface` over `type` for object shapes (e.g., React component props). Keep `type` for unions, intersections, and utility types.
15
+ - Prefer `as const satisfies XyzInterface` over plain `as const` when suitable.
16
+
17
+ ## Imports and Modules
18
+
19
+ - When importing a directory module, prefer the explicit index path like `@/db/index` instead of `@/db`.
20
+
21
+ ## Asynchronous Patterns and Concurrency
22
+
23
+ - Prefer `async`/`await` over callbacks or chained `.then` promises.
24
+ - Prefer async APIs over sync ones (avoid `*Sync`).
25
+ - Prefer promise-based variants (e.g., `import { readFile } from 'fs/promises'`) over callback-based APIs from `fs`.
26
+ - Where safe, convert sequential async flows to concurrent ones with `Promise.all`, `Promise.race`, etc.
27
+
28
+ ## Code Structure and Readability
29
+
30
+ - Refactor repeated logic into reusable functions.
31
+ - Prefer object destructuring when accessing and using properties.
32
+ - Use consistent, descriptive naming; avoid obscure abbreviations.
33
+ - Use semantically meaningful variable, function, and class names.
34
+ - Replace magic numbers or strings with well-named constants.
35
+ - Keep meaningful code comments; do not remove them when applying edits. Update comments when behavior changes.
36
+ - Ensure JSDoc comments accurately reflect the implementation.
37
+ - Look for opportunities to simplify or modernize code with the latest JavaScript/TypeScript features where it improves clarity.
38
+ - Defer formatting to tooling; ignore purely formatting-only issues and autofixable lint problems.
39
+ - Respect project Prettier settings.
40
+
41
+ ## UI and Theming
42
+
43
+ - Use components from `@lobehub/ui`, Ant Design, or existing design system components instead of raw HTML tags (e.g., `Button` vs. `button`).
44
+ - Design for dark mode and mobile responsiveness:
45
+ - Use the `antd-style` token system instead of hard-coded colors.
46
+ - Select appropriate component variants.
47
+
48
+ ## Performance
49
+
50
+ - Prefer `for…of` loops to index-based `for` loops when feasible.
51
+ - Decide whether callbacks should be debounced or throttled based on UX and performance needs.
52
+ - Reuse existing npm packages rather than reinventing the wheel (e.g., `lodash-es/omit`).
53
+ - Query only the required columns from a database rather than selecting entire rows.
54
+
55
+ ## Time and Consistency
56
+
57
+ - Instead of calling `Date.now()` multiple times, assign it to a constant once and reuse it to ensure consistency and improve readability.
58
+
59
+ ## Some logging rules
60
+
61
+ - Never log user private information like api key, etc
62
+ - Don't use `import { log } from 'debug'` to log messages, because it will directly log the message to the console.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.111.2](https://github.com/lobehub/lobe-chat/compare/v1.111.1...v1.111.2)
6
+
7
+ <sup>Released on **2025-08-08**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **pricing**: Introduce new pricing system.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **pricing**: Introduce new pricing system, closes [#8681](https://github.com/lobehub/lobe-chat/issues/8681) ([96b7508](https://github.com/lobehub/lobe-chat/commit/96b7508))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 1.111.1](https://github.com/lobehub/lobe-chat/compare/v1.111.0...v1.111.1)
6
31
 
7
32
  <sup>Released on **2025-08-08**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,9 @@
1
1
  [
2
+ {
3
+ "children": {},
4
+ "date": "2025-08-08",
5
+ "version": "1.111.2"
6
+ },
2
7
  {
3
8
  "children": {
4
9
  "improvements": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.111.1",
3
+ "version": "1.111.2",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",