This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-21
Channels
- # adventofcode (8)
- # announcements (20)
- # babashka (43)
- # beginners (8)
- # biff (12)
- # calva (2)
- # cider (5)
- # clerk (6)
- # clj-commons (12)
- # clj-kondo (16)
- # clojure (20)
- # clojure-denver (1)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (105)
- # clojure-uk (2)
- # clojuredesign-podcast (5)
- # clojurescript (29)
- # datomic (2)
- # hyperfiddle (13)
- # jackdaw (1)
- # jobs (4)
- # jobs-discuss (4)
- # lsp (2)
- # malli (12)
- # pathom (2)
- # pedestal (1)
- # re-frame (22)
- # shadow-cljs (37)
- # squint (28)
- # xtdb (28)
- # yamlscript (4)
I’ve never used cljs, only clojure, but now that I know some JS I want to give it a shot. I want to create a shadow-cljs project and import mistralai. I cannot seem to get things working, just trying to replicate the code in the chat completions example here. It doesn’t seem to recognize the mistralai import. Can anyone advise me on how I should be setting up my shadow-cljs.edn or index.cljs file differently? https://docs.mistral.ai/platform/client
js/
prefix is reserved for revering to global variables, and is therefore incorrect in this case. You just use MistralClient
instead here, since that is the thing your required in the ns
the js-await
use is also incorrect, see https://clojureverse.org/t/promise-handling-in-cljs-using-js-await/8998
also the build config is mostly nonsense, please actually follow the documentation for the specific target. you cannot just use a :browser
config and swap the :target
. https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-script
Thank you! I’m gonna try this all out when I’m at my computer.
Besides the js-await issue I think you also want (.chat client ,,,)
instead of (.-chat client ,,,)
.-
is for accessing properties, .
is for invoking properties as functions.
And probably the options passed to that function are expected to be JS so may want to wrap that map with :model
in it in (clj->js ,,,)
Hey What is the most straight forward way to use your own version of a ClojureScript dep? Say I wanna fork a repo and use my fork instead of the maven dependency. My shadow-cljs.edn looks like this
;; shadow-cljs configuration
{:source-paths
["cljs/"]
:dependencies
[[cjohansen/dumdom "2023.11.06"]
;; For time literals and parsing edn time literals from the backend
[com.widdindustries/time-literals "0.1.10"]
[tick "0.7.5"]
;;
[cider/cider-nrepl "0.44.0"]
[refactor-nrepl/refactor-nrepl "3.9.0"]
]
;;
:nrepl {:middleware [cider.nrepl/cider-middleware
refactor-nrepl.middleware/wrap-refactor]
:port 3012}
:builds
{:frontend
{:target :browser
:output-dir "target/resources/public/cljs"
:asset-path "/cljs"
:modules {:cljs {:init-fn ing.beij.cljs/init}}}}}
and i wanna replace [cjohansen/dumdom "2023.11.06"]
with https://github.com/olavfosse/dumdom.
Thanks!Thanks!