2026最新原创vue3.5+vite7+deepseek-chat网页pc版流式打字ai系统
2026最新研发vite7.x+vue3+arco+markdown对接deepseek api从0-1纯手搓网页版ai对话系统。


使用技术
- 开发工具:Vscode
- 前端框架:vite^7.2.4+vue^3.5.24+vue-router^4.6.4
- 大模型框架:DeepSeek-R1 + OpenAI
- 组件库:arco-design^2.57.0 (字节桌面端组件库)
- 状态管理:pinia^3.0.4
- 本地存储:pinia-plugin-persistedstate^4.7.1
- 高亮插件:highlight.js^11.11.1
- markdown插件:markdown-it
- katex公式:@mdit/plugin-katex^0.24.1

项目结构框架
使用最新vite7.2创建项目模板,接入deepseek-v3.2大模型。

目前该项目已经正式发布到我的原创作品集,有需要的可以去下载使用。
https://b23.tv/1uQ7JBH

项目运行配置
申请一个deepseek apikey,替换如下图.env文件里的key即可使用流式打字效果。

# title VITE_APP_TITLE = 'Vue3-Web-DeepSeek' # port VITE_PORT = 3001 # 运行时自动打开浏览器 VITE_OPEN = true # 开启https VITE_HTTPS = false # 是否删除生产环境 console VITE_DROP_CONSOLE = true # DeepSeek API配置 VITE_DEEPSEEK_API_KEY = 替换为你的 API Key VITE_DEEPSEEK_BASE_URL = https://api.deepseek.com
- yarn install安装依赖
- yarn dev运行项目









项目通用布局

项目布局如下图所示

<script setup>
import Sidebar from '@/layouts/components/sidebar/index.vue'
</script>
<template>
<div class="vu__container">
<div class="vu__layout flexbox flex-col">
<div class="vu__layout-body flex1 flexbox">
<!-- 侧边区域 -->
<Sidebar />
<!-- 主面板区域 -->
<div class="vu__layout-main flex1">
<router-view v-slot="{ Component, route }">
<keep-alive>
<component :is="Component" :key="route.path" />
</keep-alive>
</router-view>
</div>
</div>
</div>
</div>
</template>
vue3+deepseek实现深度思考


// 调用deepseek接口
const completion = await openai.chat.completions.create({
// 单一会话
/* messages: [
{role: 'user', content: editorValue}
], */
// 多轮会话
messages: props.multiConversation ? historySession.value : [{role: 'user', content: editorValue}],
// deepseek-chat对话模型 deepseek-reasoner推理模型
model: sessionstate.thinkingEnabled ? 'deepseek-reasoner' : 'deepseek-chat',
stream: true, // 流式输出
max_tokens: 8192, // 一次请求中模型生成 completion 的最大 token 数(默认使用 4096)
temperature: 0.4, // 严谨采样
})







vue3+deepseek集成katex和mermaid功能
import { katex } from "@mdit/plugin-katex"; // 支持数学公式
import 'katex/dist/katex.min.css'
// 渲染mermaid图表
import { markdownItMermaidPlugin } from '@/components/markdown/plugins/mermaidPlugin'


<Markdown
:source="item.content"
:html="true"
:linkify="true"
:typographer="true"
:plugins="[
[katex, {delimiters: 'all'}],
[markdownItMermaidPlugin, { ... }]
]"
@copy="onCopy"
/>

vue3+deepseek流式ai
// 调用deepseek接口
const completion = await openai.chat.completions.create({
// 单一会话
// messages: [{role: 'user', content: editorValue}],
// 多轮会话
messages: props.multiConversation ? historySession.value : [{role: 'user', content: editorValue}],
// deepseek-chat对话模型 deepseek-reasoner推理模型
model: sessionstate.thinkingEnabled ? 'deepseek-reasoner' : 'deepseek-chat',
stream: true, // 流式输出
max_tokens: 8192,
temperature: 0.4
})
处理流式结果
for await (const chunk of completion) {
// 检查是否已终止
if(sessionstate.aborted) break
const content = chunk.choices[0]?.delta?.content || ''
// 获取推理内容
const reasoningContent = chunk.choices[0]?.delta?.reasoning_content || ''
if(content || reasoningContent) {
answerText += content
reasoningText += reasoningContent
// 限制更新频率:每100ms最多更新一次
const now = Date.now()
if(now - lastUpdate > 100) {
lastUpdate = now
requestAnimationFrame(() => {
// ...
})
}
}
if(chunk.choices[0]?.finish_reason === 'stop') {
// ...
}
}

好了,以上就是vue3+deepseek搭建网页版ai对话的一些项目分享,希望能给大家带来一些些帮助!
往期热文
2025最新款Tauri2.9+Vite7+Vue3+ElementPlus电脑端后台管理系统Exe
最新版Vite7.1+Tauri2.8+Vue3电脑端仿QQ/微信聊天程序
Electron38.2实战客户端OS系统|vite7+vue3+electron仿mac/wins桌面
2025最新款Electron38+Vite7+Vue3+ElementPlus桌面客户端后台管理系统Exe
最新研发vite7.0+electron38客户端仿微信EXE聊天软件
原创uniapp+vite5+vue3+uv-ui跨三端短视频+直播+聊天app应用
uni-app+deepseek-v3跨三端ai流式输出对话模板
Flutter3.32实战桌面端OS系统|flutter3仿macOS桌面
flutter3.27跨平台仿微信客户端聊天Exe程序|朋友圈|短视频
- 点赞
- 收藏
- 关注作者
评论(0)