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

【deepseek实战】绿色好用,不断网

前言

        最佳deepseek火热网络,我也开发一款windows的电脑端,接入了deepseek,基本是复刻了网页端,还加入一些特色功能。

        助力国内AI,发出自己的热量

        说一下开发过程和内容的使用吧。


目录

一、介绍

二、具体工作

        1.1、引用

        1.2、主界面

        1.3、主界面布局

        1.4 、消息类

        1.5 、设置

三、运行图示 

四、总结

五、下载


一、介绍

  •    目标:个人桌面AI助手,避免与专属API冲突,因为官网一些原因断网,自己接入API,确保能上deepseek。
    先上图,确定是否需要使用:
  • 软件是免费的,自己用自己的key或者别人的key,没有key可以联系我

二、具体工作

        1.1、引用

        dotnet8.0

  <TargetFramework>net8.0-windows</TargetFramework>

        PackageReference 

    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /><PackageReference Include="System.Drawing.Common" Version="8.0.0" /><PackageReference Include="System.Speech" Version="8.0.0" /><PackageReference Include="Spire.Doc" Version="12.8.0" />

            Newtonsoft.Json 编译和反编译API信息
            System.Drawing 绘制库,画界面主要
            System.Speech 语音接入
            Spire.Doc 文档使用

        这几个引用根据自己需要添加

        1.2、主界面

        信息处理,分为及时信息和二次信息处理,这样能对文本信息进行个人需要处理

private async Task<ChatMessage> StreamResponseAsync(string apiKey, List<ChatMessage> chatHistory, string language, CancellationToken cancellationToken)
{var deepseekService = new DeepseekService(currentUser, _printService);var messages = chatHistory.Select(m => new ChatMessage{Role = m.Role,MessageType = m.MessageType,Content = m.Content}).ToList();try{var typingDelay = TimeSpan.FromMilliseconds(50);var buffer = new StringBuilder();var responseMessage = new ChatMessage{Role = "assistant",MessageType = MessageType.Answer,Content = string.Empty,WrappedContent = string.Empty};// 创建响应消息但不立即添加到历史记录var responseIndex = _displayHistory .Count;// 实时处理流式响应 - deepseek输出开始var charCount = 0;var tempBuffer = new StringBuilder();await foreach (var chunk in deepseekService.StreamChatResponseAsync(apiKey, messages, language).WithCancellation(cancellationToken)){if (string.IsNullOrEmpty(chunk) || _isStopping || cancellationToken.IsCancellationRequested) {// Immediately return if stoppingreturn new ChatMessage{Role = "assistant",MessageType = MessageType.Answer,Content = "对话已终止",WrappedContent = "对话已终止"};}tempBuffer.Append(chunk);charCount += chunk.Length;// 每20个字符更新一次显示if (charCount >= 20){buffer.Append(tempBuffer.ToString());tempBuffer.Clear();charCount = 0;await Dispatcher.InvokeAsync(() => {responseMessage.Content = buffer.ToString();responseMessage.WrappedContent = WrapText(responseMessage.Content+"\n回答完成1",ChatHistoryRichTextBox?.ActualWidth - 20 ?? ChatMessage.DefaultBorderWidth);// 更新_curchat_curchatMesg = responseMessage;// 只在第一次更新时添加消息if (_displayHistory .Count == responseIndex) {_displayHistory .Add(responseMessage);} else {_displayHistory [responseIndex] = responseMessage;}UpdateChatHistoryDisplayList(_displayHistory);});          await Task.Delay(typingDelay);}}// 处理剩余不足20字符的内容if (tempBuffer.Length > 0){buffer.Append(tempBuffer.ToString());await Dispatcher.InvokeAsync(() => {responseMessage.Content = buffer.ToString() ;responseMessage.WrappedContent = WrapText(responseMessage.Content+"\n回答完成2",ChatHistoryRichTextBox?.ActualWidth - 20 ?? ChatMessage.DefaultBorderWidth);          // 更新_curchat_curchatMesg = responseMessage;_displayHistory [responseIndex] = responseMessage;UpdateChatHistoryDisplayList(_displayHistory);});}// deepseek输出完成 - 流式响应结束// 进行最后的换行检查await Dispatcher.InvokeAsync(() => {responseMessage.WrappedContent = WrapText(responseMessage.Content+"\n回答完成3", ChatHistoryRichTextBox?.ActualWidth - 20 ?? ChatMessage.DefaultBorderWidth);// 更新_curchat_curchatMesg = responseMessage;_displayHistory [responseIndex] = responseMessage;UpdateChatHistoryDisplayList(_displayHistory);});return responseMessage;}catch (Exception ex){return new ChatMessage{Role = "assistant",MessageType = MessageType.Answer,Content = $"Error: {ex.Message}",WrappedContent = $"Error: {ex.Message}"};}finally{// 清空输入框InputTextBox.Text = string.Empty;}
}

        1.3、主界面布局
<Window x:Class="AIzhushou.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local="clr-namespace:AIzhushou.Converters"Title="智能聊天助手" Height="820" Width="420" MinHeight="800" MinWidth="400"WindowStartupLocation="Manual"Background="#333333" ResizeMode="CanResizeWithGrip"><Window.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceDictionary Source="/Styles.xaml"/></ResourceDictionary.MergedDictionaries><local:EndMarkVisibilityConverter x:Key="EndMarkVisibilityConverter"/><local:MathConverter x:Key="MathConverter"/></ResourceDictionary></Window.Resources><Viewbox Stretch="Uniform"><Grid Width="420" Height="760" Background="#333333"><Grid.ColumnDefinitions><ColumnDefinition Width="63*"/><ColumnDefinition Width="337*"/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="*"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><!-- Top Buttons --><DockPanel Grid.Row="0" Grid.Column="1" Margin="265,0,20,5" Width="88"><Button  x:Name="setting" Style="{StaticResource MainButtonStyle}"Click="setting_Click" Height="40" Width="40" RenderTransformOrigin="0.5,0.5"DockPanel.Dock="Right"><Image Source="pack://application:,,,/AIzhushou;component/Img/icons8-home-page-50.png" Width="30" Height="30"/></Button></DockPanel><!-- Chat History Label --><Label Style="{StaticResource SectionLabelStyle}" Content="聊天记录" Margin="22,0,0,0" Grid.ColumnSpan="2" VerticalAlignment="Center"/><!-- Chat History RichTextBox --><Border Grid.Row="1" Style="{StaticResource ChatBorderStyle}" HorizontalAlignment="Left"Grid.ColumnSpan="2" Margin="15,0,0,10"><Border.Resources><Style TargetType="ScrollViewer" BasedOn="{StaticResource CustomScrollViewerStyle}" /></Border.Resources><RichTextBox x:Name="ChatHistoryRichTextBox" Style="{StaticResource ChatHistoryRichTextBoxStyle}"Loaded="ChatHistoryRichTextBox_Loaded" Width="380" Margin="-10,0,0,0"><RichTextBox.Resources><!-- 设置 Paragraph 的 Margin --><Style TargetType="Paragraph"><Setter Property="Margin" Value="0"/></Style></RichTextBox.Resources></RichTextBox></Border><!-- New Conversation Button --><StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,10,0,10" Grid.Column="1"><!--<Button x:Name="FreshButton" Style="{StaticResource FreshButtonStyle}" Click="freshButton_Click" Height="36" Width="120"><Button.Content><StackPanel Orientation="Horizontal"><Image Source="pack://application:,,,/AIzhushou;component/Img/icons8-refresh-96.png" Width="20" Height="20" Margin="0,0,5,0"/><TextBlock Text="刷新刚才回答" VerticalAlignment="Center" Foreground="#4d6bfe"/></StackPanel></Button.Content></Button>--><Button x:Name="NewConversationButton" Style="{StaticResource NewConversationButtonStyle}"Click="NewConversationButton_Click" Margin="90,0,5,0" Height="36" Width="120"><Button.Content><StackPanel Orientation="Horizontal"><Image Source="pack://application:,,,/AIzhushou;component/Img/icons8-talk-64.png" Width="20" Height="20" Margin="0,0,5,0"/><TextBlock Text="开启新对话" VerticalAlignment="Center" Foreground="#4d6bfe"/></StackPanel></Button.Content></Button></StackPanel><!-- Input Label --><Label Grid.Row="3" Style="{StaticResource SectionLabelStyle}" Content="输入消息" Margin="22,0,0,0" Grid.ColumnSpan="2" VerticalAlignment="Center"/><!-- Input Section --><Grid Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Bottom"Margin="22,0,0,-10" Width="378" Grid.ColumnSpan="2"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions><!-- Input TextBox --><TextBox x:Name="InputTextBox" Grid.Column="0"Style="{StaticResource InputTextBoxStyle}"TextWrapping="Wrap" AcceptsReturn="True"KeyDown="InputTextBox_KeyDown"PreviewKeyDown="InputTextBox_KeyDown"/><!-- Send Button --><Border Grid.Column="1" Style="{StaticResource SendButtonBorderStyle}" Margin="10,0,0,0"><Button x:Name="SendButton" Style="{StaticResource SendButtonStyle}"Content="发送" Click="SendButton_Click" IsEnabled="True"/></Border></Grid></Grid></Viewbox>
</Window>

        1.4 、消息类

        设计这个是为了对消息类对API的信息进行存入和处理

 public enum MessageType{Question,Answer}public class ChatMessage{public static double DefaultBorderWidth { get; set; } = 300;public string Role { get; set; }public string Content { get; set; }public string WrappedContent { get; set; }public double BorderWidth { get; set; } = DefaultBorderWidth;public Brush BackgroundColor { get; set; }public Brush TextColor { get; set; }public DateTime Timestamp { get; set; }    public MessageType MessageType { get; set; }public ChatMessage(){Role = string.Empty;Content = string.Empty;WrappedContent = string.Empty;Timestamp = DateTime.Now;BackgroundColor = Brushes.White;TextColor = Brushes.Black;}public ChatMessage(string content, string wrappedContent, double borderWidth) : this(){Content = content;WrappedContent = wrappedContent;BorderWidth = borderWidth;}}


        1.5 、设置

        API KEY这里是必须填写的,不填写是无法进行问题的回答

这里是代码

private void SaveButton_Click(object sender, RoutedEventArgs e)
{// 更新用户信息currentUser.Username = UsernameTextBox.Text;currentUser.Password = PasswordBox.Password;currentUser.AiUrl = AiUrlTextBox.Text;currentUser.ModelUrl = ModelUrlTextBox.Text;currentUser.ApiKey = ApiKeyTextBox.Text == "请输入deepseek的API keys" ? string.Empty : ApiKeyTextBox.Text;// 保存语言设置var selectedLanguage = ((ComboBoxItem)LanguageComboBox.SelectedItem).Content.ToString();string languageCode = selectedLanguage == "中文" ? "zh-CN" : "en-US";AppSettings.Instance.DefaultLanguage = languageCode;AppSettings.Instance.SaveLanguageSettings(languageCode);// 保存复制选项设置//AppSettings.Instance.CopyCurrent = CopyCurrentRadio.IsChecked == true;AppSettings.Instance.Save();// 保存到配置文件string configPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),"AIzhushou","config.json");// 确保目录存在var directoryPath = System.IO.Path.GetDirectoryName(configPath);if (string.IsNullOrEmpty(directoryPath)){throw new InvalidOperationException("无法确定配置文件的目录路径");}System.IO.Directory.CreateDirectory(directoryPath);// 序列化保存string json = Newtonsoft.Json.JsonConvert.SerializeObject(currentUser);System.IO.File.WriteAllText(configPath, json);MessageBox.Show("设置保存成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);this.Close();
}


三、运行图示 


四、总结

  •    实测了windows c#版本和python版本, c#版比python版本的性能更好,可能C#是微软亲儿子原因?
  •    一定用要异步处理,没有什么特别需要
  •    AI里面,deepseek是真的强
  •    如果需要提供协助,可以私信我

写着写着就这么多了,可能不是特别全,不介意费时就看看吧。有时间还会接着更新。


五、下载

        AI助手绿色免安装下载 支持deepseek

        AI助手项目下载

相关文章:

【deepseek实战】绿色好用,不断网

前言 最佳deepseek火热网络&#xff0c;我也开发一款windows的电脑端&#xff0c;接入了deepseek&#xff0c;基本是复刻了网页端&#xff0c;还加入一些特色功能。 助力国内AI&#xff0c;发出自己的热量 说一下开发过程和内容的使用吧。 目录 一、介绍 二、具体工作 1.1、引…...

MySQL 进阶专题:索引(索引原理/操作/优缺点/B+树)

在数据库的秋招面试中&#xff0c;索引&#xff08;Index&#xff09;是一个经典且高频的题目。索引的作用类似于书中的目录&#x1f4d6;&#xff0c;它能够显著加快数据库查询的速度。本文将深入探讨索引的概念、作用、优缺点以及背后的数据结构&#xff0c;帮助你从原理到应…...

用NeuralProphet预测股价:AI金融新利器(附源码)

作者&#xff1a;老余捞鱼 原创不易&#xff0c;转载请标明出处及原作者。 写在前面的话&#xff1a;我用NeuralProphet模型预测了股票价格&#xff0c;发现其通过结合时间序列分析和神经网络算法&#xff0c;确实能提供比传统Last Value方法更精准的预测。经过一系列超参数调优…...

【Elasticsearch】parent aggregation

在Elasticsearch中&#xff0c;Parent Aggregation是一种特殊的单桶聚合&#xff0c;用于选择具有指定类型的父文档&#xff0c;这些类型是通过一个join字段定义的。以下是关于Parent Aggregation的详细介绍&#xff1a; 1.基本概念 Parent Aggregation是一种聚合操作&#x…...

IDEA使用Auto-dev+DeepSeek 10分钟快速集成,让java开发起飞

在当今的软件开发领域,AI 工具的辅助作用愈发凸显,DeepSeek AI 便是其中的佼佼者。它凭借强大的自然语言处理能力和高效的代码生成能力,成为众多开发者的得力助手。而 IntelliJ IDEA 作为一款广受欢迎的集成开发环境(IDE),若能与 DeepSeek AI 无缝集成,无疑将为开发者带…...

ASP.NET Core中间件Markdown转换器

目录 需求 文本编码检测 Markdown→HTML 注意 实现 需求 Markdown是一种文本格式&#xff1b;不被浏览器支持&#xff1b;编写一个在服务器端把Markdown转换为HTML的中间件。我们开发的中间件是构建在ASP.NET Core内置的StaticFiles中间件之上&#xff0c;并且在它之前运…...

使用page assist浏览器插件结合deepseek-r1 7b本地模型

为本地部署的DeepSeek R1 7b模型安装Page Assist&#xff0c;可以按照以下步骤进行&#xff1a; 一、下载并安装Ollama‌ 首先&#xff0c;你需要下载并安装Ollama&#xff0c;这是部署DeepSeek所必需的工具。你可以访问Ollama的官方网站&#xff08;ollama.com&#xff09;下…...

【华为OD-E卷 - 108 最大矩阵和 100分(python、java、c++、js、c)】

【华为OD-E卷 - 最大矩阵和 100分&#xff08;python、java、c、js、c&#xff09;】 题目 给定一个二维整数矩阵&#xff0c;要在这个矩阵中选出一个子矩阵&#xff0c;使得这个子矩阵内所有的数字和尽量大&#xff0c;我们把这个子矩阵称为和最大子矩阵&#xff0c;子矩阵的…...

【Reading Notes】Favorite Articles from 2025

文章目录 1、January2、February3、March4、April5、May6、June7、July8、August9、September10、October11、November12、December 1、January 极越之后&#xff0c;中国车市只会倒下更多人&#xff08;2025年01月01日&#xff09; 在这波枪林弹雨中&#xff0c;合资品牌中最…...

云计算行业分析

云计算作为数字经济的核心基础设施&#xff0c;未来十年将持续重塑全球科技格局&#xff0c;并渗透到几乎所有行业的数字化转型中。 一、云计算的发展潜力 1. 技术融合驱动爆发式创新 AI与云计算的深度耦合 - **智能云服务**&#xff1a;云厂商将提供预训练模型、自动化ML工…...

【Linux系统】线程:线程的优点 / 缺点 / 超线程技术 / 异常 / 用途

1、线程的优点 创建和删除线程代价较小 创建一个新线程的代价要比创建一个新进程小得多&#xff0c;删除代价也小。这种说法主要基于以下几个方面&#xff1a; &#xff08;1&#xff09;资源共享 内存空间&#xff1a;每个进程都有自己独立的内存空间&#xff0c;包括代码段…...

3.攻防世界 weak_auth

题目描述提示 是一个登录界面&#xff0c;需要密码登录 进入题目页面如下 弱口令密码爆破 用1 or 1 #试试 提示用admin登录 则尝试 用户名admin密码&#xff1a;123456 直接得到flag 常用弱口令密码&#xff08;可复制&#xff09; 用户名 admin admin-- admin or -- admin…...

代码随想录算法训练营| 二叉树总结

代码随想录 二叉树的理论基础&#xff1a;二叉树种类、存储方式、遍历方式、定义方式 二叉树遍历&#xff1a;深度优先和广度优先 二叉树属性&#xff1a;对称、深度、节点、平衡、路径、回溯 修改与构造&#xff1a;反转、构造、合并 涉及到二叉树的构造&#xff0c;无论普…...

Python OCR工具pytesseract识别数字验证码

直接下载地址&#xff1a;https://digi.bib.uni-mannheim.de/tesseract/ 找的最新版本&#xff1a; 我添加了math 跟chinese&#xff08;因为是国内网络的原因吧&#xff0c;下载都失败&#xff0c;所以不用选择&#xff0c;后面自己下载后&#xff0c;添加到相应目录就好&…...

SpringBoot开发(五)SpringBoot接收请求参数

1. SpringBoot接收请求参数 1.1. 获取参数的方式 &#xff08;1&#xff09;通过request对象获取参数   &#xff08;2&#xff09;RequestParam(针对请求头方式为x-www-form-ur lencoded)   &#xff08;3&#xff09;RequestBody(针对请求头方式为application/json)   …...

文件基础IO

理解"文件" 1-1 狭义理解 文件在磁盘里磁盘是永久性存储介质&#xff0c;因此文件在磁盘上的存储是永久性的磁盘是外设&#xff08;即是输出设备也是输入设备&#xff09;磁盘上的文件 本质是对文件的所有操作&#xff0c;都是对外设的输入和输出简称IO 1-2 广义理…...

05vue3实战-----配置项目代码规范

05vue3实战-----配置项目代码规范 1.集成editorconfig配置2.使用prettier工具2.1安装prettier2.2配置.prettierrc文件&#xff1a;2.3创建.prettierignore忽略文件2.4VSCode需要安装prettier的插件2.5VSCod中的配置2.6测试prettier是否生效 3.使用ESLint检测3.1VSCode需要安装E…...

八大排序算法细讲

目录 排序 概念 运用 常见排序算法 插入排序 直接插入排序 思想&#xff1a; 步骤&#xff08;排升序&#xff09;: 代码部分&#xff1a; 时间复杂度&#xff1a; 希尔排序 思路 步骤 gap的取法 代码部分&#xff1a; 时间复杂度&#xff1a; 选择排序 直接选…...

网络爬虫学习:借助DeepSeek完善爬虫软件,增加停止任务功能

一、引言 我从24年11月份开始学习网络爬虫应用开发&#xff0c;经过2个来月的努力&#xff0c;终于完成了开发一款网络爬虫软件的学习目标。这几天对本次学习及应用开发进行一下回顾总结。前面已经发布了两篇日志&#xff1a; 网络爬虫学习&#xff1a;应用selenium从搜*狐搜…...

docker安装es及分词器ik

系统是macos&#xff0c;docker是docker-desktop 拉取镜像 docker pull bitnami/elasticsearch 启动docker镜像 docker create -e "discovery.typesingle-node" \ --name elasticsearch1 -p 9200:9200 -p 9300:9300 \ bitnami/elasticsearch:8.17.1 测试是否好…...

大数据学习栈记——Neo4j的安装与使用

本文介绍图数据库Neofj的安装与使用&#xff0c;操作系统&#xff1a;Ubuntu24.04&#xff0c;Neofj版本&#xff1a;2025.04.0。 Apt安装 Neofj可以进行官网安装&#xff1a;Neo4j Deployment Center - Graph Database & Analytics 我这里安装是添加软件源的方法 最新版…...

【根据当天日期输出明天的日期(需对闰年做判定)。】2022-5-15

缘由根据当天日期输出明天的日期(需对闰年做判定)。日期类型结构体如下&#xff1a; struct data{ int year; int month; int day;};-编程语言-CSDN问答 struct mdata{ int year; int month; int day; }mdata; int 天数(int year, int month) {switch (month){case 1: case 3:…...

Cursor实现用excel数据填充word模版的方法

cursor主页&#xff1a;https://www.cursor.com/ 任务目标&#xff1a;把excel格式的数据里的单元格&#xff0c;按照某一个固定模版填充到word中 文章目录 注意事项逐步生成程序1. 确定格式2. 调试程序 注意事项 直接给一个excel文件和最终呈现的word文件的示例&#xff0c;…...

Spring Boot 实现流式响应(兼容 2.7.x)

在实际开发中&#xff0c;我们可能会遇到一些流式数据处理的场景&#xff0c;比如接收来自上游接口的 Server-Sent Events&#xff08;SSE&#xff09; 或 流式 JSON 内容&#xff0c;并将其原样中转给前端页面或客户端。这种情况下&#xff0c;传统的 RestTemplate 缓存机制会…...

【入坑系列】TiDB 强制索引在不同库下不生效问题

文章目录 背景SQL 优化情况线上SQL运行情况分析怀疑1:执行计划绑定问题?尝试:SHOW WARNINGS 查看警告探索 TiDB 的 USE_INDEX 写法Hint 不生效问题排查解决参考背景 项目中使用 TiDB 数据库,并对 SQL 进行优化了,添加了强制索引。 UAT 环境已经生效,但 PROD 环境强制索…...

基于Uniapp开发HarmonyOS 5.0旅游应用技术实践

一、技术选型背景 1.跨平台优势 Uniapp采用Vue.js框架&#xff0c;支持"一次开发&#xff0c;多端部署"&#xff0c;可同步生成HarmonyOS、iOS、Android等多平台应用。 2.鸿蒙特性融合 HarmonyOS 5.0的分布式能力与原子化服务&#xff0c;为旅游应用带来&#xf…...

【C语言练习】080. 使用C语言实现简单的数据库操作

080. 使用C语言实现简单的数据库操作 080. 使用C语言实现简单的数据库操作使用原生APIODBC接口第三方库ORM框架文件模拟1. 安装SQLite2. 示例代码:使用SQLite创建数据库、表和插入数据3. 编译和运行4. 示例运行输出:5. 注意事项6. 总结080. 使用C语言实现简单的数据库操作 在…...

数据库分批入库

今天在工作中&#xff0c;遇到一个问题&#xff0c;就是分批查询的时候&#xff0c;由于批次过大导致出现了一些问题&#xff0c;一下是问题描述和解决方案&#xff1a; 示例&#xff1a; // 假设已有数据列表 dataList 和 PreparedStatement pstmt int batchSize 1000; // …...

Android15默认授权浮窗权限

我们经常有那种需求&#xff0c;客户需要定制的apk集成在ROM中&#xff0c;并且默认授予其【显示在其他应用的上层】权限&#xff0c;也就是我们常说的浮窗权限&#xff0c;那么我们就可以通过以下方法在wms、ams等系统服务的systemReady()方法中调用即可实现预置应用默认授权浮…...

Netty从入门到进阶(二)

二、Netty入门 1. 概述 1.1 Netty是什么 Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients. Netty是一个异步的、基于事件驱动的网络应用框架&#xff0c;用于…...