Added api key field to agent block

This commit is contained in:
Waleed Latif
2025-01-13 12:12:42 -08:00
parent e640541c14
commit e5506188d0
4 changed files with 35 additions and 4 deletions

View File

@@ -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)}
/>
)
}

View File

@@ -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':

View File

@@ -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
}
],
},
}

View File

@@ -15,6 +15,8 @@ export interface SubBlockConfig {
max?: number
layout?: SubBlockLayout
columns?: string[]
placeholder?: string
password?: boolean
}
export interface BlockConfig {