fix: resolve TypeScript errors from cockpit refactor (Phase 7)
- Remove unused imports (ChatMessage, TaskLane) - Remove unused handleTaskSubmit and handleFlowPilotAnswer - Remove unused setActiveStepIndex setter - Add triage fields to AISessionDetail construction in useFlowPilotSession - npx tsc -b passes clean Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,11 @@ export function useFlowPilotSession(): UseFlowPilotSession {
|
||||
pending_task_lane: null,
|
||||
is_branching: false,
|
||||
active_branch_id: null,
|
||||
client_name: null,
|
||||
asset_name: null,
|
||||
issue_category: null,
|
||||
triage_hypothesis: null,
|
||||
evidence_items: null,
|
||||
})
|
||||
setAllSteps([firstStep])
|
||||
setCurrentStep(firstStep)
|
||||
|
||||
@@ -11,8 +11,9 @@ import { useBranching } from '@/hooks/useBranching'
|
||||
import { analytics } from '@/lib/analytics'
|
||||
import { toast } from '@/lib/toast'
|
||||
import { ChatSidebar, ChatSidebarCollapsedBar } from '@/components/assistant/ChatSidebar'
|
||||
import { ChatMessage } from '@/components/assistant/ChatMessage'
|
||||
import { TaskLane } from '@/components/assistant/TaskLane'
|
||||
// ChatMessage and TaskLane kept in codebase but no longer imported here
|
||||
// import { ChatMessage } from '@/components/assistant/ChatMessage'
|
||||
// import { TaskLane } from '@/components/assistant/TaskLane'
|
||||
import { ConcludeSessionModal } from '@/components/assistant/ConcludeSessionModal'
|
||||
import { StatusUpdateModal } from '@/components/flowpilot/StatusUpdateModal'
|
||||
import { IncidentHeader } from '@/components/assistant/IncidentHeader'
|
||||
@@ -83,7 +84,7 @@ export default function AssistantChatPage() {
|
||||
const saved = localStorage.getItem('rf-assistant-work-zone-height')
|
||||
return saved ? parseFloat(saved) : 55
|
||||
})
|
||||
const [activeStepIndex, setActiveStepIndex] = useState(0)
|
||||
const [activeStepIndex] = useState(0)
|
||||
const splitContainerRef = useRef<HTMLDivElement>(null)
|
||||
const toggleSidebarCollapse = () => {
|
||||
const next = !sidebarCollapsed
|
||||
@@ -380,56 +381,6 @@ export default function AssistantChatPage() {
|
||||
}
|
||||
}
|
||||
|
||||
const handleTaskSubmit = async (responses: Array<{ type: string; state: string; value: string; text?: string; label?: string }>) => {
|
||||
if (!activeChatId || loading) return
|
||||
|
||||
// Format task responses into a structured message for the AI
|
||||
const parts: string[] = []
|
||||
for (const r of responses) {
|
||||
const name = r.type === 'question' ? `Q: ${r.text}` : r.label || 'Check'
|
||||
if (r.state === 'done' && r.value.trim()) {
|
||||
parts.push(`**${name}:**\n\`\`\`\n${r.value.trim()}\n\`\`\``)
|
||||
} else if (r.state === 'skipped') {
|
||||
parts.push(`**${name}:** _(skipped)_`)
|
||||
}
|
||||
}
|
||||
const userMessage = parts.join('\n\n')
|
||||
|
||||
setMessages(prev => [...prev, { role: 'user', content: userMessage }])
|
||||
setLoading(true)
|
||||
|
||||
try {
|
||||
const response = await aiSessionsApi.sendChatMessage(activeChatId, { message: userMessage })
|
||||
setMessages(prev => [
|
||||
...prev,
|
||||
{ role: 'assistant', content: response.content, suggestedFlows: response.suggested_flows, fork: response.fork, actions: response.actions, questions: response.questions },
|
||||
])
|
||||
if (response.fork && activeChatId) {
|
||||
branching.loadBranches(activeChatId)
|
||||
}
|
||||
// Update task lane based on AI response
|
||||
const hasQuestions = response.questions && response.questions.length > 0
|
||||
const hasActions = response.actions && response.actions.length > 0
|
||||
if (hasQuestions || hasActions) {
|
||||
setActiveQuestions(response.questions || [])
|
||||
setActiveActions(response.actions || [])
|
||||
setShowTaskLane(true)
|
||||
} else {
|
||||
// AI sent no new tasks — clear the lane
|
||||
setShowTaskLane(false)
|
||||
setActiveQuestions([])
|
||||
setActiveActions([])
|
||||
}
|
||||
} catch {
|
||||
setMessages(prev => [
|
||||
...prev,
|
||||
{ role: 'assistant', content: 'Sorry, something went wrong processing your responses. Please try again.' },
|
||||
])
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleConclude = async (outcome: ConclusionOutcome, _notes: string): Promise<string> => {
|
||||
if (!activeChatId) throw new Error('No active chat')
|
||||
|
||||
@@ -529,14 +480,7 @@ export default function AssistantChatPage() {
|
||||
}
|
||||
}, [activeChatId, triageMeta.evidence_items])
|
||||
|
||||
const handleFlowPilotAnswer = useCallback((answer: string) => {
|
||||
setInput(answer)
|
||||
// Trigger send after a tick so the input state is set
|
||||
setTimeout(() => {
|
||||
const event = new KeyboardEvent('keydown', { key: 'Enter' })
|
||||
inputRef.current?.dispatchEvent(event)
|
||||
}, 0)
|
||||
}, [])
|
||||
|
||||
|
||||
// Merge triage_update from AI response into local state
|
||||
const mergeTriageUpdate = useCallback((update: TriageUpdate) => {
|
||||
|
||||
Reference in New Issue
Block a user