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

珠海网站建设培训班wordpress网页宽度

珠海网站建设培训班,wordpress网页宽度,网站二级分类,author 1 wordpress在当今科技飞速发展的时代#xff0c;人工智能领域不断涌现出令人瞩目的创新成果#xff0c;其中DeepSeek模型无疑成为了众多关注焦点。它凭借着先进的技术和卓越的性能#xff0c;在行业内掀起了一股热潮#xff0c;吸引了无数目光。然而#xff0c;如同许多前沿技术在发…在当今科技飞速发展的时代人工智能领域不断涌现出令人瞩目的创新成果其中DeepSeek模型无疑成为了众多关注焦点。它凭借着先进的技术和卓越的性能在行业内掀起了一股热潮吸引了无数目光。然而如同许多前沿技术在发展初期所面临的挑战一样DeepSeek模型在实际应用中也暴露出了一系列亟待解决的问题这些问题犹如一道道屏障限制了其更广泛的应用和深入的发展。而讯飞开放平台凭借其强大的实力和丰富的经验正致力于为解决这些痛点提供全面而有效的解决方案。 首先服务不稳定是DeepSeek模型当前面临的一个突出问题。在实际应用中用户对于服务的稳定性有着极高的要求。无论是企业的生产运营还是个人的日常使用都希望能够获得持续、稳定的服务支持。然而DeepSeek模型由于各种因素的影响时常出现服务波动的情况这给用户带来了极大的困扰。比如在进行重要任务处理时突然的服务中断可能导致数据丢失、工作延误等一系列严重后果。讯飞开放平台深知服务稳定性的重要性通过优化自身的技术架构和服务体系采用先进的云计算技术和分布式存储方案确保平台的高可用性和可靠性。同时讯飞还建立了完善的监控和预警机制能够实时监测服务的运行状态及时发现并解决潜在的问题为用户的使用提供了坚实的保障。 HTTP调用源代码   package day;import com.google.gson.Gson; import org.json.JSONArray; import org.json.JSONObject;import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.List;public class MaasApiClient {public static Gson gson new Gson();public static void main(String[] args) {try {URL url new URL(http://maas-api.cn-huabei-1.xf-yun.com/v1/chat/completions);HttpURLConnection connection (HttpURLConnection) url.openConnection();// 设置请求头connection.setRequestMethod(POST);connection.setRequestProperty(Content-Type, application/json);connection.setRequestProperty(Authorization, Bearer );connection.setDoOutput(true);connection.setChunkedStreamingMode(0); // 啓用分塊傳輸// 构建JSON请求体JSONObject requestBody new JSONObject();requestBody.put(model, xdeepseekr1);JSONArray messages new JSONArray();JSONObject message new JSONObject();message.put(role, user);message.put(content, 你是谁);messages.put(message);requestBody.put(messages, messages);requestBody.put(temperature, 0.01);requestBody.put(stream, true);requestBody.put(max_tokens, 4096);// 发送请求try (OutputStream os connection.getOutputStream()) {byte[] input requestBody.toString().getBytes(StandardCharsets.UTF_8);os.write(input, 0, input.length);}// 处理流式返回try (BufferedReader reader new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {String line;while ((line reader.readLine()) ! null) {// System.out.println(line);if (!line.contains([DONE])) {line line.replace(data: , );// System.out.println(line);JsonParse jsonParse gson.fromJson(line, JsonParse.class);if (!line.isEmpty()) {ListChoices choicesList jsonParse.choices;for (Choices temp : choicesList) {System.out.print(temp.delta.reasoning_content);}}}}}connection.disconnect();} catch (Exception e) {e.printStackTrace();}} }class JsonParse {ListChoices choices; }class Choices {Delta delta; }class Delta {String reasoning_content; }Webscoket调用源代码 package org.example;import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import okhttp3.*;import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import java.io.IOException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.*;public class BigModelNew extends WebSocketListener {// 以下信息从服务管控页面获取https://training.xfyun.cn/modelServicepublic static final String hostUrl wss://maas-api.cn-huabei-1.xf-yun.com/v1.1/chat; // 服务地址public static final String appid ;public static final String apiSecret ;public static final String apiKey ;public static final String patch_id 0; //调用微调大模型时必传,否则不传。对应为模型服务卡片上的resourceIdpublic static final String domain xdeepseekr1; //从服务管控获取要访问服务的serviceIDhttps://training.xfyun.cn/modelServicepublic static ListRoleContent historyList new ArrayList(); // 对话历史存储集合public static String totalAnswer ; // 大模型的答案汇总 你是满血671b版本吗// 环境治理的重要性 环保 人口老龄化 我爱我的祖国 你是谁 明天合肥的天气 我的名字叫大王 我叫什么名字// 点评一下安徽的发展和经济以及工资和发展的差距说的要直接可以public static String NewQuestion ;public static final Gson gson new Gson();// 个性化参数private String userId;private Boolean wsCloseFlag;private static Boolean totalFlag true; // 控制提示用户是否输入// 构造函数public BigModelNew(String userId, Boolean wsCloseFlag) {this.userId userId;this.wsCloseFlag wsCloseFlag;}// 主函数public static void main(String[] args) throws Exception {// 个性化参数入口如果是并发使用可以在这里模拟while (true) {if (totalFlag) {Scanner scanner new Scanner(System.in);System.out.print(我);totalFlag false;NewQuestion scanner.nextLine();// 构建鉴权urlString authUrl getAuthUrl(hostUrl, apiKey, apiSecret);OkHttpClient client new OkHttpClient.Builder().build();String url authUrl.toString().replace(http://, ws://).replace(https://, wss://);Request request new Request.Builder().url(url).build();for (int i 0; i 1; i) {totalAnswer ;WebSocket webSocket client.newWebSocket(request, new BigModelNew(i , false));}} else {Thread.sleep(200);}}}public static boolean canAddHistory() { // 由于历史记录最大上线1.2W左右需要判断是能能加入历史int history_length 0;for (RoleContent temp : historyList) {history_length history_length temp.content.length();}if (history_length 12000) {historyList.remove(0);historyList.remove(1);historyList.remove(2);historyList.remove(3);historyList.remove(4);return false;} else {return true;}}// 线程来发送音频与参数class MyThread extends Thread {private WebSocket webSocket;public MyThread(WebSocket webSocket) {this.webSocket webSocket;}public void run() {try {JSONObject requestJson new JSONObject();String[] arr new String[1];arr[0] patch_id;JSONObject header new JSONObject(); // header参数header.put(app_id, appid);header.put(uid, UUID.randomUUID().toString().substring(0, 10));header.put(patch_id, arr);JSONObject parameter new JSONObject(); // parameter参数JSONObject chat new JSONObject();chat.put(domain, domain); //调用微调大模型时对应为模型服务卡片上的serviceidchat.put(temperature, 0.5);chat.put(max_tokens, 4096); //请根据不同模型支持范围适当调整该值的大小parameter.put(chat, chat);JSONObject payload new JSONObject(); // payload参数JSONObject message new JSONObject();JSONArray text new JSONArray();// 历史问题获取if (historyList.size() 0) {for (RoleContent tempRoleContent : historyList) {text.add(JSON.toJSON(tempRoleContent));}}// 最新问题RoleContent roleContent new RoleContent();roleContent.role user;roleContent.content NewQuestion;text.add(JSON.toJSON(roleContent));historyList.add(roleContent);message.put(text, text);payload.put(message, message);requestJson.put(header, header);requestJson.put(parameter, parameter);requestJson.put(payload, payload);System.err.println(requestJson); // 可以打印看每次的传参明细webSocket.send(requestJson.toString());// 等待服务端返回完毕后关闭while (true) {// System.err.println(wsCloseFlag ---);Thread.sleep(200);if (wsCloseFlag) {break;}}webSocket.close(1000, );} catch (Exception e) {e.printStackTrace();}}}Overridepublic void onOpen(WebSocket webSocket, Response response) {super.onOpen(webSocket, response);System.out.print(大模型);MyThread myThread new MyThread(webSocket);myThread.start();}Overridepublic void onMessage(WebSocket webSocket, String text) {// System.out.println(userId 用来区分那个用户的结果 text);JsonParse myJsonParse gson.fromJson(text, JsonParse.class);if (myJsonParse.header.code ! 0) {System.out.println(发生错误错误码为 myJsonParse.header.code);System.out.println(本次请求的sid为 myJsonParse.header.sid);webSocket.close(1000, );}ListText textList myJsonParse.payload.choices.text;for (Text temp : textList) {System.out.print(temp.content);totalAnswer totalAnswer temp.content;}if (myJsonParse.header.status 2) {// 可以关闭连接释放资源System.out.println();System.out.println(*************************************************************************************);if (canAddHistory()) {RoleContent roleContent new RoleContent();roleContent.setRole(assistant);roleContent.setContent(totalAnswer);historyList.add(roleContent);} else {historyList.remove(0);RoleContent roleContent new RoleContent();roleContent.setRole(assistant);roleContent.setContent(totalAnswer);historyList.add(roleContent);}wsCloseFlag true;totalFlag true;}}Overridepublic void onFailure(WebSocket webSocket, Throwable t, Response response) {super.onFailure(webSocket, t, response);try {if (null ! response) {int code response.code();System.out.println(onFailure code: code);System.out.println(onFailure body: response.body().string());if (101 ! code) {System.out.println(connection failed);System.exit(0);}}} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}// 鉴权方法public static String getAuthUrl(String hostUrl, String apiKey, String apiSecret) throws Exception {String newUrl hostUrl.toString().replace(ws://, http://).replace(wss://, https://);URL url new URL(newUrl);// 时间SimpleDateFormat format new SimpleDateFormat(EEE, dd MMM yyyy HH:mm:ss z, Locale.US);format.setTimeZone(TimeZone.getTimeZone(GMT));String date format.format(new Date());// 拼接String preStr host: url.getHost() \n date: date \n GET url.getPath() HTTP/1.1;// System.err.println(preStr);// SHA256加密Mac mac Mac.getInstance(hmacsha256);SecretKeySpec spec new SecretKeySpec(apiSecret.getBytes(StandardCharsets.UTF_8), hmacsha256);mac.init(spec);byte[] hexDigits mac.doFinal(preStr.getBytes(StandardCharsets.UTF_8));// Base64加密String sha Base64.getEncoder().encodeToString(hexDigits);// System.err.println(sha);// 拼接String authorization String.format(api_key\%s\, algorithm\%s\, headers\%s\, signature\%s\, apiKey, hmac-sha256, host date request-line, sha);// 拼接地址HttpUrl httpUrl Objects.requireNonNull(HttpUrl.parse(https:// url.getHost() url.getPath())).newBuilder().//addQueryParameter(authorization, Base64.getEncoder().encodeToString(authorization.getBytes(StandardCharsets.UTF_8))).//addQueryParameter(date, date).//addQueryParameter(host, url.getHost()).//build();//System.err.println(httpUrl.toString());return httpUrl.toString();}//返回的json结果拆解class JsonParse {Header header;Payload payload;}class Header {int code;int status;String sid;}class Payload {Choices choices;}class Choices {ListText text;}class Text {String role;String content;}class RoleContent {String role;String content;public String getRole() {return role;}public void setRole(String role) {this.role role;}public String getContent() {return content;}public void setContent(String content) {this.content content;}} }
http://www.zqtcl.cn/news/794913/

