Skip to content

Commit 6d40a0d

Browse files
committed
feat: ai 配置
1 parent ac87c42 commit 6d40a0d

32 files changed

Lines changed: 190 additions & 78 deletions

ai/augment/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
************************************************************************************************************************
2+
Augment
3+
************************************************************************************************************************
4+
5+
据说比 Cursor 和 Cline 体验都好, 但使用它时请注意备份文件.
6+
7+
去官网注册、下载扩展安装上即可. 至于怎么重置机器码……请自行查找方法.

ai/cline/index.rst

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
************************************************************************************************************************
2+
Cline
3+
************************************************************************************************************************
4+
5+
相比于 Cursor, Cline 开源而允许你用自定义 api 进行 agent 功能, 而且无需你额外安装软件.
6+
7+
========================================================================================================================
8+
安装 Cline 插件
9+
========================================================================================================================
10+
11+
如果你没有安装 Cline 插件, 请根据下图安装.
12+
13+
.. figure:: 安装cline.png
14+
15+
========================================================================================================================
16+
配置 Cline
17+
========================================================================================================================
18+
19+
按照下图在各个部分配置 Cline 插件:
20+
21+
.. figure:: 配置API.png
22+
23+
:guilabel:`done` 保存.
24+
25+
在下方, 添加自定义规则:
26+
27+
.. figure:: 配置规则.png
28+
29+
你应该填写以下规则 (见于 `Cline 的文档 <https://github.com/cline/cline/blob/main/docs/prompting/cline-memory-bank.mdx>`_):
30+
31+
.. admonition:: Custom Instructions
32+
:class: dropdown
33+
34+
.. code-block:: text
35+
36+
# Cline's Memory Bank
37+
38+
I am Cline, an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional.
39+
40+
## Memory Bank Structure
41+
42+
The Memory Bank consists of core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:
43+
44+
flowchart TD
45+
PB[projectbrief.md] --> PC[productContext.md]
46+
PB --> SP[systemPatterns.md]
47+
PB --> TC[techContext.md]
48+
49+
PC --> AC[activeContext.md]
50+
SP --> AC
51+
TC --> AC
52+
53+
AC --> P[progress.md]
54+
55+
### Core Files (Required)
56+
1. `projectbrief.md`
57+
- Foundation document that shapes all other files
58+
- Created at project start if it doesn't exist
59+
- Defines core requirements and goals
60+
- Source of truth for project scope
61+
62+
2. `productContext.md`
63+
- Why this project exists
64+
- Problems it solves
65+
- How it should work
66+
- User experience goals
67+
68+
3. `activeContext.md`
69+
- Current work focus
70+
- Recent changes
71+
- Next steps
72+
- Active decisions and considerations
73+
- Important patterns and preferences
74+
- Learnings and project insights
75+
76+
4. `systemPatterns.md`
77+
- System architecture
78+
- Key technical decisions
79+
- Design patterns in use
80+
- Component relationships
81+
- Critical implementation paths
82+
83+
5. `techContext.md`
84+
- Technologies used
85+
- Development setup
86+
- Technical constraints
87+
- Dependencies
88+
- Tool usage patterns
89+
90+
6. `progress.md`
91+
- What works
92+
- What's left to build
93+
- Current status
94+
- Known issues
95+
- Evolution of project decisions
96+
97+
### Additional Context
98+
Create additional files/folders within memory-bank/ when they help organize:
99+
- Complex feature documentation
100+
- Integration specifications
101+
- API documentation
102+
- Testing strategies
103+
- Deployment procedures
104+
105+
## Core Workflows
106+
107+
### Plan Mode
108+
flowchart TD
109+
Start[Start] --> ReadFiles[Read Memory Bank]
110+
ReadFiles --> CheckFiles{Files Complete?}
111+
112+
CheckFiles -->|No| Plan[Create Plan]
113+
Plan --> Document[Document in Chat]
114+
115+
CheckFiles -->|Yes| Verify[Verify Context]
116+
Verify --> Strategy[Develop Strategy]
117+
Strategy --> Present[Present Approach]
118+
119+
### Act Mode
120+
flowchart TD
121+
Start[Start] --> Context[Check Memory Bank]
122+
Context --> Update[Update Documentation]
123+
Update --> Execute[Execute Task]
124+
Execute --> Document[Document Changes]
125+
126+
## Documentation Updates
127+
128+
Memory Bank updates occur when:
129+
1. Discovering new project patterns
130+
2. After implementing significant changes
131+
3. When user requests with **update memory bank** (MUST review ALL files)
132+
4. When context needs clarification
133+
134+
flowchart TD
135+
Start[Update Process]
136+
137+
subgraph Process
138+
P1[Review ALL Files]
139+
P2[Document Current State]
140+
P3[Clarify Next Steps]
141+
P4[Document Insights & Patterns]
142+
143+
P1 --> P2 --> P3 --> P4
144+
end
145+
146+
Start --> Process
147+
148+
Note: When triggered by **update memory bank**, I MUST review every memory bank file, even if some don't require updates. Focus particularly on activeContext.md and progress.md as they track current state.
149+
150+
REMEMBER: After every memory reset, I begin completely fresh. The Memory Bank is my only link to previous work. It must be maintained with precision and clarity, as my effectiveness depends entirely on its accuracy.
151+
152+
然后我们设置 ai 能操控什么内容:
153+
154+
.. figure:: 展开设置.png
155+
156+
========================================================================================================================
157+
初始化项目
158+
========================================================================================================================
159+
160+
在打开一个项目文件夹后, 我们应该先对 Cline 输入 ``initialize memory bank`` 让它初始化.

