mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Send chat message to Khoj web app via url query param
- This allows triggering khoj chat from the browser addressbar - So now if you add Khoj to your browser bookmark with - URL: https://app.khoj.dev/?q=%s - Keyword: khoj - Then you can type "khoj what is the news today" to trigger Khoj to quickly respond to your query. This avoids having to open the Khoj web app before asking your question
This commit is contained in:
@@ -22,6 +22,7 @@ import { getIconFromIconName } from "@/app/common/iconUtils";
|
||||
import { AgentData } from "@/app/agents/page";
|
||||
import { createNewConversation } from "./common/chatFunctions";
|
||||
import { useIsMobileWidth } from "./common/utils";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
interface ChatBodyDataProps {
|
||||
chatOptionsData: ChatOptions | null;
|
||||
@@ -51,6 +52,14 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
||||
const [agentIcons, setAgentIcons] = useState<JSX.Element[]>([]);
|
||||
const [agents, setAgents] = useState<AgentData[]>([]);
|
||||
const [showLoginPrompt, setShowLoginPrompt] = useState(false);
|
||||
const searchParams = useSearchParams();
|
||||
const queryParam = searchParams.get("q");
|
||||
|
||||
useEffect(() => {
|
||||
if (queryParam) {
|
||||
setMessage(decodeURIComponent(queryParam));
|
||||
}
|
||||
}, [queryParam]);
|
||||
|
||||
const onConversationIdChange = props.onConversationIdChange;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user