Skip to content

Commit ec02c15

Browse files
Fix a bug with un-nmaed branches in sequential thiking
1 parent 9618c54 commit ec02c15

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

functions/sequentialthinking/init.clj

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
[m]
2727
(if (not (s/valid? ::thought-data m))
2828
(throw (ex-info "Invalid thought data" (s/explain-data ::thought-data m)))
29-
(let [thought-history (json/parse-string (slurp "thought-history.json") keyword)
30-
branches (json/parse-string (slurp "branches.json") keyword)]
29+
(let [thought-history (try (json/parse-string (slurp "/sequentialthining/thought-history.json") keyword) (catch Throwable _ []))
30+
branches (try (json/parse-string (slurp "branches.json") keyword) (catch Throwable _ {}))]
3131
(spit "/sequentialthinking/thought-history.json"
3232
(json/generate-string
3333
(conj thought-history (cond-> m
@@ -43,7 +43,7 @@
4343

4444
(defn -main [& args]
4545
(try
46-
(-> (json/parse-string (first args))
46+
(-> (json/parse-string (first args) keyword)
4747
(process-thought)
4848
(json/generate-string)
4949
(println))

0 commit comments

Comments
 (0)