|
|
@@ -63,7 +63,11 @@
|
|
|
}
|
|
|
|
|
|
.conversation {
|
|
|
- padding: 14px 15px 0;
|
|
|
+ padding: 14px 15px 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .conversation .row:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
}
|
|
|
|
|
|
.row {
|
|
|
@@ -82,9 +86,9 @@
|
|
|
.user-bubble {
|
|
|
position: relative;
|
|
|
max-width: 78%;
|
|
|
- padding: 10px 12px;
|
|
|
+ padding: 10px 14px;
|
|
|
background: var(--orange);
|
|
|
- border-radius: 6px 6px 2px 6px;
|
|
|
+ border-radius: 8px 8px 2px 8px;
|
|
|
color: #fff;
|
|
|
font-size: 15px;
|
|
|
font-weight: 500;
|
|
|
@@ -96,12 +100,12 @@
|
|
|
.user-bubble::after {
|
|
|
content: "";
|
|
|
position: absolute;
|
|
|
- right: -5px;
|
|
|
- bottom: 6px;
|
|
|
+ right: -6px;
|
|
|
+ bottom: 8px;
|
|
|
width: 0;
|
|
|
height: 0;
|
|
|
border-style: solid;
|
|
|
- border-width: 5px 0 5px 6px;
|
|
|
+ border-width: 6px 0 6px 7px;
|
|
|
border-color: transparent transparent transparent var(--orange);
|
|
|
}
|
|
|
|
|
|
@@ -109,7 +113,7 @@
|
|
|
width: 100%;
|
|
|
padding: 14px 13px;
|
|
|
background: #fff;
|
|
|
- border-radius: 8px;
|
|
|
+ border-radius: 12px;
|
|
|
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
|
|
|
}
|
|
|
|
|
|
@@ -182,6 +186,8 @@
|
|
|
box-shadow: 0 4px 16px rgba(255, 107, 62, 0.32);
|
|
|
touch-action: manipulation;
|
|
|
-webkit-tap-highlight-color: transparent;
|
|
|
+ position: relative;
|
|
|
+ z-index: 1;
|
|
|
}
|
|
|
|
|
|
.continue-btn__label {
|
|
|
@@ -203,15 +209,12 @@
|
|
|
min-height: 48px;
|
|
|
border-radius: 999px;
|
|
|
overflow: hidden;
|
|
|
+ z-index: 2;
|
|
|
}
|
|
|
|
|
|
body.is-wechat.wx-jssdk-ready #launch-btn {
|
|
|
display: block;
|
|
|
- }
|
|
|
-
|
|
|
- body.is-wechat.wx-jssdk-ready #btnContinue {
|
|
|
- visibility: hidden;
|
|
|
- pointer-events: none;
|
|
|
+ pointer-events: auto;
|
|
|
}
|
|
|
|
|
|
#openAppToast {
|
|
|
@@ -422,6 +425,53 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function resolveShareMessagesForDisplay(data) {
|
|
|
+ var messages = Array.isArray(data && data.messages) ? data.messages : [];
|
|
|
+ if (messages.length) return messages;
|
|
|
+ var text = String((data && data.content) || "").trim();
|
|
|
+ if (!text) return [];
|
|
|
+ var list = [];
|
|
|
+ var blocks = text.split(/\n\n+/);
|
|
|
+ for (var i = 0; i < blocks.length; i++) {
|
|
|
+ var block = String(blocks[i] || "").trim();
|
|
|
+ if (!block) continue;
|
|
|
+ var userMatch = block.match(/^我[::]\s*([\s\S]*)$/);
|
|
|
+ if (userMatch) {
|
|
|
+ var userText = String(userMatch[1] || "").trim();
|
|
|
+ if (userText) list.push({ role: "user", content: userText });
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ var aiMatch = block.match(/^UBAO[::]\s*([\s\S]*)$/i);
|
|
|
+ if (aiMatch) {
|
|
|
+ var aiText = String(aiMatch[1] || "").trim();
|
|
|
+ if (aiText) list.push({ role: "ai", content: aiText });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (list.length) return list;
|
|
|
+ var current = null;
|
|
|
+ var lines = text.split(/\n/);
|
|
|
+ for (var j = 0; j < lines.length; j++) {
|
|
|
+ var line = String(lines[j] || "");
|
|
|
+ var userLine = line.match(/^我[::]\s*(.*)$/);
|
|
|
+ var aiLine = line.match(/^UBAO[::]\s*(.*)$/i);
|
|
|
+ if (userLine) {
|
|
|
+ if (current) list.push(current);
|
|
|
+ current = { role: "user", content: String(userLine[1] || "").trim() };
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (aiLine) {
|
|
|
+ if (current) list.push(current);
|
|
|
+ current = { role: "ai", content: String(aiLine[1] || "").trim() };
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (current && line.trim()) {
|
|
|
+ current.content = (current.content ? current.content + "\n" : "") + line.trim();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (current && String(current.content || "").trim()) list.push(current);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
function render(data) {
|
|
|
applyWeixinShareMeta();
|
|
|
sharePayloadCache = data || null;
|
|
|
@@ -432,9 +482,15 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var messages = data.messages || [];
|
|
|
+ var messages = resolveShareMessagesForDisplay(data);
|
|
|
var firstQuestion =
|
|
|
- String(data.firstQuestion || "").trim() || getFirstUserQuestion(messages);
|
|
|
+ String(data.firstQuestion || "").trim() ||
|
|
|
+ getFirstUserQuestion(messages) ||
|
|
|
+ (function () {
|
|
|
+ var text = String(data.content || "").trim();
|
|
|
+ var m = text.match(/^我[::]([\s\S]+?)(?:\n\n|$)/);
|
|
|
+ return m ? String(m[1] || "").trim() : "";
|
|
|
+ })();
|
|
|
var pageTitle = formatDiscussionTitle(firstQuestion);
|
|
|
var dateText = formatDate(data.shareTime);
|
|
|
|
|
|
@@ -454,11 +510,6 @@
|
|
|
var convHtml = renderMessages(messages);
|
|
|
if (convHtml) {
|
|
|
bodyHtml += '<section class="conversation">' + convHtml + "</section>";
|
|
|
- } else if (data.content) {
|
|
|
- bodyHtml +=
|
|
|
- '<section class="fallback-card"><div class="ai-card__text">' +
|
|
|
- escHtml(data.content) +
|
|
|
- "</div></section>";
|
|
|
} else {
|
|
|
bodyHtml += '<div class="empty">暂无对话内容</div>';
|
|
|
}
|