更新思維鏈工具的提示內容,新增停止思考的條件說明,並調整思維資料結構的驗證邏輯,提升用戶在思考過程中的靈活性與清晰度。

This commit is contained in:
siage 2025-04-15 21:03:56 +08:00
parent 3ee32e5f73
commit 072ec4321f
2 changed files with 35 additions and 49 deletions

View File

@ -187,7 +187,7 @@ async function main() {
// 註冊思維鏈工具 // 註冊思維鏈工具
server.tool( server.tool(
"process_thought", "process_thought",
"你可以透過靈活的、可適應和發展的思考過程來分析問題,隨著理解的加深,每個想法都可以建立、質疑或修改先前的見解。你可以質疑想法、假設想法、驗證想法,並且可以建立新的想法。你將重複這個過程,直到你對問題有足夠的理解,並且能夠提出有效的解決方案。", "你可以透過靈活的、可適應和發展的思考過程來分析問題,隨著理解的加深,每個想法都可以建立、質疑或修改先前的見解。你可以質疑想法、假設想法、驗證想法,並且可以建立新的想法。你將重複這個過程,直到你對問題有足夠的理解,並且能夠提出有效的解決方案。如果你覺得思考已經充分可以把 nextThoughtNeeded 設為 false 並且停止思考。",
processThoughtSchema.shape, processThoughtSchema.shape,
async (args) => { async (args) => {
return await processThought(args); return await processThought(args);

View File

@ -1,47 +1,6 @@
import { z } from "zod"; import { z } from "zod";
import { ThoughtData, ThoughtStage } from "../types/index.js"; import { ThoughtData, ThoughtStage } from "../types/index.js";
/**
*
*/
const thoughtDataSchema = z.object({
thought: z
.string()
.min(1, {
message: "思維內容不能為空,請提供有效的思考內容",
})
.describe("思維內容"),
thoughtNumber: z
.number()
.int()
.positive({
message: "思維編號必須是正整數",
})
.describe("思維編號"),
totalThoughts: z
.number()
.int()
.positive({
message: "總思維數必須是正整數",
})
.describe("總思維數"),
nextThoughtNeeded: z.boolean().describe("是否需要更多思維"),
stage: z
.nativeEnum(ThoughtStage, {
message: "思維階段不能為空,請提供有效的思考階段",
})
.describe("思維階段"),
tags: z.array(z.string()).optional().describe("思維標籤,是一個陣列字串"),
axioms_used: z
.array(z.string())
.optional()
.describe("使用的公理,是一個陣列字串"),
assumptions_challenged: z
.array(z.string())
.optional()
.describe("挑戰的假設,是一個陣列字串"),
});
/** /**
* *
* @param thoughtData * @param thoughtData
@ -97,14 +56,41 @@ function formatThought(thoughtData: ThoughtData): string {
* processThought工具的參數結構 * processThought工具的參數結構
*/ */
export const processThoughtSchema = z.object({ export const processThoughtSchema = z.object({
thought: z.string().describe("思維內容"), thought: z
thought_number: z.number().int().positive().describe("當前思維編號"), .string()
total_thoughts: z.number().int().positive().describe("預計總思維數量"), .min(1, {
message: "思維內容不能為空,請提供有效的思考內容",
})
.describe("思維內容"),
thought_number: z
.number()
.int()
.positive({
message: "思維編號必須是正整數",
})
.describe("當前思維編號"),
total_thoughts: z
.number()
.int()
.positive({
message: "總思維數必須是正整數",
})
.describe("預計總思維數量"),
next_thought_needed: z.boolean().describe("是否需要下一步思維"), next_thought_needed: z.boolean().describe("是否需要下一步思維"),
stage: z.string().describe("思考階段"), stage: z
tags: z.array(z.string()).optional().describe("思維標籤"), .nativeEnum(ThoughtStage, {
axioms_used: z.array(z.string()).optional().describe("使用的公理"), message: "思維階段不能為空,請提供有效的思考階段",
assumptions_challenged: z.array(z.string()).optional().describe("挑戰的假設"), })
.describe("思考階段"),
tags: z.array(z.string()).optional().describe("思維標籤,是一個陣列字串"),
axioms_used: z
.array(z.string())
.optional()
.describe("使用的公理,是一個陣列字串"),
assumptions_challenged: z
.array(z.string())
.optional()
.describe("挑戰的假設,是一個陣列字串"),
}); });
/** /**