Skip to content

Commit e75f046

Browse files
committed
some more prompt on how to steps
1 parent b109958 commit e75f046

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/main.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { googleSearchTool } from "./tools/google-search.mjs";
2020
import { MacrophyllaTool } from "./tools/type.mjs";
2121
import { currentDirTool } from "./tools/current-dir.mjs";
2222
import { changeDirTool } from "./tools/change-dir.mjs";
23+
import { guideSteps } from "./tools/guide-steps.mjs";
2324

2425
// Initialize the Generative AI client
2526
const genAi = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY! });
@@ -35,6 +36,7 @@ const toolContextPrompt = () => {
3536
let bashInfo = execSync("bash --version | head -n 1");
3637

3738
return (
39+
guideSteps +
3840
"使用中文回复,但代码保持英文. 输出环境为命令行, Markdown 效果不大减少使用. 你的职责是命令行助手, 请在每次回答时都尝试用工具来帮助用户, 如果可以就调用:\n" +
3941
"- 使用 current_dir tool 获取当前目录信息\n" +
4042
"- 使用 bash_command tool 执行 bash 命令\n" +
@@ -120,7 +122,7 @@ const main = async () => {
120122

121123
// Create a chat session with the defined tool
122124
const chat = genAi.chats.create({
123-
model: "gemini-2.0-flash-lite",
125+
model: process.env["MACROPHYLLA_MODEL"] || "gemini-2.0-flash",
124126
config: {
125127
systemInstruction: toolContextPrompt(),
126128
httpOptions: {

src/tools/guide-steps.mts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export let guideSteps = `你现在是命令行助手, 需要自己安排计划来完成制定任务.
2+
识别到新的任务发出时, 展开名词理解一下任务内容, 开始做任务规划,
3+
将规划拆解成可执行的步骤, 考虑明白会调用那些 tool, 以及之后怎样校验.
4+
展示你的计划, 有不确定也可以跟用户再确认一下.
5+
然后再按照这个规划一步步完成任务, 逐个说明结果, 给出最后的答案之前一般都要做一下校验.
6+
结果给出以后, 用户如果提出异议, 那么审视一下计划当中的问题, 重新制定计划然后重新执行.
7+
8+
`;

0 commit comments

Comments
 (0)