File size: 10,345 Bytes
bb2b7cc
 
 
 
 
 
fb656b6
bb2b7cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb656b6
25b6a3d
fb656b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25b6a3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bb2b7cc
 
25b6a3d
 
 
 
 
 
 
bb2b7cc
 
25b6a3d
 
 
 
bb2b7cc
fb656b6
 
 
bb2b7cc
fb656b6
 
bb2b7cc
fb656b6
 
bb2b7cc
fb656b6
 
bb2b7cc
fb656b6
 
 
 
25b6a3d
 
 
 
 
bb2b7cc
 
 
 
 
 
 
 
 
 
25b6a3d
bb2b7cc
 
 
 
 
 
 
 
 
 
 
25b6a3d
fb656b6
 
25b6a3d
fb656b6
 
 
 
 
 
 
 
 
 
 
 
 
 
bb2b7cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7537bdd
bb2b7cc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!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>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        /* 继承 training.html 的大部分样式 */
        :root {
            --primary-color: #4a90e2; /* 蓝色主题 */
            --ai-bg: #f7f9fc;
            --user-msg-bg: #4a90e2;
            --ai-msg-bg: #e9ecef;
            --light-bg: #f0f2f5;
            --panel-bg: #ffffff;
            --text-color: #333333;
            --border-color: #e9ecef;
        }
        body, * { box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            margin: 0; background-color: var(--light-bg); height: 100vh;
            overflow: hidden; display: flex; flex-direction: column;
        }
        .top-bar {
            background-color: var(--primary-color); color: white; padding: 12px 20px;
            display: flex; justify-content: space-between; align-items: center;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 100; flex-shrink: 0;
        }
        .top-bar h1 { margin: 0; font-size: 1.4em; font-weight: 600; }
        .mode-switcher a, .mode-switcher button {
            background-color: transparent; border: 1px solid white; color: white;
            padding: 8px 16px; margin-left: 10px; border-radius: 5px; cursor: pointer;
            transition: all 0.3s; font-size: 14px; text-decoration: none;
            font-family: inherit;
        }
        .mode-switcher .active, .mode-switcher a:hover, .mode-switcher button:hover {
            background-color: white; color: var(--primary-color);
        }
        .main-content { display: flex; flex: 1; overflow: hidden; min-height: 0; }
        #sidebar {
            width: 220px; background-color: var(--panel-bg); padding: 16px;
            box-shadow: 2px 0 5px rgba(0,0,0,0.1); overflow-y: auto; flex-shrink: 0;
        }
        #sidebar h2 { margin: 0 0 16px 0; font-size: 1.1em; color: var(--text-color); }
        #herb-list { list-style: none; padding: 0; margin: 0; }
        #herb-list li {
            padding: 10px 12px; cursor: pointer; border-radius: 6px;
            margin-bottom: 6px; transition: all 0.2s; font-size: 14px;
        }
        #herb-list li:hover { background-color: #eaf2fb; }
        #herb-list li.active { background-color: var(--primary-color); color: white; font-weight: 500; }
        #viewer-container { flex: 1; position: relative; min-width: 0; }
        #c { display: block; width: 100%; height: 100%; }
        
        /* 加载覆盖层 */
        #loading-overlay { 
            position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
            background-color: rgba(0, 0, 0, 0.7); 
            display: flex; justify-content: center; align-items: center; 
            z-index: 20; transition: opacity 0.5s; 
            pointer-events: none; opacity: 0; 
        }
        #loading-overlay.visible { opacity: 1; pointer-events: auto; }
        .loading-box { 
            text-align: center; color: white; background-color: rgba(40, 40, 40, 0.9); 
            padding: 30px 40px; border-radius: 10px; 
        }
        .loading-title { font-size: 1.2em; margin-bottom: 15px; }
        .progress-bar-container { 
            width: 250px; height: 8px; background-color: #555; 
            border-radius: 4px; overflow: hidden; margin: 0 auto; 
        }
        #progress-bar { 
            width: 0%; height: 100%; background-color: var(--primary-color); 
            border-radius: 4px; transition: width 0.2s ease-in-out; 
        }
        #progress-text { margin-top: 15px; font-size: 1em; font-family: monospace; }

        /* 缩放控制按钮 */
        .zoom-controls { 
            position: absolute; bottom: 20px; right: 20px; z-index: 10; 
            display: flex; flex-direction: column; 
        }
        .zoom-controls button { 
            width: 40px; height: 40px; font-size: 18px; font-weight: bold; 
            border: none; border-radius: 50%; background-color: rgba(0, 0, 0, 0.6); 
            color: white; cursor: pointer; margin-top: 8px; transition: all 0.3s;
            display: flex; align-items: center; justify-content: center;
        }
        .zoom-controls button:hover { background-color: rgba(0, 0, 0, 0.8); transform: scale(1.1); }

        /* 特征点弹窗 */
        #feature-popup { 
            position: absolute; top: 20px; left: 20px; background: rgba(0,0,0,0.85); 
            color: white; padding: 20px; border-radius: 8px; max-width: 300px; 
            z-index: 100; border: 1px solid rgba(255,255,255,0.2); 
            font-size: 14px; line-height: 1.5; transition: all 0.3s; 
            transform: scale(0.95); opacity: 1;
        }
        #feature-popup.hidden { opacity: 0; pointer-events: none; transform: scale(0.9); }
        #feature-popup-content strong { color: #ffcc00; display: block; margin-bottom: 8px; }
        #feature-popup-close { 
            display: block; width: 100%; margin-top: 15px; padding: 8px 12px; 
            cursor: pointer; border: none; background: #555; 
            color: white; border-radius: 5px; transition: background-color 0.3s;
        }
        #feature-popup-close:hover { background: #666; }

        /* --- AI 导师面板专属样式 --- */
        #ai-teacher-panel {
            width: 380px;
            background-color: var(--ai-bg);
            box-shadow: -2px 0 5px rgba(0,0,0,0.1);
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .chat-header {
            padding: 15px 20px;
            background-color: var(--panel-bg);
            border-bottom: 1px solid var(--border-color);
            flex-shrink: 0;
        }
        .chat-header h3 { margin: 0; font-size: 1.1em; color: var(--text-color); text-align: center; }
        .chat-log { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
        .chat-message { display: flex; align-items: flex-end; gap: 10px; max-width: 90%; }
        .avatar {
            width: 36px; height: 36px; border-radius: 50%; background-color: #ccc;
            flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px;
        }
        .message-bubble { padding: 12px 16px; border-radius: 18px; line-height: 1.5; font-size: 14px; word-wrap: break-word; }
        .ai-message { align-self: flex-start; }
        .ai-message .avatar { background-color: var(--primary-color); color: white; }
        .ai-message .message-bubble { background-color: var(--panel-bg); color: var(--text-color); border-top-left-radius: 4px; }
        .user-message { align-self: flex-end; flex-direction: row-reverse; }
        .user-message .avatar { background-color: #78c578; color: white; }
        .user-message .message-bubble { background-color: var(--user-msg-bg); color: white; border-top-right-radius: 4px; }
        .chat-input-area { padding: 15px; background-color: var(--panel-bg); border-top: 1px solid var(--border-color); flex-shrink: 0; }
        .input-wrapper { display: flex; align-items: center; border: 1px solid var(--border-color); border-radius: 25px; padding: 5px 5px 5px 15px; }
        #user-input { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; }
        #send-btn {
            width: 36px; height: 36px; border-radius: 50%; border: none;
            background-color: var(--primary-color); color: white; font-size: 18px; cursor: pointer;
            transition: background-color 0.3s;
        }
        #send-btn:hover { background-color: #3a7ac2; }
    </style>
</head>
<body>
    <div class="top-bar">
        <h1>中药饮片AI三维鉴别实训系统</h1>
        <div class="mode-switcher">
            <a href="index.html">返回首页</a>
            <a href="training.html">三维沉浸式学习</a>
            <button class="active">AI导师教学</button>
            <a href="#">AI主考测验</a>
        </div>
    </div>
    
    <div class="main-content">
        <div id="sidebar">
            <h2>饮片目录</h2>
            <ul id="herb-list"></ul>
        </div>
        
        <div id="viewer-container">
            <canvas id="c"></canvas>
            <!-- 以下是与 training.html 相同的元素,确保它们存在 -->
            <div id="loading-overlay">
                <div class="loading-box">
                    <div class="loading-title">正在加载模型...</div>
                    <div class="progress-bar-container">
                        <div id="progress-bar"></div>
                    </div>
                    <div id="progress-text">0%</div>
                </div>
            </div>
            <div class="zoom-controls">
                <button id="zoom-in-btn">+</button>
                <button id="zoom-out-btn">-</button>
            </div>
            <div id="feature-popup" class="hidden">
                <div id="feature-popup-content"></div>
                <button id="feature-popup-close">关闭</button>
            </div>
        </div>
        
        <div id="ai-teacher-panel">
            <div class="chat-header">
                <h3>AI 智能导师</h3>
            </div>
            <div class="chat-log" id="chat-log">
                <!-- 聊天消息将动态插入这里 -->
            </div>
            <div class="chat-input-area">
                <div class="input-wrapper">
                    <input type="text" id="user-input" placeholder="输入您的问题...">
                    <button id="send-btn" title="发送">
                        <i class="fas fa-paper-plane"></i>
                    </button>
                </div>
            </div>
        </div>
    </div>

    <script type="importmap">
    {
        "imports": {
            "three": "https://unpkg.com/three@0.160.0/build/three.module.js",
            "three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"
        }
    }
    </script>
    <script type="module" src="ai3dchat.js"></script>
</body>
</html>