Skip to content

Commit 9ffb538

Browse files
committed
Only respond in a thread for same room destination
1 parent f0994ce commit 9ffb538

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/cog/pipeline/output_sink.ex

+12-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,18 @@ defmodule Cog.Pipeline.OutputSink do
150150

151151
defp send_to_adapter({type, targets}, signal, state) do
152152
output = output_for(type, signal, nil)
153-
Enum.each(targets, &ChatAdapter.send(state.conn, &1.provider, &1.room, output, state.request.metadata))
153+
metadata = state.request.metadata
154+
155+
Enum.each(targets, fn target ->
156+
metadata = case target.room.id == state.request.room.id do
157+
true ->
158+
metadata
159+
false ->
160+
%{metadata | thread_id: nil}
161+
end
162+
163+
ChatAdapter.send(state.conn, target.provider, target.room, output, metadata)
164+
end)
154165
end
155166

156167
defp early_exit_response(%DoneSignal{}=signal, state) do

0 commit comments

Comments
 (0)