Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Templater when creating new notes #209

Open
taurr opened this issue Oct 29, 2023 · 4 comments
Open

Support Templater when creating new notes #209

taurr opened this issue Oct 29, 2023 · 4 comments

Comments

@taurr
Copy link

taurr commented Oct 29, 2023

it would be really nice if we had support for Templater templates when generating into a new Note.

@Martin-Milbradt
Copy link

I'd also like this!
It already provides syntax for this, we "only" need a command.

app.commands.executeCommandById(command)

@taurr
Copy link
Author

taurr commented Nov 3, 2023

Syntax for it — how?

@Martin-Milbradt
Copy link

I found it. This calls textgenerator from Templater:

<%* await app.commands.executeCommandById("obsidian-textgenerator-plugin:generate-text") %>

But I'm not sure how to configure what gets passed. Since a call to the OpenAI API is not too complicated, I just wrote my own script, feel free to take it as basis for whatever you want to do: https://github.com/TrueMilli/Obsidian-Templates/blob/main/Templater%20Scripts/describe.js

Here's how you call it.

<% await tp.user.describe(title, creator, year) %>

In case you want to fiddle around with text generator:
This dataview gives you all commands available to you (considering YOUR plugins): https://forum.obsidian.md/t/dataviewjs-snippet-showcase/17847/37

Let me know how it goes for you!

@haouarihk
Copy link
Collaborator

haouarihk commented Jan 10, 2024

we have a exposed API
for anyone to use
https://docs.text-gen.com/_notes/2-+Options/Plugin+API

you can also use it like

PluginApi.tg.gen("whatever")

if you can't import the pluginApi

and tell me if i can close this issue
its better to save it in a discord help thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants