|
@@ -1819,6 +1819,15 @@ class ChattoAdapter(BasePlatformAdapter):
|
|
|
thread_info = msg.get("thread", {})
|
|
thread_info = msg.get("thread", {})
|
|
|
if thread_info and str(thread_info.get("threadRootEventId", "")) != msg_id:
|
|
if thread_info and str(thread_info.get("threadRootEventId", "")) != msg_id:
|
|
|
thread_id = str(thread_info.get("threadRootEventId", ""))
|
|
thread_id = str(thread_info.get("threadRootEventId", ""))
|
|
|
|
|
+ # Hermes SDK: Propagate thread context if thread_id is set
|
|
|
|
|
+ try:
|
|
|
|
|
+ # Hermes injects the SDK into the plugin context as self.sdk
|
|
|
|
|
+ propagate_context_to_thread = self.sdk.thread_context.propagate_context_to_thread
|
|
|
|
|
+ propagate_context_to_thread(thread_id)
|
|
|
|
|
+ except AttributeError:
|
|
|
|
|
+ logger.debug("Hermes SDK thread_context not available in plugin context")
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ logger.warning("Failed to propagate thread context: %s", e, exc_info=True)
|
|
|
|
|
|
|
|
source = self.build_source(
|
|
source = self.build_source(
|
|
|
chat_id=room_id,
|
|
chat_id=room_id,
|