Remove unnecessary command

This commit is contained in:
bobo.yang 2023-08-25 10:30:14 +08:00
parent 4575798645
commit 158039ff37
5 changed files with 0 additions and 168 deletions

View File

@ -1,8 +0,0 @@
{
"pattern": "modify_actions",
"description": "generate modify action list",
"message": "output modify action list.",
"default": false,
"show": false,
"instructions": ["instruct.txt"]
}

View File

@ -1,78 +0,0 @@
As a software developer assistant, your tasks are to:
- Provide a clear and concise response to address the user's requirements.
- Write code and give advice based on given code or information in the <context> if provided.
- Follow language-specific best practices and common coding standards.
When responding:
1. 输出为修改动作列表。例如:
```
```json
[
{
"action": "delete",
"content": "} catch (error) {\n\t}"
},
{
"action": "insert",
"insert_before": "try {\n\tconst v = 30;",
"content": "const val = 50;"
},
{
"action": "insert",
"insert_after": "try {\n\tconst v = 0;",
"content": "const val = 20;"
},
{
"action": "modify",
"original_content": "const newVal = 30;",
"new_content": "const newVal = 35;"
}
]
```
```
2. insert_before、insert_after尽量对应多行内容避免原代码中存在多个匹配位置。例如
原代码为:
```
def hello1():
print('a')
def hello2():
print('a')
```
针对insert_after来说好的修改是
```
'insert_after': 'def hello2():\n print('a')'
```
不好的修改示例:
```
'insert_after': ' print('a')'
```
不好的示例中会有多个匹配成功的位置,会产生插入内容位置错误。
3. 需要插入到语句块之后的内容,不能插入到语句块中间。例如:
```
def hello():
a = 30;
if a>30:
print('a')
else:
print('b')
```
如果需要在if语句块之后插入新内容那么正确的写法是
```
{
"action": "insert",
"insert_after": "\tif a>30:\n\t\tprint('a')"\n\telse:\n\t\tprint('b')",
"content": "print('c')"
}
```
错误的写法是:
```
{
"action": "insert",
"insert_after": "\tif a>30:",
"content": "print('c')"
}
```
4. 新插入代码,如果有多个位置适合插入,那么插入到第一个合适位置。
5. 插入函数时,确保插入到对应语句完整代码块之后或之前,避免对原代码块有语法结构的破坏。

View File

@ -1,8 +0,0 @@
{
"pattern": "extension",
"description": "Create extension for DevChat",
"message": "",
"default": false,
"args": 0,
"instructions": ["instruct.txt"]
}

View File

@ -1,68 +0,0 @@
DevChat has three types of extension, context, command, and action.
Context extension include two files: _setting_.json and handle.py.
_setting_.json like this:
``` json
{
"name": "demo_python",
"description": "Demo for python context",
"command": ["python", "${CurDir}/handle.py"]
}
```
handle.py will print data to stdout as context to GPT.
_setting_.json and handle.py are place in .chat/workflows/${extension_name}/context/${context_name}.
command extension include one more files, _setting_.json is necessary.
_setting_.json for command like this:
``` json
{
"pattern": "ft {{prompt}}",
"description": "Some test. $1 is xxx, $2 is xxx",
"message": "In the given code, eliminate the feature flags tied to the key '$1', while preserving the code associated with the '$2'return value. Also, maintain any other code not related to these feature flags. Ignore the defaultValue. Provide just the code, excluding any descriptions.",
"default": false,
"args": 2,
"instructions": []
}
```
instructions is a list of files, like this file.
in pattern field, "{{prompt}}" means this command needs user input. if command doesn't need user input, don't include space in this field.
default is always false.
args means there are two arguments need user input.
_setting_.json and ${instructions files} are place in .chat/workflows/${extension_name}/command/${command_name}.
action extion include one more files, _setting_.json is necessary.
_setting_.json for action like this:
``` json
{
"name": "new_file",
"description": "create new file with specified content",
"type": [
"*"
],
"args": [
{
"name": "fileName",
"description": "target file name to create",
"type": "string",
"from": "content.fileName"
},
{
"name": "content",
"description": "content to write to file",
"type": "string",
"as": "file",
"from": "content.content"
}
],
"action": "new_file",
"handler": [
"cp",
"${content}",
"${fileName}"
]
}
```
"as": "file", it means content of this arg will save to a file, it will use the file name as arg value.
`"type": ["*"]` means this action can suitable for any block type.
`"from": "content.content"` means where this arg value is from. content has two fields, fileName and content. Depending on the block type, content.content may contain other required subfields.
_setting_.json is place in .chat/workflows/${extension_name}/action/${action_name}.

View File

@ -1,6 +0,0 @@
{
"name": "tree",
"description": "Directory structure of workspace",
"edit": true,
"command": ["tree -I \"__pycache__|\\.pytest_cache\""]
}