Electron41+React19+DeepSeek-V4-Flash+Arco桌面客户端AI智能系统

跨平台框架electron41+react19接入deepseek-v4电脑端流式ai聊天问答系统。

electron-react-ai:基于react19+electron41.1+arco-design+openai快速对接deepseek-v4 api手搓客户端ai对话搭子。支持亮色/暗黑主题、深度思考链、代码高亮/复制、latex公式、mermaid渲染、echarts图表展示等功能。

360截图20260803071937216

p1-1

技术栈

  • 编辑器:VScode
  • 跨平台框架:Electron^41.1.0
  • 前端框架:react^19.2.7+react-router^7.18.1
  • 大模型框架:deepseek-v4-flash+openai
  • 组件库:@arco-design/web-react^2.66.16
  • 状态管理:zustand^5.0.14
  • markdown解析:react-markdown^10.1.0
  • 代码高亮:rehype-highlight^7.0.2
  • echarts图表:echarts^6.1.0
  • 打包工具:electron-builder^26.15.3
  • react桥接electron插件:vite-plugin-electron^1.1.0

p3

p1

项目功能性

  1. 支持light+dark主题界面,收缩侧边栏
  2. 支持丰富markdown,代码高亮/复制代码/下载
  3. 支持深度思考链模式
  4. 支持Katex数学公式
  5. 支持Mermaid图表渲染(拖拽/缩放/下载)
  6. 支持Echarts图表展示
  7. 支持上下文多轮对话,本地存储会话
  8. 支持链接跳转浏览器,图片预览

360截图20260803072225963

p2-2

项目结构目录

基于最新跨平台框架electron41+react19搭建项目,调用deepseek-v4-flash快速大模型。

360截图20260803004823402

004360截图20260802211547083

360截图20260803073704002

002360截图20260802210330593

003360截图20260802210846879

006360截图20260802222644999

项目运行配置

根据自己申请的deepseek apikey,替换项目根目录下.env文件里的key,即可体验流式对话。

360截图20260803004949187

// 安装依赖
yarn install
// 运行项目
yarn dev
// 打包项目
yarn electron:build

接入正式版DeepSeek-V4-Flash大模型

const completion = await openai.chat.completions.create({
  // 单一会话
  /* messages: [
    {role: 'user', content: editorValue}
  ], */
  // 多轮会话
  messages: multiConversation ? historySession() : [{role: 'user', content: editorValue}],
  // 对话模型(快速模式deepseek-v4-flash 专家模式deepseek-v4-pro)
  model: 'deepseek-v4-flash',
  // 是否深度思考
  thinking: {'type': thinkingEnabled ? 'enabled' : 'disabled'},
  stream: true, // 流式输出
  max_tokens: 8192, // 限制一次请求中模型生成 completion 的最大 token 数(默认使用 4096)
  temperature: 0.4, // 严谨采样 越低越严谨(默认1)
})

360截图20260803072926115

001360截图20260802205720020

008360截图20260802223328407

009360截图20260802223644040

image

项目入口配置

import '@arco-design/web-react/es/_util/react-19-adapter'
import { createRoot } from 'react-dom/client'
import './style.scss'
import App from './App.jsx'
import '@arco-design/web-react/dist/css/arco.css'

import { launchApp } from '@/windows/actions'

launchApp().then(config => {
  if(config) {
    // 存储窗口配置
    window.config = config
  }

  createRoot(document.getElementById('root')).render(
    <App />
  )
})

011360截图20260802225224467

011360截图20260802235828790

012360截图20260802225554280

013360截图20260802225742184

react-router路由配置

/**
 * react-router7路由配置
 */

import { lazy, Suspense, useEffect } from 'react'
import { useRoutes, useLocation, Outlet } from 'react-router-dom'
import { Spin } from '@arco-design/web-react'

import { appStore } from '@/store/app'
import { loginWindow } from '@/windows/actions'

