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

网站怎么创建太原互联网推广公司

网站怎么创建,太原互联网推广公司,企业文化ppt模板免费,深圳常平网站建设制作公司前言 最佳deepseek火热网络#xff0c;我也开发一款windows的电脑端#xff0c;接入了deepseek#xff0c;基本是复刻了网页端#xff0c;还加入一些特色功能。 助力国内AI#xff0c;发出自己的热量 说一下开发过程和内容的使用吧。 目录 一、介绍 二、具体工作 1.1、引…前言 最佳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 TargetFrameworknet8.0-windows/TargetFramework PackageReference  PackageReference IncludeNewtonsoft.Json Version13.0.3 /PackageReference IncludeSystem.Drawing.Common Version8.0.0 /PackageReference IncludeSystem.Speech Version8.0.0 /PackageReference IncludeSpire.Doc Version12.8.0 / Newtonsoft.Json 编译和反编译API信息             System.Drawing 绘制库画界面主要             System.Speech 语音接入             Spire.Doc 文档使用 这几个引用根据自己需要添加 1.2、主界面 信息处理分为及时信息和二次信息处理这样能对文本信息进行个人需要处理 private async TaskChatMessage StreamResponseAsync(string apiKey, ListChatMessage 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:ClassAIzhushou.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:localclr-namespace:AIzhushou.ConvertersTitle智能聊天助手 Height820 Width420 MinHeight800 MinWidth400WindowStartupLocationManualBackground#333333 ResizeModeCanResizeWithGripWindow.ResourcesResourceDictionaryResourceDictionary.MergedDictionariesResourceDictionary Source/Styles.xaml//ResourceDictionary.MergedDictionarieslocal:EndMarkVisibilityConverter x:KeyEndMarkVisibilityConverter/local:MathConverter x:KeyMathConverter//ResourceDictionary/Window.ResourcesViewbox StretchUniformGrid Width420 Height760 Background#333333Grid.ColumnDefinitionsColumnDefinition Width63*/ColumnDefinition Width337*//Grid.ColumnDefinitionsGrid.RowDefinitionsRowDefinition HeightAuto/RowDefinition Height*/RowDefinition HeightAuto/RowDefinition HeightAuto/RowDefinition HeightAuto//Grid.RowDefinitions!-- Top Buttons --DockPanel Grid.Row0 Grid.Column1 Margin265,0,20,5 Width88Button x:Namesetting Style{StaticResource MainButtonStyle}Clicksetting_Click Height40 Width40 RenderTransformOrigin0.5,0.5DockPanel.DockRightImage Sourcepack://application:,,,/AIzhushou;component/Img/icons8-home-page-50.png Width30 Height30//Button/DockPanel!-- Chat History Label --Label Style{StaticResource SectionLabelStyle} Content聊天记录 Margin22,0,0,0 Grid.ColumnSpan2 VerticalAlignmentCenter/!-- Chat History RichTextBox --Border Grid.Row1 Style{StaticResource ChatBorderStyle} HorizontalAlignmentLeftGrid.ColumnSpan2 Margin15,0,0,10Border.ResourcesStyle TargetTypeScrollViewer BasedOn{StaticResource CustomScrollViewerStyle} //Border.ResourcesRichTextBox x:NameChatHistoryRichTextBox Style{StaticResource ChatHistoryRichTextBoxStyle}LoadedChatHistoryRichTextBox_Loaded Width380 Margin-10,0,0,0RichTextBox.Resources!-- 设置 Paragraph 的 Margin --Style TargetTypeParagraphSetter PropertyMargin Value0//Style/RichTextBox.Resources/RichTextBox/Border!-- New Conversation Button --StackPanel Grid.Row2 OrientationHorizontal HorizontalAlignmentLeft Margin0,10,0,10 Grid.Column1!--Button x:NameFreshButton Style{StaticResource FreshButtonStyle} ClickfreshButton_Click Height36 Width120Button.ContentStackPanel OrientationHorizontalImage Sourcepack://application:,,,/AIzhushou;component/Img/icons8-refresh-96.png Width20 Height20 Margin0,0,5,0/TextBlock Text刷新刚才回答 VerticalAlignmentCenter Foreground#4d6bfe//StackPanel/Button.Content/Button--Button x:NameNewConversationButton Style{StaticResource NewConversationButtonStyle}ClickNewConversationButton_Click Margin90,0,5,0 Height36 Width120Button.ContentStackPanel OrientationHorizontalImage Sourcepack://application:,,,/AIzhushou;component/Img/icons8-talk-64.png Width20 Height20 Margin0,0,5,0/TextBlock Text开启新对话 VerticalAlignmentCenter Foreground#4d6bfe//StackPanel/Button.Content/Button/StackPanel!-- Input Label --Label Grid.Row3 Style{StaticResource SectionLabelStyle} Content输入消息 Margin22,0,0,0 Grid.ColumnSpan2 VerticalAlignmentCenter/!-- Input Section --Grid Grid.Row4 HorizontalAlignmentLeft VerticalAlignmentBottomMargin22,0,0,-10 Width378 Grid.ColumnSpan2Grid.ColumnDefinitionsColumnDefinition Width*/ColumnDefinition WidthAuto//Grid.ColumnDefinitions!-- Input TextBox --TextBox x:NameInputTextBox Grid.Column0Style{StaticResource InputTextBoxStyle}TextWrappingWrap AcceptsReturnTrueKeyDownInputTextBox_KeyDownPreviewKeyDownInputTextBox_KeyDown/!-- Send Button --Border Grid.Column1 Style{StaticResource SendButtonBorderStyle} Margin10,0,0,0Button x:NameSendButton Style{StaticResource SendButtonStyle}Content发送 ClickSendButton_Click IsEnabledTrue//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助手项目下载
http://www.hkea.cn/news/14282584/

相关文章:

  • 宿迁宿豫网站建设网站建设说明书怎么写
  • 网站流量增长山门做网站
  • 手机建设网站制作电商网店培训
  • 固定ip如何做网站服务器做视频资源网站有哪些
  • 如何给网站添加音乐网页微信截图快捷键
  • 做招商的网络营销推广企业网站怎么搜索优化
  • 怎么做点击文字进入的网站下载资料免费网站
  • 网站建设答辩内容可视化app开发工具
  • 站牛网注册私人网站
  • 收费图片网站手机怎么制作网站
  • 网站被抓取企业推广哪个平台好
  • 一些做的好的网站在招聘网站做销售技巧
  • 专业网站建设费用包括哪些湘潭网站建设 磐石网络最好
  • 网站空间和主机京东商城网站的搜索引擎营销做的案例分析
  • 深圳网站设计兴田德润i优惠吗镇江市网站
  • 萝卜建站营销型网站规划
  • 专业网站制作推荐电子商务营销网站建设
  • 一个完整的网站制作需要哪些部分组成优化关键词的正确方法
  • 一般网站建设都用什么字体招聘网站建设方案
  • 科技软件公司网站模板下载如何做产品网站建设
  • 做同性恋网站犯法吗重庆网站推广产品企业
  • 网站建设的主要结构遵义做网站
  • 综合信息网站建设方案wordpress+博客+简书
  • 业余做衣服的网站网站推广属于什么行业
  • 上海空灵网站设计wordpress 主题 微信
  • 广告公司网站设计方案合肥公司网站搭建服务商
  • 资源网站优化排名做美工用的网站
  • 南桥网站建设wordpress模板带小程序源码
  • 园林网站模板下载事业单位门户网站开发
  • 成都网站建设制作价格网站开发技术标准