feat: added relavent files as template option
This commit is contained in:
parent
3e1e269b33
commit
8039a18d82
|
@ -4,6 +4,7 @@ import { OpenAI } from "openai";
|
||||||
import { return_current_events } from "../tools/events";
|
import { return_current_events } from "../tools/events";
|
||||||
import { memory_manager_guide } from "../tools/memory-manager";
|
import { memory_manager_guide } from "../tools/memory-manager";
|
||||||
import { searchFilesByTagWithCache } from "../tools/notes";
|
import { searchFilesByTagWithCache } from "../tools/notes";
|
||||||
|
import { semantic_search_notes } from "../tools/notes-vectors";
|
||||||
|
|
||||||
const replaceTemplateStrings = (
|
const replaceTemplateStrings = (
|
||||||
template: string,
|
template: string,
|
||||||
|
@ -30,10 +31,19 @@ export async function buildSystemPrompts(
|
||||||
desc: event.description,
|
desc: event.description,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const potentially_relavent_files = await semantic_search_notes(
|
||||||
|
context_message.content,
|
||||||
|
4
|
||||||
|
);
|
||||||
|
const potentially_relavent_files_paths = potentially_relavent_files.map(
|
||||||
|
(f) => f.metadata.filename
|
||||||
|
);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
memory_guide: memory_manager_guide("self", context_message.author.id),
|
memory_guide: memory_manager_guide("self", context_message.author.id),
|
||||||
events,
|
events,
|
||||||
user_id: context_message.author.id,
|
user_id: context_message.author.id,
|
||||||
|
relavent_files: potentially_relavent_files_paths,
|
||||||
model,
|
model,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ async function getAllFiles(
|
||||||
file.type === "file" &&
|
file.type === "file" &&
|
||||||
!file.basename.startsWith(".") &&
|
!file.basename.startsWith(".") &&
|
||||||
!file.filename.includes("/.obsidian/") &&
|
!file.filename.includes("/.obsidian/") &&
|
||||||
|
!file.filename.includes("prompts/") &&
|
||||||
(file.filename.endsWith(".txt") || file.filename.endsWith(".md"))
|
(file.filename.endsWith(".txt") || file.filename.endsWith(".md"))
|
||||||
) {
|
) {
|
||||||
const content = await webdavClient.getFileContents(file.filename, {
|
const content = await webdavClient.getFileContents(file.filename, {
|
||||||
|
|
Loading…
Reference in New Issue