Skip to content

Commit c15810d

Browse files
Fix bugs in code genesis (#813)
1 parent 40c4f8f commit c15810d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

ms_agent/memory/condenser/code_condenser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ class CodeCondenser(Memory):
6868
}
6969
],
7070
"functions": [...], # 结构和上面functions相同,用于列举不在类中的方法
71+
"styles": [ # css等类型的样式信息,保留所有id的结构、类型和名称
72+
{
73+
"name": "some-key", # class/id name
74+
"type": "component", # usage
75+
"description": "..."
76+
}
77+
]
7178
"protocols": [
7279
{
7380
"type": "http",

projects/code_genesis/coding.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ prompt:
2929
* 尽量不用`read_file`或者`list_files`以减少token用量,如果使用read_file,你必须指定`start_line`和`end_line`参数部分读取减少token使用
3030
* 编写http等RPC调用代码需要调用`url_search`工具来确认协议细节,该工具可以传入keywords来搜索url找到你可能会用到的api列表,不要调用不存在的api接口
3131
4. 编写代码
32+
* 在编写代码之前,你应当梳理你的代码文件需要完成的功能以及和整体项目的关系
33+
```
34+
我需要编写...,该文件作用... 我应该触发... 完成...
35+
```
3236
* 如果你需要编写的组件或功能在文件列表中不存在,你应当在你负责的文件中冗余编写,而不要指定引用一个不存在的其他文件
37+
* 如果你的代码包含前端代码,注意你需要引用的css文件,保持你的界面美观高档
3338
* 不允许依赖index大于等于你的其他代码文件
3439
* 如果你需要mock初始化数据,除非显示要求,否则不要超过5条
3540
* 注意命名导出或默认导出方式

projects/code_genesis/workflow/coding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def _before_import_check(self, messages):
119119
code = ''
120120

121121
if not code_file:
122+
messages.pop(-1)
122123
self.stop_nothing()
123124
return
124125

@@ -365,7 +366,7 @@ def add_unchecked_file(self, untrack_file):
365366
def increment_unchecked_file(self):
366367
for key in list(self.unchecked_files.keys()):
367368
self.unchecked_files[key] = self.unchecked_files[key] + 1
368-
if self.unchecked_files[key] > 3:
369+
if self.unchecked_files[key] > 99: # no limit
369370
self.unchecked_files.pop(key)
370371
logger.error(
371372
f"Unchecked file {key} still have problem:\n{self.unchecked_issues.get('key')}\n"

0 commit comments

Comments
 (0)