-
Notifications
You must be signed in to change notification settings - Fork 1
feat(adapters): log init for gchat + github, include registered adapters in not-found error #96
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1501,7 +1501,11 @@ def channel(self, channel_id: str) -> ChannelImpl: | |||||||||||||||||||
| raise ChatError(f"Invalid channel ID: {channel_id}") | ||||||||||||||||||||
| adapter = self._adapters.get(adapter_name) | ||||||||||||||||||||
| if adapter is None: | ||||||||||||||||||||
| raise ChatError(f'Adapter "{adapter_name}" not found for channel ID "{channel_id}"') | ||||||||||||||||||||
| registered = sorted(self._adapters.keys()) | ||||||||||||||||||||
| raise ChatError( | ||||||||||||||||||||
| f'Adapter "{adapter_name}" not found for channel ID "{channel_id}" ' | ||||||||||||||||||||
| f"(registered adapters: {registered})" | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
Comment on lines
1503
to
+1508
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic for raising an error when an adapter is not found is duplicated in the thread method. To improve maintainability and avoid code duplication, consider extracting this into a private helper method. You will also need to import NoReturn from typing.
Suggested change
|
||||||||||||||||||||
| return ChannelImpl( | ||||||||||||||||||||
| _ChannelImplConfigWithAdapter( | ||||||||||||||||||||
| id=channel_id, | ||||||||||||||||||||
|
|
@@ -1559,7 +1563,11 @@ def thread( | |||||||||||||||||||
|
|
||||||||||||||||||||
| adapter = self._adapters.get(adapter_name) | ||||||||||||||||||||
| if adapter is None: | ||||||||||||||||||||
| raise ChatError(f'Adapter "{adapter_name}" not found for thread ID "{thread_id}"') | ||||||||||||||||||||
| registered = sorted(self._adapters.keys()) | ||||||||||||||||||||
| raise ChatError( | ||||||||||||||||||||
| f'Adapter "{adapter_name}" not found for thread ID "{thread_id}" ' | ||||||||||||||||||||
| f"(registered adapters: {registered})" | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
Comment on lines
1565
to
+1570
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned in my other comment, you can use the new _raise_adapter_not_found helper method here to reduce code duplication.
Suggested change
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| # Defer to the adapter to derive channel_id as a secondary sanity | ||||||||||||||||||||
| # check — some platform-specific patterns can pass the structural | ||||||||||||||||||||
|
|
||||||||||||||||||||
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.
Fix formatter drift in this file before merge.
ruff format --checkis failing forsrc/chat_sdk/chat.py, so CI will stay red until this file is formatted.Also applies to: 1566-1570
🤖 Prompt for AI Agents