Skip to content

Commit

Permalink
replace pp with full version, somehow compiling with pprint under a f…
Browse files Browse the repository at this point in the history
…unction does not work
  • Loading branch information
sid597 committed Feb 25, 2024
1 parent a168c17 commit b3d58fd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/main/ui/actions/chat.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
:content (str (extract-from-code-block msg-str))})))))

(p (str pre "Calling openai api, with settings :"))
;(pp settings)
(cljs.pprint/pprint settings)
(p (str pre "and messages :"))
;(pp @message-by-role)
(cljs.pprint/pprint @message-by-role)
(p (str pre "Counting tokens for message:"))
(count-tokens-api {:message @message-by-role
:model (:model settings)
Expand All @@ -41,7 +41,7 @@
:callback (fn [response]
(println "received response from llm")
(p (str pre "openai api response received:"))
;(pp response)
(cljs.pprint/pprint response)
(let [res-str (-> response
:body)]
(create-new-block m-uid "last" (str "Assistant: " res-str) (js/setTimeout
Expand Down Expand Up @@ -74,7 +74,7 @@
c-uid (:uid chat)
count (count children)]
(p (str pre "for these: "))
;(pp children)
(cljs.pprint/pprint children)
(go
(doseq [child children]
^{:key child}
Expand All @@ -96,7 +96,7 @@
(clojure.string/join "\n -----" (data-for-pages res get-linked-refs?))
"```")]
(p (str pre "extracted data from query pages:"))
;(pp page-data)
(cljs.pprint/pprint page-data)
(create-new-block
m-uid
order
Expand All @@ -117,7 +117,7 @@
get-linked-refs?))
"```")]
(p (str pre "extracted data for the page:"))
;(pp page-data)
(cljs.pprint/pprint page-data)
(create-new-block
m-uid
order
Expand Down
8 changes: 4 additions & 4 deletions src/main/ui/actions/graph_overview_ai.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
chat-block-uid
true
(do
(p (str pre "Created a new chat block and opening in sidebar with context: "))))
;(pp context-structure)))
(p (str pre "Created a new chat block and opening in sidebar with context: "))
(cljs.pprint/pprint context-structure)))
(create-struct
(chat-ui-with-context-struct chat-block-uid context-block-uid context-structure)
(get-todays-uid)
chat-block-uid
true
(do
(p (str pre "Created a new chat block under `AI chats` block and opening in sidebar with context: ")))))))
;(pp context-structure))))))
(p (str pre "Created a new chat block under `AI chats` block and opening in sidebar with context: "))
(cljs.pprint/pprint context-structure))))))
10 changes: 5 additions & 5 deletions src/main/ui/components/bottom_bar.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{:s ""}]
ai-block? (ai-block-exists? open-page-uid)]
(p (str pre "block with `AI chats` exist? " ai-block?))
;(pp context)
(cljs.pprint/pprint context)

;(println "open page uid" open-page-uid)
;(println "page title" page-title)
Expand All @@ -57,16 +57,16 @@
chat-block-uid
true
(do
(p (str pre "Created a new chat block and opening in sidebar with context: "))))
;(pp context)))
(p (str pre "Created a new chat block and opening in sidebar with context: "))
(cljs.pprint/pprint context)))
(create-struct
(chat-ui-with-context-struct chat-block-uid nil context-struct)
open-page-uid
chat-block-uid
true
(do
(p (str pre "Created a new chat block under `AI chats` block and opening in sidebar with context: "))))))))}
;(pp context)))))))}
(p (str pre "Created a new chat block under `AI chats` block and opening in sidebar with context: "))
(cljs.pprint/pprint context)))))))}
"Chat with this page"]]
[:> Divider]
[:div
Expand Down
6 changes: 3 additions & 3 deletions src/main/ui/components/quick_buttons.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@
(<p! (js/Promise.
(fn [_]
(p (str pre "Calling openai api, with settings :"))
;(pp settings)
(cljs.pprint/pprint settings)
(p (str pre "and messages :"))
;(pp messages)
(cljs.pprint/pprint messages)
(p (str pre "Now sending message and wait for response ....."))
(call-openai-api
{:messages messages
:settings settings
:callback (fn [response]
(p (str pre "openai api response received:"))
;(pp response)
(cljs.pprint/pprint response)
(let [res-str (-> response
:body)]
(update-block-string
Expand Down
4 changes: 2 additions & 2 deletions src/main/ui/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
t? (:t struct)
res (atom [top-parent])]
(p pre)
;(pp struct)
(cljs.pprint/pprint struct)
(p (str pre "open in sidebar?") open-in-sidebar?)
(go
(while (not-empty @stack)
Expand All @@ -330,7 +330,7 @@
(if (some? t)
(<p! (create-new-page t (if (some? u) u new-uid)))
(<p! (create-new-block-with-id args)))
;(cljs.pprint/pprint args)
(cljs.pprint/pprint args)
(swap! res rest)
(swap! res #(vec (concat % (vec (repeat (count (:c cur))
(if (some? (:u cur))
Expand Down

0 comments on commit b3d58fd

Please sign in to comment.