当前位置: 首页 > news >正文

网站建设完成大概多久怎样开电商平台

网站建设完成大概多久,怎样开电商平台,免费素材库大全网站,顺企网网站建设目录 背景 分析 解决方案 背景 正常情况下,会从Openai Realtime api Sever收到正常的json数据,但是当返回音频数据时,总会返回非json数据。这是什么问题呢? 分析 期望的完整响应数据如下: {"session": {"inp…

目录

背景

分析

解决方案


背景

正常情况下,会从Openai Realtime api Sever收到正常的json数据,但是当返回音频数据时,总会返回非json数据。这是什么问题呢?

分析

期望的完整响应数据如下:

{"session": {"input_audio_format": "pcm16","instructions": "Role: 1.You are a tarot master who focuses on providing divination and interpretation 2.Your name is Luna 3.Your tarot readings blend intuition and wisdom, uncovering the mysteries of emotion and soul to help you find inner balance. \\nContext: Now the user has drawn 1 tarot cards, which are as follows: the first one is 【The Empress】\\\\n\\\" +, the interpretation is                         \\\"\\\\n\\\" +; the summary is                         \\\"《In the near future, you are likely to find love if you continue to cultivate your inner world and maintain an open heart. Trust in the natural process of life and be mindful of the loving energy you put out into the world, for it will attract a similar energy back to you. Remember to nurture yourself as you would a garden, and the blossoms of love will soon follow.》.\\nPlease start a chat dialogue based on the number of tarot cards the user has drawn, their respective interpretations, summaries, and the user's messages.\\nNote: 1. Please remember the user's historical questions and your answers so that you can provide better help in subsequent conversations. 2.The output characters should be less than 150.","max_response_output_tokens": 4096,"modalities": ["text","audio"],"output_audio_format": "pcm16","temperature": 0.8,"tool_choice": "auto","tools": [],"turn_detection": {"prefix_padding_ms": 300,"silence_duration_ms": 500,"threshold": 0.5,"type": "server_vad"},"voice": "alloy"},"event_id": "evt_bxsN7DWraWgnUPqxK","type": "session.update"
}

实际收到的数据类似如下:

eart. Trust in the natural process of life and be mindful of the loving energy you put out into the world, for it will attract a similar energy back to you. Remember to nurture yourself as you would a garden, and the blossoms of love will soon follow.》.\\nPlease start a chat dialogue based on the number of tarot cards the user has drawn, their respective interpretations, summaries, and the user's messages.\\nNote: 1. Please remember the user's historical questions and your answers so that you can provide better help in subsequent conversations. 2.The output characters should be less than 150.","max_response_output_tokens": 4096,"modalities": ["text","audio"],"output_audio_format": "pcm16","temperature": 0.8,"tool_choice": "auto","tools": [],"turn_detection": {"prefix_padding_ms": 300,"silence_duration_ms": 500,"threshold": 0.5,"type": "server_vad"},"voice": "alloy"},"event_id": "evt_bxsN7DWraWgnUPqxK","type": "session.update"
}

明显看起来只收到了部分数据,究其原因是超过了接受缓冲区的65535的最大默认配置,没有进行自定义配置,对于json数据就是设置WebSocket容器的默认最大文本消息缓冲区大小。

解决方案

设置最大文本消息缓冲区大小,具体代码如下:

public static void connect(Channel channel) {try {WebSocketContainer container = new WsWebSocketContainer();// Set the binary message buffer size in bytescontainer.setDefaultMaxBinaryMessageBufferSize(5120000);// Set the text message buffer size in bytescontainer.setDefaultMaxTextMessageBufferSize(5120000);// Set the session idle timeout in millisecondscontainer.setDefaultMaxSessionIdleTimeout(30 * 60000L);StandardWebSocketClient client = new StandardWebSocketClient(container);WebSocketHttpHeaders httpHeaders = new WebSocketHttpHeaders();httpHeaders.add("Authorization", "Bearer sk-***");httpHeaders.add("OpenAI-Beta", "realtime=v1");WebSocketSession session = client.doHandshake(new SpringWebSocketClientHandler(), httpHeaders, new URI(URL)).get();if (session.isOpen()) {log.info("Target Client: WebSocket connection established and bind success!");log.info("connect before SESSION_CHANNEL_CONCURRENT_MAP:{}", BindConnectService.SESSION_CHANNEL_CONCURRENT_MAP);BindConnectService.safeBindChannelSession(session, channel);log.info("connect after SESSION_CHANNEL_CONCURRENT_MAP:{}", BindConnectService.SESSION_CHANNEL_CONCURRENT_MAP);} else {log.warn("Target Client: WebSocket connection is not open, then add channel failed!");channel.close();}} catch (Exception e) {log.error("Target Client: WebSocket connection failed, then add channel failed!", e);channel.close();}}

http://www.yayakq.cn/news/622248/

相关文章:

  • 百度引流推广哪家好惠州seo关键字排名
  • 江苏省义务教育标准化建设网站长沙麓谷建设发展有限公司网站
  • 宁夏建设工程招标投标管理中心网站传奇免费网站模板下载
  • 芍药居做网站公司部门网站建设和维护
  • 微信小程序可以做网站用wordpress更改作者信息
  • 网页微信登录seo网络推广排名
  • 免费做logo网站wordpress设置支付宝
  • 网站建设如何开封市住房和城乡建设局网站
  • 宁波网站建设哪家好建设工程交易中心官网
  • 先做网页设计还是先弄网站做外贸铝材哪个网站比较好
  • 自主网站制作网络推广培训班好吗
  • 合肥网站制作公司排名温州比较好的设计公司
  • 顶做抱枕网站潍坊中脉网站建设
  • asp静态网站源码济南网络营销服务公司
  • php做网站导购模板行业网站开发程序
  • 龙华网站建设网站定制wordpress文章模型插件
  • 仙居网站建设外国人做那个的视频网站
  • 国外市场网站推广公司怎么做属于自己的网站
  • 网站开发学什么数据库学生免费服务器
  • 拓者设计吧会员有啥区别郑州做网站优化价格
  • 怎么做自己的门户网站网站建设最好的公司排名
  • 生鲜做的好的网站数据分析对网站建设的重要性
  • 网站logo用什么做wordpress换域名把家
  • 聊大 网站设计安徽网站开发公司
  • ui设计培训班怎么样优化流程
  • 山东网站建站系统平台百度怎么添加店铺地址
  • 网站前置审核申请报告如何做英文网站的中文网
  • 服装设计类网站html设计素材网站
  • 写作的网站哪个好公司营业执照查询
  • 设计网站 常用字体苏州十大软件公司