JXA documentation?

If I am writing an AppleScript as part of a smart rule, I can view the AppleScript dictionary from Script Editor. I can’t find an equivalent for JXA, which means I can’t find how to do `set theResponse to get chat response for message thePrompt record (theRecord) mode “vision” temperature 0` in JXA.

I don’t want to do this in AppleScript because I then need to perform search and replace on the result, and AppleScript never bothered to implement that — String.replace is a whole lot easier than trying to work around AppleScript’s limitations!

Is there a JXA equivalent of the AppleScript dictionary? If not, please could there be one? (Ideally, there’s be some way of getting autocomplete working in Zed/VSCode, too…)

(And how do I do a chat query in JXA?)

Set the language selector in the upper toolbar to “JavaScript”.
Perhaps Scripting with JXA | JavaScript for Automation (JXA) is useful, too.

1 Like

Thanks — I have to admit I hadn’t noticed the dictionary actually had the JavaScript examples as well :man_facepalming:

But that link will definitely be helpful too!