File size: 9,122 Bytes
509e21e
 
 
 
 
 
 
 
 
 
 
 
49d5ba7
509e21e
 
 
 
 
 
49d5ba7
509e21e
 
 
 
 
 
49d5ba7
 
 
 
 
 
 
509e21e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49d5ba7
 
 
 
 
 
 
 
 
 
 
 
509e21e
 
 
 
 
 
 
 
 
49d5ba7
 
 
 
 
 
 
 
 
 
509e21e
 
 
 
 
 
 
 
49d5ba7
 
 
 
 
 
509e21e
 
 
 
 
 
 
 
49d5ba7
509e21e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49d5ba7
509e21e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49d5ba7
509e21e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
"use client"

import type React from "react"

import { useState } from "react"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Checkbox } from "@/components/ui/checkbox"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
import type { SystemInfo } from "@/components/ai-evaluation-dashboard"
import { getSystemInfoFormOptions } from "@/lib/schema"

interface SystemInfoFormProps {
  onSubmit: (data: SystemInfo) => void
  initialData: SystemInfo | null
}

const formOptions = getSystemInfoFormOptions()

export function SystemInfoForm({ onSubmit, initialData }: SystemInfoFormProps) {
  const [formData, setFormData] = useState<SystemInfo>({
    name: initialData?.name || "",
    url: initialData?.url || "",
    provider: initialData?.provider || "",
    version: initialData?.version || "",
    deploymentContexts: initialData?.deploymentContexts || [],
    modelTag: initialData?.modelTag || "",
    knowledgeCutoff: initialData?.knowledgeCutoff || "",
    modelType: initialData?.modelType || "na",
    inputModalities: initialData?.inputModalities || [],
    outputModalities: initialData?.outputModalities || [],
  })

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault()
    onSubmit(formData)
  }

  const handleDeploymentContextChange = (context: string, checked: boolean) => {
    setFormData((prev: SystemInfo) => ({
      ...prev,
      deploymentContexts: checked
        ? [...prev.deploymentContexts, context]
        : prev.deploymentContexts.filter((c) => c !== context),
    }))
  }

  return (
    <Card>
      <CardHeader>
        <CardTitle className="font-heading">System Information</CardTitle>
        <CardDescription>Provide basic information about the AI system you want to evaluate</CardDescription>
      </CardHeader>
      <CardContent>
        <form onSubmit={handleSubmit} className="space-y-6">
          <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
            <div className="space-y-2">
              <Label htmlFor="name">AI System Name *</Label>
              <Input
                id="name"
                value={formData.name}
                onChange={(e) => setFormData((prev) => ({ ...prev, name: e.target.value }))}
                placeholder="e.g., GPT-4, Claude, Custom Model"
                required
              />
            </div>
            <div className="space-y-2">
              <Label htmlFor="url">AI System URL</Label>
              <Input
                id="url"
                type="url"
                value={formData.url}
                onChange={(e) => setFormData((prev) => ({ ...prev, url: e.target.value }))}
                placeholder="https://example.com"
              />
            </div>
          </div>

          <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
            <div className="space-y-2">
              <Label htmlFor="modelTag">Model Tag / Version</Label>
              <Input
                id="modelTag"
                value={formData.modelTag}
                onChange={(e) => setFormData((prev) => ({ ...prev, modelTag: e.target.value }))}
                placeholder="e.g., gpt-4-1-2025-04-14"
              />
            </div>
            <div className="space-y-2">
              <Label htmlFor="version">System Version</Label>
              <Input
                id="version"
                value={formData.version}
                onChange={(e) => setFormData((prev) => ({ ...prev, version: e.target.value }))}
                placeholder="e.g., v3.2.1"
              />
            </div>
          </div>

          <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
            <div className="space-y-2">
              <Label htmlFor="knowledgeCutoff">Knowledge Cutoff Date</Label>
              <Input
                id="knowledgeCutoff"
                value={formData.knowledgeCutoff}
                onChange={(e) => setFormData((prev) => ({ ...prev, knowledgeCutoff: e.target.value }))}
                placeholder="YYYY-MM-DD"
              />
            </div>
            <div className="space-y-2">
              <Label htmlFor="provider">Provider/Organization *</Label>
              <Input
                id="provider"
                value={formData.provider}
                onChange={(e) => setFormData((prev) => ({ ...prev, provider: e.target.value }))}
                placeholder="e.g., OpenAI, Anthropic, Internal Team"
                required
              />
            </div>
          </div>

          <div className="space-y-4">
            <div>
              <Label className="text-base font-medium">Model Type</Label>
              <div className="mt-3">
                <RadioGroup value={formData.modelType} onValueChange={(val) => setFormData((prev) => ({ ...prev, modelType: val as any }))}>
                  <div className="flex items-center gap-4">
                    {formOptions.modelTypes.map((type) => (
                      <div key={type.value} className="flex items-center gap-2">
                        <RadioGroupItem value={type.value} id={`mt-${type.value}`} />
                        <Label htmlFor={`mt-${type.value}`} className="text-sm">{type.label}</Label>
                      </div>
                    ))}
                  </div>
                </RadioGroup>
              </div>
            </div>

            <div>
              <Label className="text-base font-medium">Input modalities (select all that apply) *</Label>
              <div className="grid grid-cols-1 md:grid-cols-2 gap-3 mt-3">
                {formOptions.modalities.map((m) => (
                  <div key={m} className="flex items-center gap-2">
                    <Checkbox
                      id={`in-${m}`}
                      checked={(formData.inputModalities || []).includes(m)}
                      onCheckedChange={(checked) =>
                        setFormData((prev) => ({
                          ...prev,
                          inputModalities: checked
                            ? [...(prev.inputModalities || []), m]
                            : (prev.inputModalities || []).filter((x) => x !== m),
                        }))
                      }
                    />
                    <Label htmlFor={`in-${m}`} className="text-sm">
                      {m}
                    </Label>
                  </div>
                ))}
              </div>
            </div>

            <div>
              <Label className="text-base font-medium">Output modalities (select all that apply) *</Label>
              <div className="grid grid-cols-1 md:grid-cols-2 gap-3 mt-3">
                {formOptions.modalities.map((m) => (
                  <div key={m} className="flex items-center gap-2">
                    <Checkbox
                      id={`out-${m}`}
                      checked={(formData.outputModalities || []).includes(m)}
                      onCheckedChange={(checked) =>
                        setFormData((prev) => ({
                          ...prev,
                          outputModalities: checked
                            ? [...(prev.outputModalities || []), m]
                            : (prev.outputModalities || []).filter((x) => x !== m),
                        }))
                      }
                    />
                    <Label htmlFor={`out-${m}`} className="text-sm">
                      {m}
                    </Label>
                  </div>
                ))}
              </div>
            </div>

            <div>
              <Label className="text-base font-medium">Deployment Context (select all that apply) *</Label>
              <div className="grid grid-cols-1 md:grid-cols-2 gap-3 mt-3">
                {formOptions.deploymentContexts.map((context) => (
                  <div key={context} className="flex items-center space-x-2">
                    <Checkbox
                      id={`context-${context}`}
                      checked={formData.deploymentContexts.includes(context)}
                      onCheckedChange={(checked) => handleDeploymentContextChange(context, checked as boolean)}
                    />
                    <Label htmlFor={`context-${context}`} className="text-sm font-normal">
                      {context}
                    </Label>
                  </div>
                ))}
              </div>
            </div>
          </div>

          

          <Button
            type="submit"
            className="w-full"
            disabled={
              !formData.name ||
              !formData.provider ||
              (formData.inputModalities || []).length === 0 ||
              (formData.outputModalities || []).length === 0 ||
              formData.deploymentContexts.length === 0
            }
          >
            Continue to Category Selection
          </Button>
        </form>
      </CardContent>
    </Card>
  )
}