Using Smart Connections with Text Generator (another Obsidian Plugin) #551
Unanswered
neojininja
asked this question in
Q&A
Replies: 2 comments
-
For me, the latest version of Smart-Connections requires a slightly different template: Original: ...
const contextResults = await Promise.all(
results.slice(0, 5).map(r =>
app.plugins.plugins["smart-connections"].file_retriever(r.link, { lines: 10, max_chars: 1000 })
)
);
... Working: ...
const contextResults = await Promise.all(
results.slice(0, 5).map(r =>
app.plugins.plugins["smart-connections"]
.brain.smart_blocks.get(r.link, { lines: 10, max_chars: 1000 })
.get_as_context()
)
);
... |
Beta Was this translation helpful? Give feedback.
0 replies
-
Here's my current working version, haven't thought of a better way to filter out the current note's from the smart blocks, but here's a simple way. const query = this.tg_selection;
const results = await window['SmartSearch'].search(query);
// Get the source_key of the current note (assuming it's the first result in the array)
const currentNoteSourceKey = results[0].source_key; // Change this if the current note isn't always the first result
// Filter out results that have the same source_key as the current note
const filteredResults = results.filter(r => r.source_key !== currentNoteSourceKey);
const contextResults = await Promise.all(
filteredResults
.slice(0, 3).map(r =>
app.plugins.plugins["smart-connections"]
.env.smart_blocks.get(r.key)
.get_as_context()
)
);
const context = contextResults.join('\n\n'); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I'm very interested in learning how to use Smart Connections with the Text Generator Plugin. Someone has already made an attempt at this but it's not working for me. I've provided error screenshots below and also the reference information I used. Any insight to make this work is greatly appreciated! Thank you in advance.
Here's a quote from someone who got this working on Discord
To contribute with updated code request, we will take the original script provided and modify it according to the suggestion made. The modification involves updating a specific API call within the script to ensure compatibility. Here's how the revised script looks:
And here's the one in Github:
Source: https://github.com/text-gen/tg-smartConnections/blob/main/prompts/summarize.md
promptId: summarize
name: 🗞️Summarize The Results of Smart Connections
description: summarize
author: Noureddine
tags:
version: 0.0.1
disableProvider: true
provider:
{{#script}}
{{/script}}
This input template is currently disabled due to the 'disabledProvider' setting being set to true.
If you wish to utilize this template with a provider, such as Chatbot or another service, please follow these steps:
{{#script}}
{{/script}}
Beta Was this translation helpful? Give feedback.
All reactions