fix: remove "Let AI Decide" option from KB Accelerator upload
The uploader should know their content type — auto-detection adds complexity and currently just defaults to troubleshooting anyway. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -288,11 +288,11 @@ async def upload_kb_article(
|
||||
else:
|
||||
raise HTTPException(status_code=400, detail="Provide either a file or content text.")
|
||||
|
||||
# Validate target_type
|
||||
if target_type and target_type not in ("troubleshooting", "procedural"):
|
||||
raise HTTPException(status_code=400, detail="target_type must be 'troubleshooting' or 'procedural'.")
|
||||
# Validate target_type (required — frontend must specify)
|
||||
if not target_type:
|
||||
target_type = "troubleshooting" # Default; Phase 2 adds "let AI decide"
|
||||
target_type = "troubleshooting"
|
||||
if target_type not in ("troubleshooting", "procedural"):
|
||||
raise HTTPException(status_code=400, detail="target_type must be 'troubleshooting' or 'procedural'.")
|
||||
|
||||
# Create KB import record
|
||||
kb_import = KBImport(
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Textarea } from '@/components/ui/Textarea'
|
||||
import { Input } from '@/components/ui/Input'
|
||||
import type { KBQuotaResponse } from '@/types/kbAccelerator'
|
||||
|
||||
type TargetType = 'troubleshooting' | 'procedural' | 'auto'
|
||||
type TargetType = 'troubleshooting' | 'procedural'
|
||||
|
||||
interface UploadScreenProps {
|
||||
quota: KBQuotaResponse | null
|
||||
@@ -25,11 +25,6 @@ const TARGET_TYPES = [
|
||||
label: 'Project Flow',
|
||||
description: 'Step-by-step procedure with warnings and variables',
|
||||
},
|
||||
{
|
||||
value: 'auto' as const,
|
||||
label: 'Let AI Decide',
|
||||
description: 'AI will determine the best flow type from your content',
|
||||
},
|
||||
]
|
||||
|
||||
const FORMAT_LABELS: Record<string, string> = {
|
||||
@@ -45,7 +40,7 @@ export function UploadScreen({ quota, onSubmitText, onSubmitFile, loading }: Upl
|
||||
const [mode, setMode] = useState<'paste' | 'file'>('paste')
|
||||
const [content, setContent] = useState('')
|
||||
const [title, setTitle] = useState('')
|
||||
const [targetType, setTargetType] = useState<TargetType>('auto')
|
||||
const [targetType, setTargetType] = useState<TargetType>('troubleshooting')
|
||||
const [file, setFile] = useState<File | null>(null)
|
||||
const [dragOver, setDragOver] = useState(false)
|
||||
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||
@@ -231,7 +226,7 @@ export function UploadScreen({ quota, onSubmitText, onSubmitFile, loading }: Upl
|
||||
<p className="font-label text-[0.625rem] uppercase tracking-[0.1em] text-muted-foreground mb-2">
|
||||
Target Flow Type
|
||||
</p>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
{TARGET_TYPES.map(t => (
|
||||
<button
|
||||
key={t.value}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { getTreeEditorPath } from '@/lib/routing'
|
||||
import type { KBImport, KBQuotaResponse, KBCommitResponse, KBNodeEditRequest } from '@/types/kbAccelerator'
|
||||
|
||||
type Phase = 'upload' | 'processing' | 'review' | 'success'
|
||||
type TargetType = 'troubleshooting' | 'procedural' | 'auto'
|
||||
type TargetType = 'troubleshooting' | 'procedural'
|
||||
|
||||
export default function KBAcceleratorPage() {
|
||||
const navigate = useNavigate()
|
||||
@@ -61,7 +61,7 @@ export default function KBAcceleratorPage() {
|
||||
const resp = await kbAcceleratorApi.uploadText({
|
||||
content,
|
||||
title: title || undefined,
|
||||
target_type: targetType === 'auto' ? undefined : targetType,
|
||||
target_type: targetType,
|
||||
})
|
||||
setImportId(resp.id)
|
||||
setPhase('processing')
|
||||
@@ -77,7 +77,7 @@ export default function KBAcceleratorPage() {
|
||||
const handleSubmitFile = async (file: File, targetType: TargetType) => {
|
||||
setLoading(true)
|
||||
try {
|
||||
const resp = await kbAcceleratorApi.uploadFile(file, targetType === 'auto' ? undefined : targetType)
|
||||
const resp = await kbAcceleratorApi.uploadFile(file, targetType)
|
||||
setImportId(resp.id)
|
||||
setPhase('processing')
|
||||
startPolling(resp.id)
|
||||
|
||||
Reference in New Issue
Block a user