chat-ui-llm
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

chat-ui-llm

chat-ui-llm is a web and mobile chat sdk based on chatui.io

usage

可以直接使用UI,示例如下:

import ChatUILLM, { chatStore } from "chat-ui-llm";

const [sessionState, sessionDispatchers] = store.useModel('session');

// update session state
sessionDispatchers.update({ newSessionState });

<ChatUILLM
    aliyuntts = {{ appkey: 'xxxx', token: 'yyyy', refresh: () => { } }}
    user = {{
        id: '111111',
        avatar: ''
    }}
    models = {[{
        "api": "http://xxxxxxxxxx",
        "code": "llm1.1",
        "icon": "",
        "name": "LLM",
        "selected": true
    }]}
    config = {{
        aiAvatar: "",
        defaultUserAvatar: '', 
        loadingTips: '思考中',
        initialMessages: [{
            type: 'text',
            cate: 'init',
            content: { text: '您好,我是您的小助手,任何问题都可以咨询我哦~' },
        }],
        stopWord: 'stop',
        clearWord: 'clear',
        voiceFlag: 'aliyun',
        quickReplyNum: 0,
        defaultQuickReply: [],
        debugFlag: 0,
        defaultModelLogo: ''
    }}
    isMobile = {false}
    log = {(info) => {
        // txt: 即时识别结果
    }}
    createSessio={()=>{
        
        return {
            data:{
                data: 'xxxx' // sessionId
            }
        }
    }}
    deleteSession={({sessionId:'xxxx'})=>{

    }}
/> 

session state模型:

{
    currentSession:{
        cid: 'xxx'
    },
    'xxxxx':{  // cid为xxxxx的历史记录
        done,  // finish or not
        selectModel: ['aaa', 'bbb'],  // 选中的模型
        messages: []  // 历史消息
    }
}

Author

haomou.chh

Readme

Keywords

Package Sidebar

Install

npm i chat-ui-llm

Weekly Downloads

6

Version

1.1.3

License

ISC

Unpacked Size

632 kB

Total Files

14

Last publish

Collaborators

  • chalecao