ai/cline/安装cline.png

130 KB
Loading

ai/cline/展开设置.png

275 KB
Loading

ai/cline/配置API.png

208 KB
Loading

ai/cline/配置规则.png

103 KB
Loading
Lines changed: 12 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
************************************************************************************************************************
2-
另.切换为使用 Cursor
2+
Cursor
33
************************************************************************************************************************
44

5-
Cursor 是一款 ai 编辑器, 我个人感觉其 ai 体验比 VSCode 的 copilot 更好, 而且它还支持自定义 api.
5+
Cursor 是一款 ai 编辑器, 我个人感觉其 ai 体验比 VSCode 的 copilot 更好.
66

77
Cursor 完全 fork 自 VSCode 并对 VSCode 迁移进行了适配, 具体地, 你需要进行以下步骤:
88

@@ -65,88 +65,23 @@ Cursor 完全 fork 自 VSCode 并对 VSCode 迁移进行了适配, 具体地,
6565
.. figure:: 重装中文.png
6666

6767
========================================================================================================================
68-
yolo 模式: 让 Cursor 自动修改你的代码、增删你的文件、帮你的前端代码打开浏览器调试……
68+
agent 模式: 让 Cursor 自动修改你的代码、增删你的文件、帮你的前端代码打开浏览器调试……
6969
========================================================================================================================
7070

71-
我们启用 yolo 模式:
71+
我们启用一些对应的选项:
7272

73-
.. figure:: 启用yolo模式.png
73+
.. figure:: 启用agent模式.png
7474

7575
.. figure:: 同意免责声明.png
7676

