MCPcopy Create free account
hub / github.com/admineral/OpenAI-Assistant-API-Chat / WelcomeForm

Function WelcomeForm

app/components/WelcomeForm.tsx:23–154  ·  view source on GitHub ↗
({
  assistantName,
  setAssistantName,
  assistantDescription,
  setAssistantDescription,
  assistantModel,
  setAssistantModel,
  startChatAssistant,
  isButtonDisabled,
  isStartLoading,
  statusMessage,
  fileIds,
  setFileIds,
})

Source from the content-addressed store, hash-verified

21}
22
23const WelcomeForm: React.FC<WelcomeFormProps> = ({
24 assistantName,
25 setAssistantName,
26 assistantDescription,
27 setAssistantDescription,
28 assistantModel,
29 setAssistantModel,
30 startChatAssistant,
31 isButtonDisabled,
32 isStartLoading,
33 statusMessage,
34 fileIds,
35 setFileIds,
36}) => {
37
38 const [lastProgress, setLastProgress] = useState(0);
39 const baseStatusMessage = statusMessage.split(' (')[0];
40 let progress = statusToProgress[baseStatusMessage] || 0;
41
42 if (progress === 0 && lastProgress !== 0) {
43 progress = lastProgress;
44 } else if (progress !== lastProgress) {
45 setLastProgress(progress);
46 }
47
48 const handleFileIdUpdate = (fileId: string) => {
49 console.log("WelcomeForm: New file ID added:", fileId);
50 setFileIds(prevFileIds => [...prevFileIds, fileId]);
51 };
52
53
54 const handleActiveFileIdsUpdate = (activeFileIds: string[]) => {
55 setFileIds(activeFileIds);
56 };
57
58
59 if (progress === 0 && lastProgress !== 0) {
60 progress = lastProgress;
61 } else if (progress !== lastProgress) {
62 setLastProgress(progress);
63 }
64
65 useEffect(() => {
66 console.log("Aktive Datei-IDs:", fileIds);
67 }, [fileIds]);
68
69
70
71 return (
72 <div className="border-gray-500 bg-gray-200 sm:mx-0 mx-5 mt-20 max-w-screen-md rounded-md border-2 sm:w-full">
73 <div className="flex flex-col space-y-4 p-7 sm:p-10">
74 <h1 className="text-lg font-semibold text-black">
75 Welcome to Agent42!
76 </h1>
77 <form className="flex flex-col space-y-3">
78 <input
79 type="text"
80 placeholder="Assistant Name"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected