botui
1.0.0
กรอบ JavaScript สำหรับการสร้าง UIS การสนทนา
ไซต์หลัก - อ่านเอกสาร - ตัวอย่าง -? เร็ว
เรากำลังแสดงรายการโครงการที่ยอดเยี่ยมทั้งหมดที่ผู้คนกำลังสร้างด้วย Botui ที่นี่ ดูคนอื่นและเพิ่มของคุณ!
บันทึก
รุ่นนี้ใช้วิธีการที่แตกต่างอย่างสิ้นเชิงสำหรับการสร้าง UIS อย่าใช้เป็นแทนที่แบบดรอปอินสำหรับเวอร์ชันก่อนหน้า หากคุณต้องการใช้วิธีการก่อนหน้า (vue-only) ให้ติดตั้งเวอร์ชัน 0.3.9 : npm i [email protected]

npm i botui @botui/react import { useEffect } from 'react'
import { createRoot } from 'react-dom/client'
import { createBot } from 'botui'
import { BotUI , BotUIMessageList , BotUIAction } from '@botui/react'
const myBot = createBot ( ) < div id =" botui-app " > </ div > const App = ( ) => {
useEffect ( ( ) => {
myBot
. wait ( { waitTime : 1000 } )
. then ( ( ) => myBot . message . add ( { text : 'hello, what is your name?' } ) )
. then ( ( ) => myBot . action . set (
{
options : [
{ label : 'John' , value : 'john' } ,
{ label : 'Jane' , value : 'jane' } ,
] ,
} ,
{ actionType : 'select' }
) )
. then ( ( data ) => myBot . message . add ( { text : `nice to meet you ${ data . selected . label } ` } ) )
} , [ ] )
return < div >
< BotUI bot = { myBot } >
< BotUIMessageList />
< BotUIAction />
</ BotUI >
</ div >
}
const containerElement = document . getElementById ( 'botui-app' )
const root = createRoot ( containerElement )
root . render ( < App /> )ใบอนุญาต MIT - ลิขสิทธิ์ (C) 2017-23 - Moin Uddin