mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 12:54:55 +00:00
fix(settings): support type-safe thinkingLevel and propagate to AgentHarness
This commit is contained in:
@@ -24,7 +24,7 @@ import { useForm, useStore } from '@tanstack/react-form'
|
||||
import { Loader2, Puzzle } from 'lucide-react'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { AgentInfo, AgentType } from '@shumai/dtos'
|
||||
import { AgentInfo, AgentType, ThinkingLevel, thinkingLevelSchema } from '@shumai/dtos'
|
||||
import { Textarea } from '@/ui/components/ui/textarea'
|
||||
import { ScrollArea } from '@/ui/components/ui/scroll-area'
|
||||
import { z } from 'zod'
|
||||
@@ -47,7 +47,7 @@ const agentFormSchema = z.object({
|
||||
providerId: z.string().optional(),
|
||||
modelId: z.string().optional(),
|
||||
soul: z.string().optional(),
|
||||
thinkingLevel: z.string().optional(),
|
||||
thinkingLevel: thinkingLevelSchema.optional(),
|
||||
systemPrompt: z.string().optional(),
|
||||
skills: z.array(z.string()).optional(),
|
||||
})
|
||||
@@ -121,7 +121,7 @@ export function AgentFormDialog({
|
||||
providerId: initialValues?.providerId || '',
|
||||
modelId: initialValues?.modelId || '',
|
||||
soul: initialValues?.soul || '',
|
||||
thinkingLevel: initialValues?.thinkingLevel || 'medium',
|
||||
thinkingLevel: initialValues?.thinkingLevel || 'off',
|
||||
systemPrompt: initialValues?.systemPrompt || '',
|
||||
skills: initialValues?.skills?.map((s) => s.skillId) || ([] as string[]),
|
||||
} as AgentFormValues,
|
||||
@@ -400,14 +400,17 @@ export function AgentFormDialog({
|
||||
children={(field) => (
|
||||
<Field>
|
||||
<FieldLabel>Thinking Level</FieldLabel>
|
||||
<Select value={field.state.value} onValueChange={field.handleChange}>
|
||||
<Select value={field.state.value} onValueChange={(val) => field.handleChange(val as ThinkingLevel)}>
|
||||
<SelectTrigger>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="off">Off</SelectItem>
|
||||
<SelectItem value="minimal">Minimal</SelectItem>
|
||||
<SelectItem value="low">Low (Fast)</SelectItem>
|
||||
<SelectItem value="medium">Medium (Balanced)</SelectItem>
|
||||
<SelectItem value="high">High (Reasoning)</SelectItem>
|
||||
<SelectItem value="xhigh">Extra High</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</Field>
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { AgentInfo, AgentType } from '@shumai/dtos'
|
||||
import { AgentInfo, AgentType, ThinkingLevel } from '@shumai/dtos'
|
||||
import { AgentFormDialog } from './AgentFormDialog'
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -104,7 +104,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
|
||||
avatar?: string
|
||||
providerId?: string
|
||||
modelId?: string
|
||||
thinkingLevel?: string
|
||||
thinkingLevel?: ThinkingLevel
|
||||
systemPrompt?: string
|
||||
soul?: string
|
||||
skills?: string[]
|
||||
|
||||
Reference in New Issue
Block a user