Say hello
Hi, ask us anything about Acme.
ตัวอย่างทำงานด้วยข้อมูลตัวอย่าง ไม่ต้องใช้เครือข่ายหรือช่องทาง
tsx
import { YuvaChatThread } from "@/components/yuva-chat-thread"
import { useYuvaChat } from "@/hooks/use-yuva-chat"
export function Thread({ id }: { id: string }) {
const chat = useYuvaChat({
server={process.env.NEXT_PUBLIC_YUVA_SERVER}
channel={process.env.NEXT_PUBLIC_YUVA_CHANNEL},
})
const { loading, open } = chat
React.useEffect(() => {
if (!loading) void open(id)
}, [loading, open, id])
return (
<div className="flex h-96 flex-col rounded-xl border">
<YuvaChatThread chat={chat} />
</div>
)
}การติดตั้ง
รันคำสั่งนี้ในโปรเจกต์ shadcn ไฟล์จะถูกคัดลอกไปเป็นโค้ดของคุณเอง
Shell
npx shadcn@latest add https://useyuva.com/r/yuva-chat-thread.jsonShell
pnpm dlx shadcn@latest add https://useyuva.com/r/yuva-chat-thread.jsonShell
yarn dlx shadcn@latest add https://useyuva.com/r/yuva-chat-thread.jsonShell
bunx --bun shadcn@latest add https://useyuva.com/r/yuva-chat-thread.jsonการใช้งาน
tsx
import { YuvaChatThread } from "@/components/yuva-chat-thread"
<YuvaChatThread chat={chat} />Props
YuvaChatThreadProps
| Prop | ชนิด |
|---|---|
chat | YuvaChatState |
labels? | Partial<YuvaChatLabels> |
locale? | string |
greeting? | string |
lined? | boolean |
className? | string |
ป้ายข้อความ
รายการป้ายข้อความอยู่ที่หน้า Yuva chat
ส่วนที่ต้องพึ่งพา
การติดตั้งรายการนี้จะเพิ่มรายการต่อไปนี้ด้วย