Updated the to use targeted jobs but its weird

This commit is contained in:
Ace
2026-07-01 12:15:37 +02:00
parent 878627a6ba
commit e920d4925a
5 changed files with 434 additions and 134 deletions
+17 -1
View File
@@ -57,7 +57,12 @@ const commandPills = [
{ icon: "✉️", label: "Templates", prompt: "Show me email templates" },
]
export const AIChat = forwardRef<{ fillInput: (text: string) => void }, AIChatProps>(({ onMessageSent }, ref) => {
export interface AIChatHandle {
fillInput: (text: string) => void
addAssistantMessage: (content: string) => void
}
export const AIChat = forwardRef<AIChatHandle, AIChatProps>(({ onMessageSent }, ref) => {
const [messages, setMessages] = useState<ChatMessage[]>([])
const [input, setInput] = useState("")
const [loading, setLoading] = useState(false)
@@ -72,6 +77,17 @@ export const AIChat = forwardRef<{ fillInput: (text: string) => void }, AIChatPr
setInput(text)
setTimeout(() => textareaRef.current?.focus(), 50)
},
addAssistantMessage(content: string) {
setMessages((prev) => {
if (!prev.some((m) => m.role === "user")) {
return [
{ role: "user", content: "Search Facebook" },
{ role: "assistant", content },
]
}
return [...prev, { role: "assistant", content }]
})
},
}), [])
const checkServer = useCallback(async () => {