openCustomerServiceChat 这是小程序原生页面接口,不能用在web-view上
h5里面怎么用wx.openCustomerServiceChat打开客服链接?wx.config({ debug: true, // 开启调试模式 appId: '你的公众号appId', timestamp: new Date().getTime(), // 获取当前时间戳 nonceStr: '随机字符串', signature: '生成的签名', jsApiList: ['需要使用的JS接口列表'] // 例如 ['onMenuShareTimeline', 'onMenuShareAppMessage'] });但是报错微信权限验证失败: {"realAuthUrl": "[]", "errMsg": "config:invalid signature"},所以想问下h5里面打开wx.openCustomerServiceChat是不是只能先跳到小程序,在小程序里面用这个微信客服接口
10-22目前问题已解决
小程序实现SSE ios真机调试,onChunkReceived无响应。开发工具、安卓均没问题小程序实现SSE ios真机调试,onChunkReceived无响应。开发工具、安卓均没问题
06-06我也遇到了同样的问题,如何解决这个问题?
关于onChunkReceived在不同客户端输出结果不一致bug1.代码复现片段 [图片] 2.开发者工具console结果展示 [图片] 3.安卓consoel结果展示 [图片] 4.苹果console结果展示 [图片] 目前遇到的主要问题是ios与安卓结果不一致无法进行处理
06-05请问解决了吗
真机调试 onChunkReceived 调用流式接口无返回?但是开发者工具可以async sendMessageStream({ messages, onMessage }) { const token = uni.getStorageSync('token') if (!token) { throw new Error('请先登录') } const balance = await this.checkBalance() if (balance <= 0) { throw new Error('余额不足,请充值') } try { let hasStopSignal = false; let hasError = false; const requestTask = uni.request({ url: 'https://api.xxx.com/v1/chat/completions', method: 'POST', timeout: 100000, header: { 'Content-Type': 'application/json', 'Authorization': `Bearer xxx`, 'Accept': 'text/event-stream' }, data: { model: this.config.model || 'gpt-3.5-turbo', messages: messages, stream: true }, enableChunked: true, success: (res) => { console.log('请求成功:', res) if (res.statusCode !== 200) { hasError = true; onMessage({ content: '', done: true, error: `请求失败: ${res.statusCode}` }); } }, fail: (err) => { console.error('请求失败:', err); hasError = true; onMessage({ content: '', done: true, error: err.errMsg || '请求失败' }); }, complete: () => { console.log('请求完成'); // 如果没有收到停止信号且没有错误,则发送完成信号 if (!hasStopSignal && !hasError) { onMessage({ content: '', done: true }); } } }); // 添加分块接收监听 requestTask.onChunkReceived((res) => { if (hasError) return; // 如果有错误,不处理数据块 console.log('收到数据块:', res.data) const result = this.parseSSEChunk(res.data); // 检查是否是停止信号 if (result.done) { hasStopSignal = true; } onMessage(result); }); return requestTask; } catch (error) { console.error('请求错误:', error) throw error } } // 添加SSE解析方法 parseSSEChunk(chunk) { // 处理二进制数据 if (typeof chunk !== 'string') { try { chunk = new TextDecoder().decode(chunk); } catch(e) { console.error('数据解码失败:', e); return { content: '', done: false }; } } const lines = chunk.split('\n').filter(line => line.trim()); console.log('解析后的数据:', lines) for (const line of lines) { const [key, ...values] = line.split(': '); const value = values.join(': '); // 重新组合可能包含 : 的值 if (key === 'data') { try { const data = JSON.parse(value); console.log('解析后的数据:', data) // 返回内容 if (data.choices?.[0]?.delta?.content) { return { content: data.choices[0].delta.content, done: false }; } // 检查是否是结束标记 if (data.choices?.[0]?.finish_reason === 'stop') { return { content: data.choices?.[0]?.delta?.content || '', done: true }; } } catch(e) { console.error('JSON解析失败:', e, '数据:', value); } } } return { content: '', done: false }; }
06-03请问解决了吗
request.onChunkReceived 在ios真机上无效,微信版本8.0.56request.onChunkReceived 在模拟器、安卓手机上都正常,但是在ios真机上无效
05-30请问解决了吗
ios真机调试,onChunkReceived无响应。开发工具、安卓、电脑端小程序均没问题需求:调用大模型,流式返回。 问题:ios真机调试,onChunkReceived无响应。 开发工具、安卓、电脑端小程序均没问题,只有ios无反应。 图1为开发工具的页面加载打印。在ios真机控制台无打印[图片]
05-30请问解决了吗 目前是开发者工具和安卓真机是正常的 ios不正常 是一次性返回
request.onChunkReceived 在ios真机上无效,微信版本8.0.56const requestTask = wx.request({ url: '请求地址', enableChunked: true, }) // 以下回调在模拟器上有效,在ios真机上无效 requestTask.onChunkReceived(res => { console.log('onChunkReceived: ', res) })
05-27