mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-10 07:27:57 -05:00
Added api key field to agent block
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { useState } from 'react'
|
||||
|
||||
export function ShortInput() {
|
||||
return <Input className="w-full" />
|
||||
interface ShortInputProps {
|
||||
placeholder: string
|
||||
password?: boolean
|
||||
}
|
||||
|
||||
export function ShortInput({ placeholder, password }: ShortInputProps) {
|
||||
const [isFocused, setIsFocused] = useState(false)
|
||||
const [value, setValue] = useState('')
|
||||
|
||||
return (
|
||||
<Input
|
||||
className="w-full"
|
||||
placeholder={placeholder}
|
||||
type={password && !isFocused ? 'password' : 'text'}
|
||||
value={value}
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
onFocus={() => setIsFocused(true)}
|
||||
onBlur={() => setIsFocused(false)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ export function SubBlock({ config }: SubBlockProps) {
|
||||
const renderInput = () => {
|
||||
switch (config.type) {
|
||||
case 'short-input':
|
||||
return <ShortInput />
|
||||
return <ShortInput
|
||||
placeholder={config.placeholder ?? ''}
|
||||
password={config.password}
|
||||
/>
|
||||
case 'long-input':
|
||||
return <LongInput />
|
||||
case 'dropdown':
|
||||
|
||||
@@ -29,7 +29,7 @@ export const AgentBlock: BlockConfig = {
|
||||
title: 'Model',
|
||||
type: 'dropdown',
|
||||
layout: 'half',
|
||||
options: ['GPT-4o', 'Gemini 2.0', 'Gemini 1.5 Pro', 'DeepSeek V3', 'Grok 2'],
|
||||
options: ['GPT-4o', 'Gemini 2.0', 'Claude 3.5 Sonnet', 'DeepSeek V3', 'Grok 2'],
|
||||
},
|
||||
{
|
||||
title: 'Temperature',
|
||||
@@ -38,6 +38,13 @@ export const AgentBlock: BlockConfig = {
|
||||
min: 0,
|
||||
max: 2,
|
||||
},
|
||||
{
|
||||
title: "API Key",
|
||||
type: "short-input",
|
||||
layout: "full",
|
||||
placeholder: "Enter your API key",
|
||||
password: true
|
||||
}
|
||||
],
|
||||
},
|
||||
}
|
||||
@@ -15,6 +15,8 @@ export interface SubBlockConfig {
|
||||
max?: number
|
||||
layout?: SubBlockLayout
|
||||
columns?: string[]
|
||||
placeholder?: string
|
||||
password?: boolean
|
||||
}
|
||||
|
||||
export interface BlockConfig {
|
||||
|
||||
Reference in New Issue
Block a user