coze-dev / coze-dev/coze-js

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

Open
#279 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
292
Forks
99
PR merge metrics
No merged PRs in 30d

Description

1.2.0-beta.14 版本,cdn 引入

## 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

1.
2.

-----

Link to code example:




Document




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)


## 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 能正常使用。

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named. Reproduce the CDN integration in the supplied HTML and React Native WebView context, comparing 1.2.0-beta.14 with the referenced 1.2.0-beta.8 CDN script and the working 1.1.0-beta.3 version. Done means the current SDK exposes CozeWebSDK and supports the reported voice-input configuration in React Native.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.