mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Add uploaded images to research mode, code slash command, include code references
This commit is contained in:
parent
5acf40c440
commit
a11b5293fb
3 changed files with 18 additions and 12 deletions
|
@ -301,6 +301,9 @@ export function TrainOfThought(props: TrainOfThoughtProps) {
|
|||
const iconColor = props.primary ? convertColorToTextClass(props.agentColor) : "text-gray-500";
|
||||
const icon = chooseIconFromHeader(header, iconColor);
|
||||
let markdownRendered = DOMPurify.sanitize(md.render(props.message));
|
||||
|
||||
// Remove any header tags from markdownRendered
|
||||
markdownRendered = markdownRendered.replace(/<h[1-6].*?<\/h[1-6]>/g, "");
|
||||
return (
|
||||
<div
|
||||
className={`${styles.trainOfThoughtElement} break-all items-center ${props.primary ? "text-gray-400" : "text-gray-300"} ${styles.trainOfThought} ${props.primary ? styles.primary : ""}`}
|
||||
|
|
|
@ -690,14 +690,14 @@ async def chat(
|
|||
inferred_queries: List[Any] = []
|
||||
defiltered_query = defilter_query(q)
|
||||
|
||||
if conversation_commands == [ConversationCommand.Default] or is_automated_task:
|
||||
if conversation_commands == [ConversationCommand.Default]:
|
||||
async for research_result in execute_information_collection(
|
||||
request=request,
|
||||
user=user,
|
||||
query=defiltered_query,
|
||||
conversation_id=conversation_id,
|
||||
conversation_history=meta_log,
|
||||
query_images=raw_images,
|
||||
query_images=uploaded_images,
|
||||
agent=agent,
|
||||
send_status_func=partial(send_event, ChatEvent.STATUS),
|
||||
user_name=user_name,
|
||||
|
@ -963,6 +963,7 @@ async def chat(
|
|||
"inferredQueries": inferred_queries,
|
||||
"context": compiled_references,
|
||||
"onlineContext": online_results,
|
||||
"codeContext": code_results,
|
||||
},
|
||||
):
|
||||
yield result
|
||||
|
|
|
@ -232,6 +232,8 @@ def get_conversation_command(query: str, any_references: bool = False) -> Conver
|
|||
return ConversationCommand.Summarize
|
||||
elif query.startswith("/diagram"):
|
||||
return ConversationCommand.Diagram
|
||||
elif query.startswith("/code"):
|
||||
return ConversationCommand.Code
|
||||
# If no relevant notes found for the given query
|
||||
elif not any_references:
|
||||
return ConversationCommand.General
|
||||
|
|
Loading…
Reference in a new issue