Updated the to use targeted jobs but its weird
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user