MCPcopy Create free account
hub / github.com/Harry-027/DocuMind / InputForm

Function InputForm

client/src/InputForm.tsx:9–49  ·  view source on GitHub ↗
({ selectedItem })

Source from the content-addressed store, hash-verified

7 }
8
9const InputForm : React.FC<InputFormProps> = ({ selectedItem }) => {
10 const [input, setInput] = useState<string>('');
11 const [llmResponse, setLLmResponse] = useState<string>('');
12
13 const handleSubmit = async () => {
14 setLLmResponse('Loading...');
15 const response = await invoke<string>('process_prompt', { item: selectedItem, query: input });
16 setLLmResponse(response);
17 };
18
19 const handleKeyDown = (e: any) => {
20 if (e.key === 'Enter') {
21 handleSubmit();
22 }
23 };
24
25 return (
26 <div className="flex-4 flex-col">
27 <hr />
28 <div className="flex items-center gap-25 mt-8">
29 <p className="text-lg font-bold">Query::</p>
30 <input
31 type="text"
32 value={input}
33 onChange={(e) => setInput(e.target.value)}
34 onKeyDown={handleKeyDown}
35 className="w-[70%] p-2 rounded-2xl text-lg placeholder-gray-400 outline-double outline-2 outline-offset-2" placeholder="Prompt here..."/>
36
37 <button onClick={handleSubmit} className="font-bold cursor-pointer px-5 outline-none outline-2 outline-offset-2">
38 <svg xmlns="http://www.w3.org/2000/svg" className="h-12 w-12" viewBox="0 0 24 24" fill="none" stroke="currentColor">
39 <path d="M5 12h14" />
40 <path d="M12 5l7 7-7 7" />
41 </svg>Submit</button>
42 </div>
43 <div className="flex items-center gap-4 mt-8">
44 <p className="w-[10%] text-lg font-bold leading-relaxed">LLM Response::</p>
45 <p className="text-lg leading-relaxed tracking-wide w-[80%] overflow-y-auto max-h-40">{llmResponse}</p>
46 </div>
47 </div>
48 );
49};
50
51export default InputForm;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected