DeepSeek模型R1服务器繁忙,怎么解决?
在当今科技飞速发展的时代,人工智能领域不断涌现出令人瞩目的创新成果,其中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()) {List<Choices> choicesList = jsonParse.choices;for (Choices temp : choicesList) {System.out.print(temp.delta.reasoning_content);}}}}}connection.disconnect();} catch (Exception e) {e.printStackTrace();}}
}class JsonParse {List<Choices> 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"; //从服务管控获取要访问服务的serviceID:https://training.xfyun.cn/modelServicepublic static List<RoleContent> 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, "");}List<Text> 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 {List<Text> 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;}}
}
相关文章:
DeepSeek模型R1服务器繁忙,怎么解决?
在当今科技飞速发展的时代,人工智能领域不断涌现出令人瞩目的创新成果,其中DeepSeek模型无疑成为了众多关注焦点。它凭借着先进的技术和卓越的性能,在行业内掀起了一股热潮,吸引了无数目光。然而,如同许多前沿技术在发…...
GlusterFS 深度洞察:从架构原理到案例实践的全面解读(上)
文章目录 一.GlusterFS简介二.GlusterFS原理架构三.适用场景四.Glusterfs与其他存储产品对比五.部署GlusterFS集群六. 使用heketi将glusterfs接入k8s作为后端存储 一.GlusterFS简介 GlusterFS是一个免费的开源分布式文件系统,具有无中心节点、堆栈式设计、全局统一…...
更新无忧:用 Docker 数据卷确保 Open WebUI 数据持久化
在使用 Docker 部署 Open WebUI 时,如何在更新容器的同时确保数据不丢失,始终是工程师们关注的焦点。每次拉取新版镜像、停止并重启容器时,如果没有正确挂载数据卷,配置和数据库数据极易流失,给生产环境带来不必要的麻…...
zyNo.22
常见Web漏洞解析 命令执行漏洞 1.Bash与CMD常用命令 (1)Bash 读取文件:最常见的命令cat flag 在 Bash 中,cat 以及的tac、nl、more、head、less、tail、od、pr 均为文件读取相关命令,它们的区别如下: …...
idea如何使用AI编程提升效率-在IntelliJ IDEA 中安装 GitHub Copilot 插件的步骤-卓伊凡
idea如何使用AI编程提升效率-在IntelliJ IDEA 中安装 GitHub Copilot 插件的步骤-卓伊凡 问题 idea编译器 安装copilot AI工具 实际操作 在 IntelliJ IDEA 中安装 GitHub Copilot 插件的步骤如下: 打开 IntelliJ IDEA: 打开你的 IntelliJ IDEA 应用…...
有哪些PHP开源框架属于是“高开疯走”的?
“高开疯走”是一个网络流行语或者谐音梗。可能是指一开始起点很高(高开),然后发展迅速或者变得非常牛(疯走)。 在PHP生态中,一些框架面对市场的风起云涌,能持续保持高质量发展,切实…...
C# ASP.NET核心特性介绍
.NET学习资料 .NET学习资料 .NET学习资料 在当今的软件开发领域中,C# ASP.NET凭借其强大的功能和丰富的特性,成为构建 Web 应用程序的重要技术之一。以下将详细介绍 C# ASP.NET的核心特性。 多语言支持 ASP.NET 支持多种语言进行开发,这使…...
在 Linux 系统下,解压 `.tar.gz`
在 Linux 系统下,解压 .tar.gz 文件通常使用 tar 命令。.tar.gz 文件是一种压缩归档文件,它首先使用 tar 命令将多个文件打包为一个 .tar 文件,然后再使用 gzip 压缩生成 .tar.gz 文件。 解压 .tar.gz 文件的命令 要解压 .tar.gz 文件,可以使用以下命令: tar -xzvf fil…...
Unity 接入Tripo 文生模型,图生模型
官方网站:https://www.tripo3d.ai/app/home自行注册账号并且登陆下载Unity插件:https://cdn-web.tripo3d.ai/plugin/tripo-unity.zip申请apikey: https://platform.tripo3d.ai/api-keys使用(后续过程就按照第二步下载的插件里面的…...
WPS计算机二级•文档的文本样式与编号
听说这是目录哦 标题级别❤️新建文本样式 快速套用格式🩷设置标题样式 自定义设置多级编号🧡使用自动编号💛取消自动编号💚设置 页面边框💙添加水印🩵排版技巧怎么分栏💜添加空白下划线&#x…...
安卓使用JExcelApi读取Excel文件
要在安卓应用中使用JExcelApi读取Excel文件,你需要先确保你的项目中已经添加了JExcelApi的依赖。由于安卓项目的构建方式多样,这里以使用Gradle为例来介绍如何在安卓应用中集成和使用JExcelAPI。 ### 步骤1: 添加依赖 首先,在你的build.gra…...
外部中断实验 #STM32F407
外部中断实验 此实验将外部中断配置为按键输入,通过按键输入触发外部中断,在外部中断里面实施相应的处理,具体功能: 按下KEY0,翻转LED0状态按下KEY1,翻转LED1状态按下KEY2,同时翻转LED0和LED1…...
kafka了解-笔记
文章目录 kafka快速上手Kafka介绍Kafka快速上手理解Kafka的集群工作机制Kafka集群的消息流转模型 Kafka客户端小型流转流程客户端工作机制 kafka快速上手 Kafka介绍 MQ的作用 MQ:MessageQueue,消息队列,是一种FIFO先进先出的数据结构&#…...
渗透利器:Burp Suite 联动 XRAY 图形化工具.(主动扫描+被动扫描)
Burp Suite 联动 XRAY 图形化工具.(主动扫描被动扫描) Burp Suite 和 Xray 联合使用,能够将 Burp 的强大流量拦截与修改功能,与 Xray 的高效漏洞检测能力相结合,实现更全面、高效的网络安全测试,同时提升漏…...
解决QTimer报“Timers cannot be started from another thread“错误
今天在Qt编程时,将QTimer在子线程里执行start()函数,遇到“Timers cannot be started from another thread”问题,使用了如下AI工具,进行查询: 提示词A:“C QTimer 如何跨线程” 提示词B&#…...
vant4 van-list组件的使用
<van-listv-if"joblist && joblist.length > 0"v-model:loading"loading":finished"finished":immediate-check"false"finished-text"没有更多了"load"onLoad">// 加载 const loading ref(fals…...
C++11新特性之weak_ptr智能指针
本节介绍最后一个智能指针——weak_ptr智能指针。 1.介绍 weak_ptr智能指针也是以模板类的方式实现的。同样定义在<memory>头文件,并位于std命名空间中。在使用前需包含这两条语句。 C11虽然将weak_ptr当做智能指针,但该类型通常不单独使用&#…...
LM Studio无设置代理,更改镜像源方法(MAC)
在macbook上使用LM Studio时发现总是加载失败,App也没有设置代理的地方,搜索了挺多解决方案,貌似官网再可以封补很多解决方案已经过时,最终找到一种替换镜像源的方法共享出来。 方便大家都能使用,不介绍命令行修改方式…...
js中的== 和 ===运算符的比较和区别(面试题)
和 运算符用于比较 JavaScript 值是否相等。 自动转换数据类型,允许不同类型值的比较。 进行严格相等比较,仅在值和数据类型都相同的情况下返回 true。NaN 仅在 比较中与自身相等,而在 比较中不相等。null 和 undefined 仅在 比较中相等。…...
通过客户端Chatbox或OpenwebUI访问识别不到本地ollama中的模型等问题的解决
Chatbox和Open WebUI 等无法获取到 Ollama里的模型,主要是由以下原因导致: Ollama 服务未正确暴露给 Docker 容器或客户端模型未正确下载或名称不匹配网络配置或权限问题 排查以上问题的思路首先排查ollama服务是否启动,然后再看端口号 使…...
C# 上位机--变量
C# 上位机--变量 在 C# 上位机开发领域,变量是构建程序逻辑的基础元素之一。它就像是一个容器,用于存储各种类型的数据,从简单的数值到复杂的对象。正确理解和使用变量,对于开发出高效、稳定且易于维护的上位机程序至关重要。本文…...
【Mastering Vim 2_01】开篇词:在 AI 时代持续深耕底层技术,做长期主义的坚定捍卫者
【最新版《Mastering Vim》封面,涵盖 Vim 9.0 版特性】 文章目录 1 背景:AI 时代的底层技术觉醒2 Vim:一款被严重低估的文本编辑神器3 聊聊 IT 人士的职业病4 进阶之道:构建完整的知识体系5 从 AI 时代的深耕与精进再谈长期主义 1…...
【JVM详解二】常量池
一、常量池概述 JVM的常量池主要有以下几种: class文件常量池运行时常量池字符串常量池基本类型包装类常量池 它们相互之间关系大致如下图所示: 每个 class 的字节码文件中都有一个常量池,里面是编译后即知的该 class 会用到的字面量与符号引…...
Leetcode - 149双周赛
目录 一、3438. 找到字符串中合法的相邻数字二、3439. 重新安排会议得到最多空余时间 I三、3440. 重新安排会议得到最多空余时间 II四、3441. 变成好标题的最少代价 一、3438. 找到字符串中合法的相邻数字 题目链接 本题有两个条件: 相邻数字互不相同两个数字的的…...
Java爬虫:打造高效的数据抓取利器——详解详情接口设计与实现
在当今数字化时代,数据如同黄金般珍贵。无论是企业进行市场调研、竞争对手分析,还是研究人员收集信息,数据的需求无处不在。而爬虫技术,作为一种高效的数据抓取手段,成为了众多开发者手中的利器。本文将深入探讨如何使…...
蓝桥杯K倍区间(前缀和与差分,取模化简)
输入 5 2 1 2 3 4 5 输出 6 思路:首先由连续子串和可以想用前缀和,由于加减法总和取模和分别取模结果不受影响,所以我们前缀和之后直接取模方便观察性质,本题前缀和:1,3,6,10&#…...
CEF132 编译指南 MacOS 篇 - depot_tools 安装与配置 (四)
1. 引言 在 CEF132(Chromium Embedded Framework)的编译过程中,depot_tools 扮演着举足轻重的角色。这套由 Chromium 项目精心打造的脚本和工具集,专门用于获取、管理和更新 Chromium 及其相关项目(包括 CEFÿ…...
Ubuntu 20.04 上安装 qBittorrent
qBittorrent 通过终端安装 系统更新系统升级在 Ubuntu 20.04 上添加 Qbittorent PPA系统更新Qbittorent 安装 Qbittorent 是一个开源且可免费使用的点对点比特流客户端。它体积小,不加载内存盘。众所周知,此应用程序可以在许多操作系统(例如…...
iPhone 在华销量大幅下挫
iPhone在乔布斯时代缔造的神话在中国正逐渐走向没落,挤牙膏式的升级方式类似于诺基亚的N70系列,毫无新意的创新能力,求稳着陆的经营理念,工艺和美学不再独领风骚,甚至拍照领域和AI增强计算,折叠屏等技术领域…...
【Ubuntu VScode Remote SSH 问题解决】Resolver error: Error: XHR failed
1. 问题描述 VScode使用remote ssh 远程服务器,报错类似: [12:06:01.219] Downloading VS Code server locally... [12:06:01.310] Resolver error: Error: XHR failedat k.onerror (vscode-file://vscode-app/private/var/folders/g1/cvs2rnpx60qc3b4…...
