25/09/24 10:00~11:30 停机维护
This commit is contained in:
@@ -24,8 +24,7 @@ def realtime_response(config: dict, realtime_action: dict) -> None:
|
||||
assert isinstance(bb, Backboard)
|
||||
|
||||
# 统一记历史
|
||||
bb.add_history(realtime_action)
|
||||
|
||||
print(f"backboard action {realtime_action}")
|
||||
rtype = realtime_action.get("type")
|
||||
|
||||
if rtype == "workspaceFolders":
|
||||
@@ -35,7 +34,7 @@ def realtime_response(config: dict, realtime_action: dict) -> None:
|
||||
file_path = realtime_action.get("filePath")
|
||||
bb.active_file_path = file_path
|
||||
assert isinstance(file_path, str)
|
||||
with open(os.path.join(bb.root_path, bb.active_file_content), "r", encoding="utf-8") as f:
|
||||
with open(os.path.join(bb.root_path, bb.active_file_path), "r", encoding="utf-8") as f:
|
||||
bb.active_file_content = f.read()
|
||||
|
||||
elif rtype == "paste":
|
||||
@@ -43,16 +42,16 @@ def realtime_response(config: dict, realtime_action: dict) -> None:
|
||||
assert isinstance(file_path, str)
|
||||
bb.pasted_file_path = file_path
|
||||
bb.pasted_content = realtime_action.get("content")
|
||||
bb.active_file_path = file_path
|
||||
with open(os.path.join(bb.root_path, bb.active_file_content), "r", encoding="utf-8") as f:
|
||||
with open(os.path.join(bb.root_path, bb.active_file_path), "r", encoding="utf-8") as f:
|
||||
bb.active_file_content = f.read()
|
||||
|
||||
elif rtype == "fileEdit":
|
||||
file_path = realtime_action.get("filePath")
|
||||
assert isinstance(file_path, str)
|
||||
bb.active_file_path = file_path
|
||||
with open(os.path.join(bb.root_path, bb.active_file_content), "r", encoding="utf-8") as f:
|
||||
with open(os.path.join(bb.root_path, bb.active_file_path), "r", encoding="utf-8") as f:
|
||||
bb.active_file_content = f.read()
|
||||
|
||||
|
||||
action_without_config = realtime_action.copy()
|
||||
action_without_config.pop('config', None) # 使用pop并设置默认值None,避免键不存在时出错
|
||||
bb.add_history(action_without_config)
|
||||
chatmanager.upload_bb()
|
||||
Reference in New Issue
Block a user