-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add group UI wrapper #8
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e2e0c6b
add ide service and group ui
yangbobo2021 63ca9b4
Remove unnecessary print statement in
yangbobo2021 2b74ea0
reformat
yangbobo2021 2cf1b03
Refactor UI group function
yangbobo2021 1e8cb3f
Update ui_group function in group.py
yangbobo2021 d2aaa48
Refactor ui_group function to format ui_message as
yangbobo2021 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .services import get_lsp_brige_port | ||
from .services import get_lsp_brige_port, install_python_env, update_slash_commands, open_folder | ||
|
||
__all__ = ["get_lsp_brige_port"] | ||
__all__ = ["get_lsp_brige_port", "install_python_env", "update_slash_commands", "open_folder"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import List, Tuple | ||
|
||
from .iobase import pipe_interaction | ||
from .multi_selections import checkbox_answer | ||
from .single_select import radio_answer | ||
from .text_edit import editor_answer | ||
|
||
|
||
def ui_group(ui_message: List[Tuple]) -> Tuple: | ||
""" | ||
ui_message: List[Tuple] | ||
[ | ||
("editor", "editor ui message", "editor_id"), | ||
("checkbox", "checkbox ui message", ["id1", "id2"]), | ||
("radio", "radio ui message", ["id1", "id2"]), | ||
] | ||
|
||
items in ui_message are created by functions like:make_checkbox_control | ||
""" | ||
ui_message_str = "\n".join([m[1] for m in ui_message]) | ||
|
||
ui_message_str = f"""```chatmark type=form\n{ui_message_str}\n```\n""" | ||
response = pipe_interaction(ui_message_str) | ||
|
||
results = [] | ||
for m in ui_message: | ||
if m[0] == "editor": | ||
result = editor_answer(response, m[2]) | ||
elif m[0] == "checkbox": | ||
result = checkbox_answer(response, m[2]) | ||
elif m[0] == "radio": | ||
result = radio_answer(response, m[2]) | ||
else: | ||
result = None | ||
results.append(result) | ||
return tuple(results) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新增暴露
make_*_control
系列接口 跟前面的ui_*
的区别是什么?像commit.py
里仍用的ui_*
系列,新暴露的函数并没有在外使用,那么他们应该什么时候被用到?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
大概是这样使用:
(check_result, edit_result) = ui_group(
make_check_control(...),
make_editor_control(...)
)
make_checkbox_control用于生成复合UI规范的描述字符串。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把使用示例和效果截图补充到PR description里吧