Skip to content

Commit

Permalink
refactor: tidy codes
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
  • Loading branch information
jfcherng committed Aug 17, 2024
1 parent fe5e2c8 commit 0e0ae63
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions plugin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,26 +320,26 @@ def update_status_bar_text(self, extra_variables: dict[str, Any] | None = None)

def on_server_notification_async(self, notification: Notification) -> None:
if notification.method == "$/progress":
if (token := notification.params["token"]) and token.startswith("copilot_chat://"):
if params := notification.params["value"]:
if not (window := WindowConversationManager.find_window_by_token_id(token)):
return

wcm = WindowConversationManager(window)
if params.get("kind", None) == "end":
wcm.is_waiting = False
if (
(token := notification.params["token"]).startswith("copilot_chat://")
and (params := notification.params["value"])
and (window := WindowConversationManager.find_window_by_token_id(token))
):
wcm = WindowConversationManager(window)
if params.get("kind", None) == "end":
wcm.is_waiting = False

if suggest_title := params.get("suggestedTitle", None):
wcm.suggested_title = suggest_title
if suggest_title := params.get("suggestedTitle", None):
wcm.suggested_title = suggest_title

if params.get("reply", None):
wcm.append_conversation_entry(params)
if params.get("reply", None):
wcm.append_conversation_entry(params)

if followup := params.get("followUp", None):
message = followup.get("message", "")
wcm.follow_up = message
if followup := params.get("followUp", None):
message = followup.get("message", "")
wcm.follow_up = message

wcm.update()
wcm.update()

@notification_handler(NTFY_FEATURE_FLAGS_NOTIFICATION)
def _handle_feature_flags_notification(self, payload: CopilotPayloadFeatureFlagsNotification) -> None:
Expand Down

0 comments on commit 0e0ae63

Please sign in to comment.