Skip to content

Commit

Permalink
add CopilotPayloadConversationContext
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
  • Loading branch information
jfcherng committed Jun 21, 2024
1 parent 703ccb9 commit cc6ccb7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
11 changes: 8 additions & 3 deletions plugin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from .types import (
AccountStatus,
CopilotPayloadCompletions,
CopilotPayloadConversationContext,
CopilotPayloadFeatureFlagsNotification,
CopilotPayloadGetVersion,
CopilotPayloadLogMessage,
Expand Down Expand Up @@ -319,9 +320,13 @@ def _handle_status_notification_notification(self, payload: CopilotPayloadStatus
pass

@request_handler(REQ_CONVERSATION_CONTEXT)
def _handle_conversation_context_request(self, payload, respond: Callable[[Any], None]) -> None:
# {'conversationId': 'e3b0d5e3-0c3b-4292-a5ea-15d6003e7c45', 'turnId': '09ac7601-6c28-4617-b3e4-13f5ff8502b7', 'skillId': 'current-editor'}
print(f'{payload = }')
def _handle_conversation_context_request(
self,
payload: CopilotPayloadConversationContext,
respond: Callable[[Any], None],
) -> None:
print(f"_handle_conversation_context_request {payload = }")
respond(None) # what?

@_guard_view()
@debounce()
Expand Down
6 changes: 3 additions & 3 deletions plugin/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _on_result_conversation_create(self, session, payload) -> None:
)

def _on_result_conversation_turn(self, payload) -> None:
print(payload)
print(f"_on_result_conversation_turn {payload = }")


class CopilotConversationContinueCommand(LspTextCommand):
Expand Down Expand Up @@ -270,7 +270,7 @@ def input(self, plugin: CopilotPlugin, session: Session, args):
)

def _on_result_conversation_turn(self, payload) -> None:
print(payload)
print(f"_on_result_conversation_turn {payload = }")


class CopilotConversationDialogTextInputHandler(sublime_plugin.TextInputHandler):
Expand Down Expand Up @@ -358,7 +358,7 @@ def run(self, plugin: CopilotPlugin, session: Session, _: sublime.Edit, conversa
)

def _on_result_coversation_destroy(self, payload) -> None:
print(payload)
print(f"_on_result_coversation_destroy {payload = }")


class CopilotConversationTurnDeleteCommand(LspTextCommand):
Expand Down
8 changes: 8 additions & 0 deletions plugin/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,11 @@ class CopilotPayloadConversationTemplate(TypedDict, total=True):
class CopilotRequestCoversationAgent(TypedDict, total=True):
id: str
description: str


class CopilotPayloadConversationContext(TypedDict, total=True):
conversationId: str
"""E.g., `"e3b0d5e3-0c3b-4292-a5ea-15d6003e7c45"`."""
turnId: str
"""E.g., `"09ac7601-6c28-4617-b3e4-13f5ff8502b7"`."""
skillId: Literal["current-editor", "project-labels", "recent-files"]

0 comments on commit cc6ccb7

Please sign in to comment.