MCPcopy
hub / github.com/PromtEngineer/localGPT / LocalGPTChat

Function LocalGPTChat

src/components/ui/localgpt-chat.tsx:69–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67}
68
69export function LocalGPTChat() {
70 const [value, setValue] = useState("");
71 const { textareaRef, adjustHeight } = useAutoResizeTextarea({
72 minHeight: 60,
73 maxHeight: 200,
74 });
75
76 const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
77 if (e.key === "Enter" && !e.shiftKey) {
78 e.preventDefault();
79 if (value.trim()) {
80 setValue("");
81 adjustHeight(true);
82 }
83 }
84 };
85
86 return (
87 <div className="flex flex-col items-center w-full max-w-4xl mx-auto p-4 space-y-8">
88 <h1 className="text-4xl font-bold text-white">
89 What can I help you find?
90 </h1>
91
92 <div className="w-full">
93 <div className="relative bg-neutral-900 rounded-xl border border-neutral-800">
94 <div className="overflow-y-auto">
95 <Textarea
96 ref={textareaRef}
97 value={value}
98 onChange={(e) => {
99 setValue(e.target.value);
100 adjustHeight();
101 }}
102 onKeyDown={handleKeyDown}
103 placeholder="Ask localgpt a question..."
104 className={cn(
105 "w-full px-4 py-3",
106 "resize-none",
107 "bg-transparent",
108 "border-none",
109 "text-white text-sm",
110 "focus:outline-none",
111 "focus-visible:ring-0 focus-visible:ring-offset-0",
112 "placeholder:text-neutral-500 placeholder:text-sm",
113 "min-h-[60px]"
114 )}
115 style={{
116 overflow: "hidden",
117 }}
118 />
119 </div>
120
121 <div className="flex items-center justify-between p-3">
122 <div className="flex items-center gap-2">
123 <button
124 type="button"
125 className="group p-2 hover:bg-neutral-800 rounded-lg transition-colors flex items-center gap-1"
126 >

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useAutoResizeTextareaFunction · 0.70

Tested by

no test coverage detected