@lobehub/chat 1.111.1 → 1.111.3
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.
- package/.cursor/rules/code-review.mdc +2 -19
- package/.cursor/rules/cursor-ux.mdc +0 -72
- package/.cursor/rules/project-introduce.mdc +5 -5
- package/.cursor/rules/react-component.mdc +92 -73
- package/.cursor/rules/rules-attach.mdc +28 -61
- package/.cursor/rules/system-role.mdc +8 -20
- package/.cursor/rules/typescript.mdc +55 -14
- package/CHANGELOG.md +52 -0
- package/changelog/v1.json +14 -0
- package/locales/ar/models.json +21 -3
- package/locales/bg-BG/models.json +21 -3
- package/locales/de-DE/models.json +21 -3
- package/locales/en-US/models.json +21 -3
- package/locales/es-ES/models.json +21 -3
- package/locales/fa-IR/models.json +21 -3
- package/locales/fr-FR/models.json +21 -3
- package/locales/it-IT/models.json +21 -3
- package/locales/ja-JP/models.json +21 -3
- package/locales/ko-KR/models.json +21 -3
- package/locales/nl-NL/models.json +21 -3
- package/locales/pl-PL/models.json +21 -3
- package/locales/pt-BR/models.json +21 -3
- package/locales/ru-RU/models.json +21 -3
- package/locales/tr-TR/models.json +21 -3
- package/locales/vi-VN/models.json +21 -3
- package/locales/zh-CN/models.json +21 -3
- package/locales/zh-TW/models.json +21 -3
- package/package.json +1 -1
- package/packages/types/src/aiModel.ts +67 -46
- package/packages/types/src/hotkey.ts +2 -0
- package/packages/types/src/llm.ts +3 -3
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +3 -3
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/TopActions.test.tsx +1 -0
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/TopActions.tsx +11 -2
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/index.tsx +2 -2
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +2 -2
- package/src/app/[variants]/(main)/chat/_layout/Desktop/SessionPanel.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/model/[...slugs]/features/Details/Overview/ProviderList/index.tsx +23 -12
- package/src/app/[variants]/(main)/discover/(detail)/provider/[...slugs]/features/Details/Overview/ModelList/index.tsx +23 -10
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx +21 -12
- package/src/components/Thinking/index.tsx +53 -13
- package/src/config/aiModels/ai21.ts +8 -4
- package/src/config/aiModels/ai360.ts +28 -14
- package/src/config/aiModels/aihubmix.ts +174 -86
- package/src/config/aiModels/anthropic.ts +97 -38
- package/src/config/aiModels/azure.ts +54 -32
- package/src/config/aiModels/azureai.ts +63 -37
- package/src/config/aiModels/baichuan.ts +24 -12
- package/src/config/aiModels/bedrock.ts +60 -30
- package/src/config/aiModels/cohere.ts +60 -30
- package/src/config/aiModels/deepseek.ts +10 -6
- package/src/config/aiModels/fireworksai.ts +88 -44
- package/src/config/aiModels/giteeai.ts +1 -1
- package/src/config/aiModels/github.ts +44 -26
- package/src/config/aiModels/google.ts +119 -68
- package/src/config/aiModels/groq.ts +48 -24
- package/src/config/aiModels/higress.ts +617 -310
- package/src/config/aiModels/hunyuan.ts +105 -54
- package/src/config/aiModels/infiniai.ts +104 -52
- package/src/config/aiModels/internlm.ts +16 -8
- package/src/config/aiModels/jina.ts +4 -2
- package/src/config/aiModels/minimax.ts +11 -10
- package/src/config/aiModels/mistral.ts +40 -20
- package/src/config/aiModels/moonshot.ts +42 -22
- package/src/config/aiModels/novita.ts +196 -98
- package/src/config/aiModels/openai.ts +270 -137
- package/src/config/aiModels/openrouter.ts +205 -100
- package/src/config/aiModels/perplexity.ts +36 -6
- package/src/config/aiModels/ppio.ts +76 -38
- package/src/config/aiModels/qwen.ts +257 -133
- package/src/config/aiModels/sambanova.ts +56 -28
- package/src/config/aiModels/sensenova.ts +100 -50
- package/src/config/aiModels/siliconcloud.ts +224 -112
- package/src/config/aiModels/stepfun.ts +44 -22
- package/src/config/aiModels/taichu.ts +8 -4
- package/src/config/aiModels/tencentcloud.ts +12 -6
- package/src/config/aiModels/upstage.ts +8 -4
- package/src/config/aiModels/v0.ts +15 -12
- package/src/config/aiModels/vertexai.ts +49 -27
- package/src/config/aiModels/volcengine.ts +110 -51
- package/src/config/aiModels/wenxin.ts +179 -73
- package/src/config/aiModels/xai.ts +33 -19
- package/src/config/aiModels/zeroone.ts +48 -24
- package/src/config/aiModels/zhipu.ts +118 -69
- package/src/config/modelProviders/ai21.ts +0 -8
- package/src/config/modelProviders/ai360.ts +0 -20
- package/src/config/modelProviders/anthropic.ts +0 -56
- package/src/config/modelProviders/baichuan.ts +0 -30
- package/src/config/modelProviders/bedrock.ts +0 -74
- package/src/config/modelProviders/deepseek.ts +0 -13
- package/src/config/modelProviders/fireworksai.ts +0 -88
- package/src/config/modelProviders/google.ts +0 -59
- package/src/config/modelProviders/groq.ts +0 -48
- package/src/config/modelProviders/higress.ts +0 -727
- package/src/config/modelProviders/hunyuan.ts +0 -45
- package/src/config/modelProviders/infiniai.ts +0 -60
- package/src/config/modelProviders/internlm.ts +0 -8
- package/src/config/modelProviders/mistral.ts +0 -48
- package/src/config/modelProviders/modelscope.ts +2 -1
- package/src/config/modelProviders/openai.ts +5 -100
- package/src/config/modelProviders/openrouter.ts +0 -77
- package/src/config/modelProviders/ppio.ts +0 -95
- package/src/config/modelProviders/qwen.ts +0 -165
- package/src/config/modelProviders/sensenova.ts +0 -45
- package/src/config/modelProviders/siliconcloud.ts +0 -266
- package/src/config/modelProviders/stepfun.ts +0 -60
- package/src/config/modelProviders/taichu.ts +0 -10
- package/src/config/modelProviders/wenxin.ts +0 -90
- package/src/config/modelProviders/xai.ts +0 -16
- package/src/config/modelProviders/zeroone.ts +0 -60
- package/src/config/modelProviders/zhipu.ts +0 -80
- package/src/const/hotkeys.ts +6 -0
- package/src/features/Conversation/Extras/Usage/UsageDetail/ModelCard.tsx +4 -3
- package/src/features/Conversation/Extras/Usage/UsageDetail/pricing.ts +25 -15
- package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.test.ts +7 -5
- package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.ts +6 -5
- package/src/hooks/useHotkeys/chatScope.ts +2 -2
- package/src/hooks/useHotkeys/globalScope.ts +16 -4
- package/src/hooks/usePinnedAgentState.ts +21 -0
- package/src/hooks/useSwitchSession.ts +1 -1
- package/src/libs/model-runtime/utils/openaiCompatibleFactory/index.test.ts +54 -8
- package/src/locales/default/hotkey.ts +4 -0
- package/src/server/routers/lambda/agent.ts +2 -2
- package/src/server/routers/lambda/config/__snapshots__/index.test.ts.snap +0 -28
- package/src/server/services/discover/index.ts +7 -6
- package/src/server/services/user/index.ts +1 -2
- package/src/utils/__snapshots__/parseModels.test.ts.snap +28 -4
- package/src/utils/_deprecated/__snapshots__/parseModels.test.ts.snap +0 -8
- package/src/utils/parseModels.test.ts +60 -9
- package/src/utils/pricing.test.ts +183 -0
- 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)
|
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
|
-
|
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 `"` for double quotes **inside node text**.
|
74
|
-
|
75
|
-
- **✅ Do:** `A[This node contains "quotes"]`
|
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
|
-
#
|
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
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
78
|
-
|
80
|
+
- token.motionDurationMid
|
81
|
+
- token.motionEaseInOut
|
79
82
|
- 包围盒属性
|
80
|
-
|
81
|
-
|
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
|
-
|
93
|
+
- ActionIcon
|
94
|
+
- ActionIconGroup
|
95
|
+
- Block
|
96
|
+
- Button
|
97
|
+
- DownloadButton
|
98
|
+
- Icon
|
95
99
|
- Data Display
|
96
|
-
Avatar
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
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
|
-
#
|
7
|
+
# 📋 Available Rules Index
|
8
8
|
|
9
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
- `
|
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
|
-
##
|
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
|
-
|
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
|
-
|
45
|
+
- `debug.mdc` – General debugging guide
|
46
|
+
- `debug-usage.mdc` – Using the debug package and namespace conventions
|
79
47
|
|
80
|
-
|
48
|
+
## Testing
|
81
49
|
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
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
|
-
-
|
33
|
-
-
|
34
|
-
-
|
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
|
11
|
-
- Use the most accurate type possible (e.g.,
|
12
|
-
- Prefer `interface` over `type` (e.g.,
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- Prefer async
|
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,58 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.111.3](https://github.com/lobehub/lobe-chat/compare/v1.111.2...v1.111.3)
|
6
|
+
|
7
|
+
<sup>Released on **2025-08-09**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Improve thinking auto scroll style, Support session switch shortcut key, update i18n.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Improve thinking auto scroll style, closes [#8719](https://github.com/lobehub/lobe-chat/issues/8719) ([acec55f](https://github.com/lobehub/lobe-chat/commit/acec55f))
|
21
|
+
- **misc**: Support session switch shortcut key, closes [#8626](https://github.com/lobehub/lobe-chat/issues/8626) ([efc7eaf](https://github.com/lobehub/lobe-chat/commit/efc7eaf))
|
22
|
+
- **misc**: Update i18n, closes [#8725](https://github.com/lobehub/lobe-chat/issues/8725) ([d9642fc](https://github.com/lobehub/lobe-chat/commit/d9642fc))
|
23
|
+
|
24
|
+
</details>
|
25
|
+
|
26
|
+
<div align="right">
|
27
|
+
|
28
|
+
[](#readme-top)
|
29
|
+
|
30
|
+
</div>
|
31
|
+
|
32
|
+
### [Version 1.111.2](https://github.com/lobehub/lobe-chat/compare/v1.111.1...v1.111.2)
|
33
|
+
|
34
|
+
<sup>Released on **2025-08-08**</sup>
|
35
|
+
|
36
|
+
#### ♻ Code Refactoring
|
37
|
+
|
38
|
+
- **pricing**: Introduce new pricing system.
|
39
|
+
|
40
|
+
<br/>
|
41
|
+
|
42
|
+
<details>
|
43
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
44
|
+
|
45
|
+
#### Code refactoring
|
46
|
+
|
47
|
+
- **pricing**: Introduce new pricing system, closes [#8681](https://github.com/lobehub/lobe-chat/issues/8681) ([96b7508](https://github.com/lobehub/lobe-chat/commit/96b7508))
|
48
|
+
|
49
|
+
</details>
|
50
|
+
|
51
|
+
<div align="right">
|
52
|
+
|
53
|
+
[](#readme-top)
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
5
57
|
### [Version 1.111.1](https://github.com/lobehub/lobe-chat/compare/v1.111.0...v1.111.1)
|
6
58
|
|
7
59
|
<sup>Released on **2025-08-08**</sup>
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"improvements": [
|
5
|
+
"Improve thinking auto scroll style, Support session switch shortcut key, update i18n."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-08-09",
|
9
|
+
"version": "1.111.3"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {},
|
13
|
+
"date": "2025-08-08",
|
14
|
+
"version": "1.111.2"
|
15
|
+
},
|
2
16
|
{
|
3
17
|
"children": {
|
4
18
|
"improvements": [
|