mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Just pass user rather than whole request object to doc search func
This commit is contained in:
@@ -352,7 +352,7 @@ def set_user_name(
|
|||||||
|
|
||||||
|
|
||||||
async def extract_references_and_questions(
|
async def extract_references_and_questions(
|
||||||
request: Request,
|
user: KhojUser,
|
||||||
meta_log: dict,
|
meta_log: dict,
|
||||||
q: str,
|
q: str,
|
||||||
n: int,
|
n: int,
|
||||||
@@ -367,8 +367,6 @@ async def extract_references_and_questions(
|
|||||||
query_files: str = None,
|
query_files: str = None,
|
||||||
tracer: dict = {},
|
tracer: dict = {},
|
||||||
):
|
):
|
||||||
user = request.user.object if request.user.is_authenticated else None
|
|
||||||
|
|
||||||
# Initialize Variables
|
# Initialize Variables
|
||||||
compiled_references: List[dict[str, str]] = []
|
compiled_references: List[dict[str, str]] = []
|
||||||
inferred_queries: List[str] = []
|
inferred_queries: List[str] = []
|
||||||
|
|||||||
@@ -889,7 +889,6 @@ async def chat(
|
|||||||
|
|
||||||
if conversation_commands == [ConversationCommand.Research]:
|
if conversation_commands == [ConversationCommand.Research]:
|
||||||
async for research_result in execute_information_collection(
|
async for research_result in execute_information_collection(
|
||||||
request=request,
|
|
||||||
user=user,
|
user=user,
|
||||||
query=defiltered_query,
|
query=defiltered_query,
|
||||||
conversation_id=conversation_id,
|
conversation_id=conversation_id,
|
||||||
@@ -1025,7 +1024,7 @@ async def chat(
|
|||||||
if not ConversationCommand.Research in conversation_commands:
|
if not ConversationCommand.Research in conversation_commands:
|
||||||
try:
|
try:
|
||||||
async for result in extract_references_and_questions(
|
async for result in extract_references_and_questions(
|
||||||
request,
|
user,
|
||||||
meta_log,
|
meta_log,
|
||||||
q,
|
q,
|
||||||
(n or 7),
|
(n or 7),
|
||||||
|
|||||||
@@ -193,7 +193,6 @@ async def apick_next_tool(
|
|||||||
|
|
||||||
|
|
||||||
async def execute_information_collection(
|
async def execute_information_collection(
|
||||||
request: Request,
|
|
||||||
user: KhojUser,
|
user: KhojUser,
|
||||||
query: str,
|
query: str,
|
||||||
conversation_id: str,
|
conversation_id: str,
|
||||||
@@ -251,7 +250,7 @@ async def execute_information_collection(
|
|||||||
c["query"] for iteration in previous_iterations if iteration.context for c in iteration.context
|
c["query"] for iteration in previous_iterations if iteration.context for c in iteration.context
|
||||||
}
|
}
|
||||||
async for result in extract_references_and_questions(
|
async for result in extract_references_and_questions(
|
||||||
request,
|
user,
|
||||||
construct_tool_chat_history(previous_iterations, ConversationCommand.Notes),
|
construct_tool_chat_history(previous_iterations, ConversationCommand.Notes),
|
||||||
this_iteration.query,
|
this_iteration.query,
|
||||||
7,
|
7,
|
||||||
|
|||||||
Reference in New Issue
Block a user