// 引入路由页面
import Login from '@views/auth/login'
import Register from '@views/auth/register'
const Index = lazy(() => import('@views/index'))
const Aihub = lazy(() => import('@views/aihub'))
const Setting = lazy(() => import('@views/setting'))
const Error404 = lazy(() => import('@views/error/404'))
// 新窗口
const WinAbout = lazy(() => import('@views/win/about'))
const WinSetting = lazy(() => import('@views/win/setting'))

import Toolbar from '@/layouts/toolbar'
import Sidebar from '@/layouts/sidebar'

// 加载提示
const SpinLoading = () => {
  return <Spin tip='loading...' style={{width: '100%'}} />
}

// 预加载
const Lazyload = (children) => {
  return <Suspense fallback={<SpinLoading />}>{children}</Suspense>
}

// 路由鉴权验证
const RouterAuth = ({children}) => {
  const location = useLocation()
  const { isLogged } = appStore()

  useEffect(() => {
    if(!isLogged) loginWindow()
  }, [location])

  return children
}

// 路由占位模板
const RouterLayout = () => (
  <div className='rai__container'>
    <div className='rai__layout flexbox flex-col'>
      <Toolbar />
      <div className='rai__layout-body flex1 flexbox'>
        {/* 侧边栏 */}
        <Sidebar />

        <div className='rai__layout-main flex1'>
          { Lazyload(<Outlet />) }
        </div>
      </div>
    </div>
  </div>
)

const routes = [
  {
    path: '/',
    element: <RouterAuth><RouterLayout /></RouterAuth>,
    children: [
      // 首页
      { index: true, element: <Index /> },
      // ai导航
      { path: '/aihub', element: <Aihub /> },
      // 我的模块
      { path: '/setting', element: <Setting /> },
    ]
  },
  // 新窗口页面
  {
    path: '/win',
    children: [
      // 关于
      { path: 'about', element: <WinAbout />},
      // 设置
      { path: 'setting', element: <WinSetting />},
    ]
  },
  // 404模块
  { path: '*', element: <Error404 /> },
  // 登录/注册
  { path: '/login', element: <Login /> },
  { path: '/register', element: <Register /> },
]

014360截图20260802230726356

014360截图20260802231007457

014360截图20260802230619895

015360截图20260802234019281

016360截图20260802234043821

image

image

017360截图20260802234705629

基于Electron41+React19集成DeepSeek-V4桌面端AI系统就分享到这里,希望对大家有点帮助!

附上一些最新项目进阶实例

react19-webai网页版AI模板|DeepSeek-V4+React19+Arco智能ai系统

React19+DeepSeek-V4智能聊天AI助手|react19.2+zustand流式输出ai模板

React19-Admin后台管理系统|vite8+react19+arco+zustand通用后台模板

Vite8-Vue3-Admin网页版后台模板|vue3.5+pinia3+echarts后台管理系统

uniapp+deepseek-v4-flash+vue3跨端流式ai应用模板【h5+小程序+app端】

Vite8+DeepSeek-V4网页版AI助手|vue3+arco本地web版ai流式问答系统

最新版Flutter3.41+Dart3.11仿写抖音APP直播+短视频+聊天应用程序

flutter3.41+deepseek-v4+dio+getx纯手搓桌面客户端ai流式智能对话系统

Electron41+Vite8+DeepSeek-V4桌面端AI助手|electron+vue3流式ai系统

Electron38-Vue3OS客户端OS系统|vite7+electron38+arco桌面os后台管理

vite8-webos网页版os管理|Vue3+Vite8.0+ArcoDesign搭建pc端os桌面系统

Electron38-Wechat电脑端聊天|vite7+electron38仿微信桌面端聊天系统

92ee7269d0bccc526b0972778f6ead60_1289798-20250524100442179-518334694

 

posted @ 2026-08-03 11:26  xiaoyan2017  阅读(0)  评论(0)    收藏  举报
友情链接: UP主小店B站