|
|
@@ -522,7 +522,38 @@
|
|
|
.welcome-sub {
|
|
|
color: var(--text-secondary);
|
|
|
font-size: 15px;
|
|
|
- margin-bottom: 36px;
|
|
|
+ margin-bottom: 24px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Quick Questions */
|
|
|
+ .quick-questions {
|
|
|
+ width: 100%;
|
|
|
+ max-width: 680px;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ gap: 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .quick-q-chip {
|
|
|
+ padding: 6px 14px;
|
|
|
+ border: 1px solid var(--border-color);
|
|
|
+ border-radius: 20px;
|
|
|
+ background: var(--bg-input-box);
|
|
|
+ color: var(--text-secondary);
|
|
|
+ font-size: 13px;
|
|
|
+ cursor: pointer;
|
|
|
+ transition: all 0.2s;
|
|
|
+ white-space: nowrap;
|
|
|
+ max-width: 320px;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
+
|
|
|
+ .quick-q-chip:hover {
|
|
|
+ border-color: var(--accent);
|
|
|
+ color: var(--accent);
|
|
|
+ background: var(--accent-light);
|
|
|
}
|
|
|
|
|
|
.welcome-input-box {
|
|
|
@@ -1364,6 +1395,7 @@
|
|
|
</div>
|
|
|
<div class="welcome-title" th:text="'你好,我是 ' + ${nickname} + '!'">你好,我是 清鉴 !</div>
|
|
|
<div class="welcome-sub">有什么我可以帮你的吗?</div>
|
|
|
+ <div class="quick-questions" id="welcomeQuickQs"></div>
|
|
|
<div class="welcome-input-box">
|
|
|
<div class="img-preview-wrap" id="welcomeImgWrap">
|
|
|
<div class="img-preview"><img id="welcomeImgPreview" src="" alt=""/><span class="img-preview-remove"
|
|
|
@@ -1385,6 +1417,7 @@
|
|
|
<!-- Per-session containers are added here dynamically -->
|
|
|
</div>
|
|
|
<div class="input-wrap">
|
|
|
+ <div class="quick-questions" id="chatQuickQs" style="max-width:820px;margin:0 auto 10px;"></div>
|
|
|
<div class="input-box">
|
|
|
<div class="img-preview-wrap" id="chatImgWrap">
|
|
|
<div class="img-preview"><img id="chatImgPreview" src="" alt=""/><span class="img-preview-remove"
|
|
|
@@ -1468,7 +1501,7 @@
|
|
|
var welcomeSendBtn = document.getElementById('welcomeSendBtn');
|
|
|
var chatInput = document.getElementById('chatInput');
|
|
|
var chatSendBtn = document.getElementById('chatSendBtn');
|
|
|
- var themeBtn = document.getElementById('themeBtn');
|
|
|
+ // var themeBtn = document.getElementById('themeBtn');
|
|
|
var themeIcon = document.getElementById('themeIcon');
|
|
|
var newChatBtn = document.getElementById('newChatBtn');
|
|
|
var historyList = document.getElementById('historyList');
|
|
|
@@ -1783,6 +1816,45 @@
|
|
|
welcomeImgRemove.addEventListener('click', clearImagePreview);
|
|
|
chatImgRemove.addEventListener('click', clearImagePreview);
|
|
|
|
|
|
+ /* ===== Quick Questions ===== */
|
|
|
+ var welcomeQuickQs = document.getElementById('welcomeQuickQs');
|
|
|
+ var chatQuickQs = document.getElementById('chatQuickQs');
|
|
|
+
|
|
|
+ function loadQuickQuestions() {
|
|
|
+ httpGetJson('/js/a/ai/qs', function (data) {
|
|
|
+ var questions = unwrapResponse(data);
|
|
|
+ if (!Array.isArray(questions) || questions.length === 0) return;
|
|
|
+ renderQuickQChips(welcomeQuickQs, questions);
|
|
|
+ renderQuickQChips(chatQuickQs, questions);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderQuickQChips(container, questions) {
|
|
|
+ container.innerHTML = '';
|
|
|
+ for (var i = 0; i < questions.length; i++) {
|
|
|
+ var chip = document.createElement('span');
|
|
|
+ chip.className = 'quick-q-chip';
|
|
|
+ chip.textContent = questions[i];
|
|
|
+ chip.title = questions[i];
|
|
|
+ chip.addEventListener('click', (function(q) {
|
|
|
+ return function() {
|
|
|
+ if (inChatMode) {
|
|
|
+ chatInput.value = q;
|
|
|
+ chatInput.focus();
|
|
|
+ autoResize(chatInput);
|
|
|
+ } else {
|
|
|
+ welcomeInput.value = q;
|
|
|
+ welcomeInput.focus();
|
|
|
+ autoResize(welcomeInput);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ })(questions[i]));
|
|
|
+ container.appendChild(chip);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ loadQuickQuestions();
|
|
|
+
|
|
|
/* ===== Marked ===== */
|
|
|
if (typeof marked !== 'undefined') { marked.setOptions({ breaks: true, gfm: true }); }
|
|
|
function renderMd(text) {
|
|
|
@@ -1793,7 +1865,7 @@
|
|
|
/* ===== Theme ===== */
|
|
|
var currentTheme = localStorage.getItem('chat-theme') || 'light';
|
|
|
document.body.setAttribute('data-theme', currentTheme);
|
|
|
- updateThemeIcon();
|
|
|
+/* updateThemeIcon();
|
|
|
themeBtn.addEventListener('click', function() {
|
|
|
currentTheme = currentTheme === 'light' ? 'dark' : 'light';
|
|
|
document.body.setAttribute('data-theme', currentTheme);
|
|
|
@@ -1803,7 +1875,7 @@
|
|
|
function updateThemeIcon() {
|
|
|
themeIcon.innerHTML = currentTheme === 'light' ? '' : '';
|
|
|
themeBtn.title = currentTheme === 'light' ? '切换至暗色' : '切换至浅色';
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/* ===== View Switch ===== */
|
|
|
function switchToChatMode() {
|
|
|
@@ -1843,6 +1915,7 @@
|
|
|
chatInput.addEventListener('keydown', function(e) { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); sendMessage(); } });
|
|
|
welcomeSendBtn.addEventListener('click', function() { sendMessage(); });
|
|
|
chatSendBtn.addEventListener('click', function() {
|
|
|
+ debugger
|
|
|
if (isStreaming && activeSessionId && sessionMap[activeSessionId]) {
|
|
|
finishStream(sessionMap[activeSessionId]);
|
|
|
} else {
|