相关文章:

  • 浙江省建设厅继续教育官方网站网站做vr的收费
  • 建造网站 备案苏州手机网站设计
  • 做外贸卖小商品是哪个网站手机首页设计
  • 大连网站制作公司营销策划公司有哪些职位
  • 2019深圳网站设计公司排名网站设计的思想
  • 试客那个网站做的好seo管理平台
  • 增加网站关键词库网盟推广合作
  • 企业门户网站内容建设濮阳网络培训基地
  • 做亚马逊运营要看哪些网站免费咨询电脑问题
  • 如何用html制作网站app开发要多少钱
  • 中国搜索提交网站信息网络犯罪
  • 网站服务器做下载链接分销平台系统源码
  • 网站管理助手建站沈阳专业网站建设企业
  • 企业网站开发公司大全建筑工程培训
  • 免费网站开发模板云南省网站开发软件
  • dede小游戏php网站源码广州网站vi设计报价
  • 邯郸建设局网站资质申报wordpress 前端 插件
  • 关于asp_sql网站开发的书籍小程序跳转网页方法
  • 昆明网站开发公司电话建设手机银行的网站
  • 福州建设注册中心网站怎么做公司展示网站
  • 网络营销网站建设知识平面设计初中毕业能学吗
  • 2019销售网站开发与设计现状怎么在网上卖东西赚钱
  • 做网站前后端的发布流程如何管理wordpress网站模板下载
  • 网站历史频道怎么做网站修改标题有影响吗
  • 做自己的卡盟网站做技术一般逛那些网站
  • 网站建设自学多长时间做网站原型的软件
  • 营销型的物流网站模板北京楼市最新消息
  • 宁波模版建站公司湘潭建设网站公司
  • 世界十大网站排名出炉最新军事新闻最新消息视频
  • 医疗电子的网站建设城市建设管理