77-
之后将会给出一些可自定义的点, 请自行按需求自定义, 也可以不自定义直接使用.
78-
79-
配置好后, 我们通过 :KBD:`Ctrl-Shift-P` 或 :KBD:`Command⌘-Shift-P` 打开命令菜单, 输入 ``toggle chat`` 以找到 :menuselection:`查看: 切换 Chat (View: Toggle Chat)` 以打开 Cursor 的 chat 面板:
80-
81-
.. figure:: chat面板.png
82-
83-
在 chat 面板上有三个模式:
84-
85-
- Chat (默认快捷键 :KBD:`Ctrl-L` 或 :KBD:`Command⌘-L`): 正常的聊天模式, 询问问题然后得到回复.
86-
- Composer (默认快捷键 :KBD:`Ctrl-I` 或 :KBD:`Command⌘-I`): 告诉 ai 你想做什么, **让它自动帮你修改代码、增删文件、打开浏览器、运行测试命令等等.** (你已经是一个成熟的 ai 了, 要学会自己写测试、写代码、运行测试、改代码直到测试通过.)
87-
- Bug Finder: 自动查找当前打开文件夹中有无代码错误.
88-
89-
-------------------------------------------------------------------------------------------------------------------------
90-
告知 ai 要参考的内容
91-
-------------------------------------------------------------------------------------------------------------------------
92-
93-
我们可以告知 ai 要参考哪些内容 (当然在理解的过程中它可能自行查找文件夹中其他部分), 这有很多方式:
94-
95-
- 我们从侧边栏将文件拖动到 chat 窗口中;
96-
- 我们点击输入框上面的 :menuselection:`+ Add context` 来自自行加入一些文件;
97-
- 我们在输入框中输入 ``@`` 然后选择我们要加入的文件、文件夹、代码、文档、错误、网页、图片等;
98-
- 我们复制粘贴要用的文件、文件夹、代码、文档、错误、网页、图片等;
99-
- 仅在 Chat 模式下, 你可以用 :KBD:`Ctrl-回车` 或 :KBD:`Command⌘-回车` 告诉 ai 直接使用文件夹中所有文件.
100-
- ……
101-
102-
-------------------------------------------------------------------------------------------------------------------------
103-
Composer yolo 模式实战
104-
-------------------------------------------------------------------------------------------------------------------------
105-
106-
接下来我将以创建一个网页为例, 展示如何使用 Composer yolo 模式.
107-
108-
首先, 我们切换为 Composer, 选择 claude-3.5-sonnet (2025/1/2 时这是最好的代码 ai), 改为 agent 模式:
109-
110-
.. figure:: 切换到composer_agent.png
111-
112-
然后, 加入我们可能要求 ai 参考的代码 (此处因示例简单, 我没有加入).
113-
114-
最后, 我们给出要求, 按下 :KBD:`回车`:
115-
116-
.. figure:: composer 提要求.png
117-
118-
composer 将会陆续生成结果, 你可以接受或拒绝结果:
119-
120-
.. figure:: 生成结果.png
121-
122-
你也可以在聊天记录中选择回退到某个过程 (此处因为简单, 没有中间过程可以回退):
123-
124-
.. figure:: 回退过程.png
125-
126-
让我们用 VSCode 的预览来看看这个网页:
127-
128-
.. tabs::
129-
130-
.. tab:: 预览按钮
131-
132-
.. figure:: 预览按钮.png
133-
134-
.. tab:: 网页结果
135-
136-
.. figure:: 预览网页.png
137-
138-
.. hint::
139-
140-
你也可以通过 VSCode 自带的时间线来回退文件内容:
141-
142-
.. figure:: 时间线.png
143-
144-
注意, VSCode 时间线只能记录它上面的更改, 如果你在软件之外修改了文件, 那么无药可救.
145-
146-
但是你已经不小心删掉了文件? 别担心, **我们新建一个同名的文件, 就又能看到时间线了**.
77+
配置好后, 我们通过 :KBD:`Ctrl-Shift-P` 或 :KBD:`Command⌘-Shift-P` 打开命令菜单, 输入 ``open chat`` 以找到 :menuselection:`Cursor: Open Chat` 以打开 Cursor 的 chat 面板, 在此即可设置模型等让 ai 为你写代码.
14778

14879
========================================================================================================================
149-
导入新的 VSCode
80+
配置自定义 API
15081
========================================================================================================================
15182

152-
如果需要重新导入 VSCode 配置, 你可以在 Cursor 设置中选择 :menuselection:`import`.
83+
我们从右上角的设置打开 Cursor 设置界面, 选择 :guilabel:`Models`, **关闭所有模型** 然后添加/打开一个你所用自定义 API 支持的模型.
84+
85+
然后我们填写自定义 API 和 API Key, 然后点击 :guilabel:`Verify`, 如果成功, 则 OpenAI API Key 旁边会出现一个开关.
86+
87+
.. figure:: 自定义API.png

0 commit comments

Comments
 (0)