Skip to content

Bug: 集成到 RN 中,使用 webview 的方式,报错 CozeWebSDK is not defined #279

@nanianlisao

Description

@nanianlisao

1.2.0-beta.14 版本,cdn 引入

<script src="https://lf-cdn.coze.cn/obj/unpkg/flow-platform/chat-app-sdk/1.2.0-beta.8/libs/cn/index.js"></script>

Environment

System:
OS: macOS 14.5
CPU: (8) arm64 Apple M1
Memory: 111.22 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - ~/Library/Caches/fnm_multishells/97135_1751349310124/bin/node
npm: 10.9.2 - ~/Library/Caches/fnm_multishells/97135_1751349310124/bin/npm
pnpm: 10.7.1 - ~/Library/Caches/fnm_multishells/97135_1751349310124/bin/pnpm
bun: 1.0.0 - ~/.bun/bin/bun
Browsers:
Chrome: 131.0.6778.70
Safari: 17.5

Steps To Reproduce


Link to code example:

<!doctype html>

<title>Document</title> <script src="https://lf-cdn.coze.cn/obj/unpkg/flow-platform/chat-app-sdk/1.2.0-beta.8/libs/cn/index.js"></script> <script> const cozeWebSDK = new CozeWebSDK.WebChatClient({ config: { isIframe: false, type: "app", appInfo: { appId: "xxxx", workflowId: "xxxx", parameters: { user_id:'xxxxx', }, }, }, componentProps: { title: "小田AI", }, auth: { type: "token", token: 'xxxxx', }, ui: { chatBot: { isNeedAudio: true, }, base: { layout: "mobile", lang: "zh-CN", zIndex: 1000, }, header: { isShow: false, isNeedClose: false, }, asstBtn: { isNeed: false, },
        footer: {
          isShow: false,
        },
      },
    })
    setTimeout(() => {
      cozeWebSDK.showChatBot()
    }, 100)

</script>

The current behavior

直接在浏览器打开是正常的。

但是在 RN 中报错 CozeWebSDK is not defined,切换版本到 1.1.0-beta.3 是正常的。但是 1.1.0-beta.3 不支持语音输入功能

The expected behavior

期望 1.2.0-beta.14 能正常使用。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions