Skip to content

Commit

Permalink
fix streaming api
Browse files Browse the repository at this point in the history
troubleshoot and fix publishing to websockets
  • Loading branch information
michaeljguarino committed Nov 20, 2024
1 parent 8bdf9fc commit 65672e1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/console/ai/provider/openai.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule Console.AI.OpenAI do
access_key: opts.access_token,
model: opts.model,
base_url: opts.base_url,
stream: Stream.stream()
stream: Stream.stream() |> IO.inspect()
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/console/ai/stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Console.AI.Stream do
def publish(%__MODULE__{topic: topic}, chunk) when is_binary(topic) do
Absinthe.Subscription.publish(
ConsoleWeb.Endpoint,
chunk,
IO.inspect(chunk),
[ai_stream: topic]
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/console/ai/stream/exec.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Console.AI.Stream.Exec do
%AIStream.SSE.Event{data: data}, acc ->
case reducer.(data) do
c when is_binary(c) ->
AIStream.publish(stream, c)
AIStream.publish(stream, c) |> IO.inspect()
{:cont, [c | acc]}
_ -> {:cont, acc}
end
Expand Down

0 comments on commit 65672e1

Please sign in to comment.