vue3实现ai大模型聊天对话窗口代码

代码语言:html

所属分类:其他

代码描述:vue3实现ai大模型聊天对话窗口代码

代码标签: vue ai 大模型 聊天 对话 窗口 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI 智能助手</title>
    <!-- Vue 3 -->
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue3.2.22.js"></script>
    <!-- Bootstrap Icons -->
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap-icons.1.11.3.css">
    <!-- Marked.js for Markdown parsing -->
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/marked.umd.min.js"></script>
    <!-- Highlight.js for code highlighting -->
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/github.min.css">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/highlight.11.7.0.js"></script>
    <style>
        :root {
            --primary-color: #4e6ef2;
            --primary-light: #e0e7ff;
            --primary-dark: #3b5bdb;
            --secondary-color: #f8f9fa;
            --text-color: #333;
            --light-text: #6c757d;
            --border-color: #dee2e6;
            --hover-color: #f1f5f9;
            --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
            --radius: 8px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;
            color: var(--text-color);
            background-color: #f8f9fa;
            line-height: 1.6;
        }

        .app-container {
            display: flex;
            height: 100vh;
            overflow: hidden;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 280px;
            background-color: white;
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            transition: all 0.3s ease;
            position: relative;
            z-index: 10;
        }

        .sidebar.collapsed {
            width: 60px;
        }

        .sidebar-header {
            padding: 16px;
            display: flex;
            align-items: center;
            border-bottom: 1px solid var(--border-color);
        }

        .logo {
            display: flex;
            align-items: center;
            font-weight: bold;
            font-size: 18px;
            color: var(--primary-color);
        }

        .logo-icon {
            font-size: 24px;
            margin-right: 10px;
        }

        .sidebar.collapsed .logo-text {
            display: none;
        }

        .new-chat-btn {
            margin: 16px;
            padding: 10px 16px;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: var(--radius);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.2s;
            font-size: 14px;
        }

        .sidebar.collapsed .new-chat-btn {
            padding: 10px;
        }

        .sidebar.collapsed .new-chat-text {
            display: none;
        }

        .new-chat-btn:hover {
            background-color: var(--primary-dark);
        }

        .new-chat-icon {
            margin-right: 8px;
        }

        .sidebar.collapsed .new-chat-icon {
            margin-right: 0;
        }

        .chat-history {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
        }

        .history-item {
            padding: 10px 12px;
            border-radius: var(--radius);
            margin-bottom: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .history-item:hover {
            background-color: var(--hover-color);
        }

        .history-item.active {
            background-color: var(--primary-light);
            color: var(--primary-color);
        }

        .history-icon {
            margin-right: 10px;
            font-size: 16px;
        }

        .sidebar.collapsed .history-text {
            display: none;
        }

        .toggle-sidebar {
            position: absolute;
            bottom: 20px;
            right: -12px;
            width: 24px;
            height: 24px;
            background-color: white;
            border: 1px solid var(--border-color);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 20;
            box-shadow: var(--shadow);
        }

        .user-info {
            padding: 12px 16px;
            border-top: 1px solid var(--border-color);
            display: flex;
            align-items: center;
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background-color: var(--primary-light);
            color: var(--primary-color);
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0