@@ -13,53 +13,148 @@ val defaultItems: List<SettingItem> = listOf(
1313 SettingItem .Value .ValString (" 工具调用已取消" ),
1414 " 工具调用被取消时的ToolResult"
1515 ),
16+ SettingItem (
17+ SettingKey (" core.agent.tool.response.property.missing" ),
18+ SettingItem .Value .ValString (" %s工具需要属性:%s" ),
19+ " 工具调用缺少属性时的ToolResult"
20+ ),
21+ SettingItem (
22+ SettingKey (" core.agent.tool.response.property.missing" ),
23+ SettingItem .Value .ValString (" %s工具的属性%s必须为%s" ),
24+ " 工具调用属性格式错误时的ToolResult"
25+ ),
1626 // read工具相关配置
27+ // 工具描述
1728 SettingItem (
1829 SettingKey (" core.tool.read.description" ),
1930 SettingItem .Value .ValString (" 读取一个文件,支持获取摘要以及Unicode代码" ),
2031 " read工具的描述,在read工具未激活时展示给llm"
2132 ),
33+ // function描述
2234 SettingItem (
23- SettingKey (" core.tool.read.function.file. description" ),
24- SettingItem .Value .ValString (" 读取一个文件,字符数和总行数受到限制 " ),
35+ SettingKey (" core.tool.read.function.description.file " ),
36+ SettingItem .Value .ValString (" 读取一个文件,最大字符数%s,最大行数%s,返回内容的第一行为文件内容的SHA256,第二行开始是文件内容,注意区分 " ),
2537 " read_file工具的描述"
2638 ),
2739 SettingItem (
28- SettingKey (" core.tool.read.function.summarize. description" ),
29- SettingItem .Value .ValString (" 获取一个文件的摘要,字符数和总行数的限制更宽松,对最小字符数有额外限制 ,在文件较大时使用此工具很合适" ),
40+ SettingKey (" core.tool.read.function.description.summarize " ),
41+ SettingItem .Value .ValString (" 获取一个文件的摘要,最大字符数%s,最小字符数%s,最大行数%s ,在文件较大时使用此工具很合适" ),
3042 " read_summarize工具的描述"
3143 ),
3244 SettingItem (
33- SettingKey (" core.tool.read.function.unicode. description" ),
45+ SettingKey (" core.tool.read.function.description.unicode " ),
3446 SettingItem .Value .ValString (" 读取一个文件但是返回每个字符的Unicode编码,在普通读取看起来没有返回有效内容时使用" ),
3547 " read_unicode工具的描述"
3648 ),
49+ // 属性描述
3750 SettingItem (
38- SettingKey (" core.tool.read.property.file.path.description " ),
51+ SettingKey (" core.tool.read.property.description. file.path" ),
3952 SettingItem .Value .ValString (" 文件的路径,必须为**绝对路径**" ),
4053 " read工具file_path参数的描述"
4154 ),
4255 SettingItem (
43- SettingKey (" core.tool.read.property.start.line.description " ),
56+ SettingKey (" core.tool.read.property.description. start.line" ),
4457 SettingItem .Value .ValString (" 读取文件的开始行号,从1开始" ),
4558 " read工具start_line参数的描述"
4659 ),
4760 SettingItem (
48- SettingKey (" core.tool.read.property.end.line.description " ),
61+ SettingKey (" core.tool.read.property.description. end.line" ),
4962 SettingItem .Value .ValString (" 读取文件的结束行号,不能小于开始行号,可以大于文件总行数" ),
5063 " read工具end_line参数的描述"
5164 ),
65+ // 特定function的属性描述
5266 SettingItem (
53- SettingKey (" core.tool.read.function.summarize.property.prompt.description " ),
67+ SettingKey (" core.tool.read.function.description. summarize.property.prompt" ),
5468 SettingItem .Value .ValString (" 用于总结文件的提示词,调整此字段来要求总结器关注不同细节" ),
5569 " read_summarize工具prompt参数的描述"
5670 ),
5771 SettingItem (
58- SettingKey (" core.tool.read.function.unicode.property.max.chars.description " ),
59- SettingItem .Value .ValString (" 读取文件的前多少个字符 ,这将包括换行符等特殊字符" ),
72+ SettingKey (" core.tool.read.function.description. unicode.property.max.chars" ),
73+ SettingItem .Value .ValString (" 读取文件的前n个字符 ,这将包括换行符等特殊字符,最多%s个字符 " ),
6074 " read_unicode工具max_chars参数的描述"
6175 ),
62- // TODO 错误消息、数值参数
76+ // 错误消息
77+ SettingItem (
78+ SettingKey (" core.tool.read.message.duplicate" ),
79+ SettingItem .Value .ValString (" 读取的文件自上次读取以来未更改,且此次读取范围比上次更小或相同" ),
80+ " read_file工具读取重复内容时的描述"
81+ ),
82+ SettingItem (
83+ SettingKey (" core.tool.read.message.error.too.many.lines" ),
84+ SettingItem .Value .ValString (" 读取的行数过多,上限为%s" ),
85+ " read工具读取过多内容时的描述"
86+ ),
87+ SettingItem (
88+ SettingKey (" core.tool.read.message.error.file.not.found" ),
89+ SettingItem .Value .ValString (" 文件不存在或访问被拒绝" ),
90+ " read工具读取不存在的文件时的描述"
91+ ),
92+ SettingItem (
93+ SettingKey (" core.tool.read.message.error.file.can.not.read" ),
94+ SettingItem .Value .ValString (" 文件是一个二进制文件、文件所使用的编码不支持或文件已损坏" ),
95+ " read工具读取的文件无法解析时的描述"
96+ ),
97+ SettingItem (
98+ SettingKey (" core.tool.read.message.error.start.line" ),
99+ SettingItem .Value .ValString (" start_line必须大于或等于1且为整数" ),
100+ " read工具start_line不合法的描述"
101+ ),
102+ SettingItem (
103+ SettingKey (" core.tool.read.message.error.end.line" ),
104+ SettingItem .Value .ValString (" end_line必须大于或等于start_line且为整数" ),
105+ " read工具end_line不合法的描述"
106+ ),
107+ SettingItem (
108+ SettingKey (" core.tool.read.function.message.error.unicode.too.many.chars" ),
109+ SettingItem .Value .ValString (" 读取的字符数过多,上限为%s" ),
110+ " read_unicode工具读取过多内容时的描述"
111+ ),
112+ SettingItem (
113+ SettingKey (" core.tool.read.function.message.file.truncate" ),
114+ SettingItem .Value .ValString (" <字符数过多,后续内容已被截断(共%s字符),请尝试使用read_summarize工具>" ),
115+ " read_file工具截断位置的描述"
116+ ),
117+ SettingItem (
118+ SettingKey (" core.tool.read.function.message.summarize.output.truncate" ),
119+ SettingItem .Value .ValString (" <总结器输出内容过多,后续内容已被截断(共%s字符),请尝试修改总结器提示词>" ),
120+ " read_summarize工具截断位置的描述"
121+ ),
122+ SettingItem (
123+ SettingKey (" core.tool.read.function.message.summarize.input.truncate" ),
124+ SettingItem .Value .ValString (" <字符数过多,后续内容已被截断(共%s字符)>" ),
125+ " read_summarize工具总结器输入内容截断位置的描述"
126+ ),
127+ // 数值参数
128+ SettingItem (
129+ SettingKey (" core.tool.read.setting.max.lines" ),
130+ SettingItem .Value .ValInt (500 ),
131+ " read工具最大允许行数"
132+ ),
133+ SettingItem (
134+ SettingKey (" core.tool.read.setting.max.chars" ),
135+ SettingItem .Value .ValInt (20000 ),
136+ " read工具最大允许字符数,超出会截断"
137+ ),
138+ SettingItem (
139+ SettingKey (" core.tool.read.setting.max.lines" ),
140+ SettingItem .Value .ValInt (5000 ),
141+ " read_summarize工具最大允许行数"
142+ ),
143+ SettingItem (
144+ SettingKey (" core.tool.read.setting.max.chars" ),
145+ SettingItem .Value .ValInt (200000 ),
146+ " read_summarize工具最大允许字符数,超出会截断"
147+ ),
148+ SettingItem (
149+ SettingKey (" core.tool.read.setting.max.chars" ),
150+ SettingItem .Value .ValInt (500 ),
151+ " read_summarize工具最小允许字符数,小于此会返回错误消息"
152+ ),
153+ SettingItem (
154+ SettingKey (" core.tool.read.setting.max.chars" ),
155+ SettingItem .Value .ValInt (200000 ),
156+ " read_unicode工具最大允许字符数,超出会返回错误消息"
157+ ),
63158)
64159
65160private val json = Json {
@@ -79,5 +174,9 @@ fun serializeToFile(items: List<SettingItem>, outputPath: String) {
79174fun main (args : Array <String >) {
80175 val outputPath = args.firstOrNull()
81176 ? : throw IllegalArgumentException (" Output path is required" )
177+ val duplicates = defaultItems.groupBy { it.key }.filter { it.value.size > 1 }.keys
178+ require(duplicates.isEmpty()) {
179+ " Duplicate SettingKey found: ${duplicates.joinToString { it.value }} "
180+ }
82181 serializeToFile(defaultItems, outputPath)
83182}
0 commit comments