Skip to content

Commit 4736f78

Browse files
committed
Change example to use vthread
1 parent 5b9ec77 commit 4736f78

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/src/simulflow_examples/local.clj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
(:require
44
[clojure.core.async :as a]
55
[clojure.core.async.flow :as flow]
6+
[simulflow.async :refer [vthread-loop]]
67
[simulflow.processors.deepgram :as deepgram]
78
[simulflow.processors.elevenlabs :as xi]
89
[simulflow.processors.llm-context-aggregator :as context]
@@ -161,13 +162,12 @@
161162
(reset! flow-started? true)
162163
;; Resume local ai -> you can now speak with the AI
163164
(flow/resume local-ai)
164-
(a/thread
165-
(loop []
166-
(when @flow-started?
167-
(when-let [[msg c] (a/alts!! [report-chan error-chan])]
168-
(when (map? msg)
169-
(t/log! {:level :debug :id (if (= c error-chan) :error :report)} msg))
170-
(recur))))))
165+
(vthread-loop []
166+
(when @flow-started?
167+
(when-let [[msg c] (a/alts!! [report-chan error-chan])]
168+
(when (map? msg)
169+
(t/log! {:level :debug :id (if (= c error-chan) :error :report)} msg))
170+
(recur)))))
171171

172172
;; Stop the conversation
173173
(do

0 commit comments

Comments
 (0)