File tree 2 files changed +9
-0
lines changed
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -357,8 +357,12 @@ async def aget_data_sources_and_output_format(
357
357
source_options_str = ""
358
358
359
359
agent_sources = agent .input_tools if agent else []
360
+ user_has_entries = await EntryAdapters .auser_has_entries (user )
360
361
361
362
for source , description in tool_descriptions_for_llm .items ():
363
+ # Skip showing Notes tool as an option if user has no entries
364
+ if source == ConversationCommand .Notes and not user_has_entries :
365
+ continue
362
366
source_options [source .value ] = description
363
367
if len (agent_sources ) == 0 or source .value in agent_sources :
364
368
source_options_str += f'- "{ source .value } ": "{ description } "\n '
Original file line number Diff line number Diff line change 5
5
import yaml
6
6
from fastapi import Request
7
7
8
+ from khoj .database .adapters import EntryAdapters
8
9
from khoj .database .models import Agent , KhojUser
9
10
from khoj .processor .conversation import prompts
10
11
from khoj .processor .conversation .utils import (
@@ -54,7 +55,11 @@ async def apick_next_tool(
54
55
tool_options = dict ()
55
56
tool_options_str = ""
56
57
agent_tools = agent .input_tools if agent else []
58
+ user_has_entries = await EntryAdapters .auser_has_entries (user )
57
59
for tool , description in function_calling_description_for_llm .items ():
60
+ # Skip showing Notes tool as an option if user has no entries
61
+ if tool == ConversationCommand .Notes and not user_has_entries :
62
+ continue
58
63
tool_options [tool .value ] = description
59
64
if len (agent_tools ) == 0 or tool .value in agent_tools :
60
65
tool_options_str += f'- "{ tool .value } ": "{ description } "\n '
You can’t perform that action at this time.
0 commit comments