Skip to content

Commit

Permalink
feat(plugin/chat/analysis): do not give option to add to context
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminshafii committed Jan 1, 2025
1 parent 0d938e1 commit 8967c90
Showing 1 changed file with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import React, { useState } from "react";
import { TFile, TFolder } from "obsidian";
import { ToolHandlerProps } from "./types";
import { addFileContext } from "../use-context-items";

interface FolderStructure {
name: string;
type: "folder";
children: (FolderStructure | FileStructure)[];
depth: number;
}

interface FileStructure {
name: string;
type: "file";
depth: number;
}


export function OnboardHandler({
toolInvocation,
Expand Down Expand Up @@ -47,7 +36,6 @@ export function OnboardHandler({
path: string,
depth = 0,
maxDepth = 3,
shouldAddToContext = false
) => {
const files = getFilesFromPath(path);
const structure = {
Expand All @@ -61,14 +49,7 @@ export function OnboardHandler({
depth: depth + 1,
};

// Add to context if requested
if (shouldAddToContext) {
addFileContext({
path: file.path,
title: file.basename,
content: fileData.content,
});
}


return fileData;
})),
Expand All @@ -84,8 +65,7 @@ export function OnboardHandler({
const subStructure = await analyzeFolderStructure(
child.path,
depth + 1,
maxDepth,
shouldAddToContext
maxDepth
);
structure.subfolders.push(subStructure);
}
Expand All @@ -99,8 +79,8 @@ export function OnboardHandler({
const handleAnalyze = async () => {
setIsAnalyzing(true);
try {
const { path = "/", maxDepth = 3, addToContext = false } = toolInvocation.args;
const structure = await analyzeFolderStructure(path, 0, maxDepth, addToContext);
const { path = "/", maxDepth = 3 } = toolInvocation.args;
const structure = await analyzeFolderStructure(path, 0, maxDepth);

setIsValidated(true);
handleAddResult(
Expand Down

0 comments on commit 8967c90

Please sign in to comment.