Keldos commited on
Commit
1db9ce6
1 Parent(s): c983084

WIP: 增加重新生成和删除本轮问答按钮

Browse files
ChuanhuChatbot.py CHANGED
@@ -151,16 +151,16 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
151
  i18n("🧹 新的对话"), elem_id="empty-btn"
152
  )
153
  with gr.Column(min_width=120, scale=1):
154
- retryBtn = gr.Button(i18n("🔄 重新生成"))
155
  with gr.Column(min_width=120, scale=1):
156
  delFirstBtn = gr.Button(i18n("🗑️ 删除最旧对话"))
157
  with gr.Column(min_width=120, scale=1):
158
- delLastBtn = gr.Button(i18n("🗑️ 删除最新对话"))
159
  with gr.Row(visible=False) as like_dislike_area:
160
  with gr.Column(min_width=20, scale=1):
161
- likeBtn = gr.Button(i18n("👍"))
162
  with gr.Column(min_width=20, scale=1):
163
- dislikeBtn = gr.Button(i18n("👎"))
164
 
165
  with gr.Column(elem_id="toolbox-area", scale=1):
166
  with gr.Box(elem_id="chuanhu-toolbox"): # For CSS setting, there is an extra box. Don't remove it.
@@ -334,7 +334,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
334
  use_streaming_checkbox = gr.Checkbox(
335
  label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
336
  )
337
- single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox", elem_id="gr-single-session-cb")
338
  # checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
339
 
340
  with gr.Tab(i18n("网络")):
 
151
  i18n("🧹 新的对话"), elem_id="empty-btn"
152
  )
153
  with gr.Column(min_width=120, scale=1):
154
+ retryBtn = gr.Button(i18n("🔄 重新生成"), elem_id="gr-retry-btn")
155
  with gr.Column(min_width=120, scale=1):
156
  delFirstBtn = gr.Button(i18n("🗑️ 删除最旧对话"))
157
  with gr.Column(min_width=120, scale=1):
158
+ delLastBtn = gr.Button(i18n("🗑️ 删除最新对话"), elem_id="gr-dellast-btn")
159
  with gr.Row(visible=False) as like_dislike_area:
160
  with gr.Column(min_width=20, scale=1):
161
+ likeBtn = gr.Button(i18n("👍"), elem_id="gr-like-btn")
162
  with gr.Column(min_width=20, scale=1):
163
+ dislikeBtn = gr.Button(i18n("👎"), elem_id="gr-dislike-btn")
164
 
165
  with gr.Column(elem_id="toolbox-area", scale=1):
166
  with gr.Box(elem_id="chuanhu-toolbox"): # For CSS setting, there is an extra box. Don't remove it.
 
334
  use_streaming_checkbox = gr.Checkbox(
335
  label=i18n("实时传输回答"), value=True, visible=ENABLE_STREAMING_OPTION, elem_classes="switch-checkbox"
336
  )
337
+ single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False, elem_classes="switch-checkbox", elem_id="gr-single-session-cb", visible=False)
338
  # checkUpdateBtn = gr.Button(i18n("🔄 检查更新..."), visible=check_update)
339
 
340
  with gr.Tab(i18n("网络")):
web_assets/javascript/ChuanhuChat.js CHANGED
@@ -96,17 +96,16 @@ function initialize() {
96
  }
97
 
98
  adjustDarkMode();
 
99
  selectHistory();
100
- setTimeout(showOrHideUserInfo(), 2000);
101
- setChatbotHeight();
102
- setChatbotScroll();
103
  setPopupBoxPosition();
104
  setSlider();
105
- checkModel();
106
- // transUpload();
107
- // transCheckbox();
108
  setCheckboxes();
109
- // setScrollShadow();
 
 
 
110
 
111
  if (!historyLoaded) loadHistoryHtml();
112
  if (!usernameGotten) getUserInfo();
@@ -116,13 +115,13 @@ function initialize() {
116
  if (longTimeNoCheck && !updateInfoGotten && !isLatestVersion || isLatestVersion && !updateInfoGotten) {
117
  updateLatestVersion();
118
  }
 
 
119
 
120
  // setHistroyPanel();
121
- settingBox.classList.add('hideBox');
122
- trainingBox.classList.add('hideBox');
123
  // trainBody.classList.add('hide-body');
124
 
125
- adjustSide();
126
 
127
  return true;
128
  }
@@ -215,7 +214,7 @@ function checkModel() {
215
  } else {
216
  gradioApp().querySelector('#header-btn-groups').classList.remove('is-gpt');
217
  }
218
- console.log('gpt model checked')
219
  }
220
  model.addEventListener('blur', ()=>{
221
  setTimeout(checkGPT, 100);
@@ -332,8 +331,12 @@ function chatbotContentChanged(attempt = 1) {
332
  saveHistoryHtml();
333
  disableSendBtn();
334
  // gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.user').forEach((userElement) => {addAvatars(userElement, 'user')});
335
- gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.bot').forEach(addChuanhuButton);
336
- }, i === 0 ? 0 : 500);
 
 
 
 
337
  }
338
  // 理论上是不需要多次尝试执行的,可惜gradio的bug导致message可能没有渲染完毕,所以尝试500ms后再次执行
339
  }
@@ -341,6 +344,7 @@ function chatbotContentChanged(attempt = 1) {
341
  var chatbotObserver = new MutationObserver(() => {
342
  chatbotContentChanged(1);
343
  if (chatbotIndicator.classList.contains('hide')) {
 
344
  chatbotContentChanged(2);
345
  }
346
  });
@@ -415,9 +419,3 @@ Enjoy our project!\n
415
  `
416
  console.log(`%c${makeML(ChuanhuInfo)}`,styleTitle1)
417
  console.log(`%c${description}`, styleDesc1)
418
-
419
- // button svg code
420
- const copyIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span>';
421
- const copiedIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><polyline points="20 6 9 17 4 12"></polyline></svg></span>';
422
- const mdIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1" viewBox="0 0 14 18" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><path d="M1.5,0 L12.5,0 C13.3284271,-1.52179594e-16 14,0.671572875 14,1.5 L14,16.5 C14,17.3284271 13.3284271,18 12.5,18 L1.5,18 C0.671572875,18 1.01453063e-16,17.3284271 0,16.5 L0,1.5 C-1.01453063e-16,0.671572875 0.671572875,1.52179594e-16 1.5,0 Z" stroke-width="1.8"></path><line x1="3.5" y1="3.5" x2="10.5" y2="3.5"></line><line x1="3.5" y1="6.5" x2="8" y2="6.5"></line></g><path d="M4,9 L10,9 C10.5522847,9 11,9.44771525 11,10 L11,13.5 C11,14.0522847 10.5522847,14.5 10,14.5 L4,14.5 C3.44771525,14.5 3,14.0522847 3,13.5 L3,10 C3,9.44771525 3.44771525,9 4,9 Z" stroke="none" fill="currentColor"></path></svg></span>';
423
- const rawIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1.8" viewBox="0 0 18 14" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><polyline points="4 3 0 7 4 11"></polyline><polyline points="14 3 18 7 14 11"></polyline><line x1="12" y1="0" x2="6" y2="14"></line></g></svg></span>';
 
96
  }
97
 
98
  adjustDarkMode();
99
+ adjustSide();
100
  selectHistory();
101
+ // setChatbotHeight();
 
 
102
  setPopupBoxPosition();
103
  setSlider();
 
 
 
104
  setCheckboxes();
105
+ checkModel();
106
+
107
+ settingBox.classList.add('hideBox');
108
+ trainingBox.classList.add('hideBox');
109
 
110
  if (!historyLoaded) loadHistoryHtml();
111
  if (!usernameGotten) getUserInfo();
 
115
  if (longTimeNoCheck && !updateInfoGotten && !isLatestVersion || isLatestVersion && !updateInfoGotten) {
116
  updateLatestVersion();
117
  }
118
+ setChatbotScroll();
119
+ setTimeout(showOrHideUserInfo(), 2000);
120
 
121
  // setHistroyPanel();
 
 
122
  // trainBody.classList.add('hide-body');
123
 
124
+
125
 
126
  return true;
127
  }
 
214
  } else {
215
  gradioApp().querySelector('#header-btn-groups').classList.remove('is-gpt');
216
  }
217
+ // console.log('gpt model checked')
218
  }
219
  model.addEventListener('blur', ()=>{
220
  setTimeout(checkGPT, 100);
 
331
  saveHistoryHtml();
332
  disableSendBtn();
333
  // gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.user').forEach((userElement) => {addAvatars(userElement, 'user')});
334
+ // gradioApp().querySelectorAll('#chuanhu-chatbot > .wrapper > .wrap > .message-wrap .message-row.bot-row').forEach(addChuanhuButton);
335
+ gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message-row.bot-row').forEach(addChuanhuButton);
336
+ if (chatbotIndicator.classList.contains('hide')) {
337
+ setLatestMessage();
338
+ }
339
+ }, i === 0 ? 0 : 200);
340
  }
341
  // 理论上是不需要多次尝试执行的,可惜gradio的bug导致message可能没有渲染完毕,所以尝试500ms后再次执行
342
  }
 
344
  var chatbotObserver = new MutationObserver(() => {
345
  chatbotContentChanged(1);
346
  if (chatbotIndicator.classList.contains('hide')) {
347
+ // setLatestMessage();
348
  chatbotContentChanged(2);
349
  }
350
  });
 
419
  `
420
  console.log(`%c${makeML(ChuanhuInfo)}`,styleTitle1)
421
  console.log(`%c${description}`, styleDesc1)
 
 
 
 
 
 
web_assets/javascript/chat-history.js CHANGED
@@ -30,6 +30,14 @@ function loadHistoryHtml() {
30
  for (var i = 0; i < gradioCopyButtons.length; i++) {
31
  gradioCopyButtons[i].parentNode.removeChild(gradioCopyButtons[i]);
32
  }
 
 
 
 
 
 
 
 
33
 
34
  var fakeHistory = document.createElement('div');
35
  fakeHistory.classList.add('history-message');
 
30
  for (var i = 0; i < gradioCopyButtons.length; i++) {
31
  gradioCopyButtons[i].parentNode.removeChild(gradioCopyButtons[i]);
32
  }
33
+ var messageBtnRows = tempDiv.querySelectorAll('.message-btn-row');
34
+ for (var i = 0; i < messageBtnRows.length; i++) {
35
+ messageBtnRows[i].parentNode.removeChild(messageBtnRows[i]);
36
+ }
37
+ var latestMessages = tempDiv.querySelectorAll('.message.latest');
38
+ for (var i = 0; i < latestMessages.length; i++) {
39
+ latestMessages[i].classList.remove('latest');
40
+ }
41
 
42
  var fakeHistory = document.createElement('div');
43
  fakeHistory.classList.add('history-message');
web_assets/javascript/localization.js CHANGED
@@ -68,6 +68,23 @@ const updateFailure_i18n = {
68
  'ru': 'Обновление не удалось, попробуйте <a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">обновление вручную</a>.'
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  function i18n(msg) {
73
  return msg.hasOwnProperty(language) ? msg[language] : msg['en'];
 
68
  'ru': 'Обновление не удалось, попробуйте <a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#手动更新" target="_blank">обновление вручную</a>.'
69
  }
70
 
71
+ const regenerate_i18n = {
72
+ 'zh': "重新生成",
73
+ 'en': "Regenerate",
74
+ 'ja': "再生成",
75
+ 'ko': "재생성",
76
+ 'sv': "Återgenerera",
77
+ 'ru': "Пересоздать"
78
+ }
79
+
80
+ const delete_i18n = {
81
+ 'zh': "删除这轮问答",
82
+ 'en': "Delete this round of Q&A",
83
+ 'ja': "この質疑応答を削除",
84
+ 'ko': "이 라운드의 질문과 답변 삭제",
85
+ 'sv': "Ta bort denna omgång av Q&A",
86
+ 'ru': "Удалить этот раунд вопросов и ответов"
87
+ }
88
 
89
  function i18n(msg) {
90
  return msg.hasOwnProperty(language) ? msg[language] : msg['en'];
web_assets/javascript/message-button.js CHANGED
@@ -1,18 +1,26 @@
1
 
2
- // 为 bot 消息添加复制与切换显示按钮
 
 
 
 
 
3
 
4
- function addChuanhuButton(botElement) {
5
  var rawMessage = botElement.querySelector('.raw-message');
6
  var mdMessage = botElement.querySelector('.md-message');
7
 
8
  if (!rawMessage) { // 如果没有 raw message,说明是早期历史记录,去除按钮
9
- var buttons = botElement.querySelectorAll('button.chuanhu-btn');
10
- for (var i = 0; i < buttons.length; i++) {
11
- buttons[i].parentNode.removeChild(buttons[i]);
12
- }
 
 
13
  return;
14
  }
15
- botElement.querySelectorAll('button.copy-bot-btn, button.toggle-md-btn').forEach(btn => btn.remove()); // 就算原先有了,也必须重新添加,而不是跳过
 
 
16
 
17
  // Copy bot button
18
  var copyButton = document.createElement('button');
@@ -50,7 +58,7 @@ function addChuanhuButton(botElement) {
50
  console.error("Copy failed: ", error);
51
  }
52
  });
53
- botElement.appendChild(copyButton);
54
 
55
  // Toggle button
56
  var toggleButton = document.createElement('button');
@@ -70,7 +78,13 @@ function addChuanhuButton(botElement) {
70
  }
71
  chatbotContentChanged(1); // to set md or raw in read-only history html
72
  });
73
- botElement.insertBefore(toggleButton, copyButton);
 
 
 
 
 
 
74
 
75
  function renderMarkdownText(message) {
76
  var mdDiv = message.querySelector('.md-message');
@@ -89,4 +103,60 @@ function addChuanhuButton(botElement) {
89
  }
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
 
 
 
 
1
 
2
+ // 为 bot 消息添加复制与切换显示按钮 以及最新消息加上重新生成,删除最新消息,嗯。
3
+
4
+ function addChuanhuButton(botRow) {
5
+
6
+ botElement = botRow.querySelector('.message.bot');
7
+ isLatestMessage = botElement.classList.contains('latest');
8
 
 
9
  var rawMessage = botElement.querySelector('.raw-message');
10
  var mdMessage = botElement.querySelector('.md-message');
11
 
12
  if (!rawMessage) { // 如果没有 raw message,说明是早期历史记录,去除按钮
13
+ // var buttons = botElement.querySelectorAll('button.chuanhu-btn');
14
+ // for (var i = 0; i < buttons.length; i++) {
15
+ // buttons[i].parentNode.removeChild(buttons[i]);
16
+ // }
17
+ botElement.querySelector('.message-btn-row')?.remove();
18
+ botElement.querySelector('.message-btn-column')?.remove();
19
  return;
20
  }
21
+ // botElement.querySelectorAll('button.copy-bot-btn, button.toggle-md-btn').forEach(btn => btn.remove()); // 就算原先有了,也必须重新添加,而不是跳过
22
+ if (!isLatestMessage) botElement.querySelector('.message-btn-row')?.remove();
23
+ botElement.querySelector('.message-btn-column')?.remove();
24
 
25
  // Copy bot button
26
  var copyButton = document.createElement('button');
 
58
  console.error("Copy failed: ", error);
59
  }
60
  });
61
+ // botElement.appendChild(copyButton);
62
 
63
  // Toggle button
64
  var toggleButton = document.createElement('button');
 
78
  }
79
  chatbotContentChanged(1); // to set md or raw in read-only history html
80
  });
81
+ // botElement.insertBefore(toggleButton, copyButton);
82
+
83
+ var messageBtnColumn = document.createElement('div');
84
+ messageBtnColumn.classList.add('message-btn-column');
85
+ messageBtnColumn.appendChild(toggleButton);
86
+ messageBtnColumn.appendChild(copyButton);
87
+ botElement.appendChild(messageBtnColumn);
88
 
89
  function renderMarkdownText(message) {
90
  var mdDiv = message.querySelector('.md-message');
 
103
  }
104
  }
105
 
106
+ function setLatestMessage() {
107
+ var latestMessage = gradioApp().querySelector('#chuanhu-chatbot > .wrapper > .wrap > .message-wrap .message.bot.latest');
108
+ if (latestMessage) addLatestMessageButtons(latestMessage);
109
+ }
110
+
111
+ function addLatestMessageButtons(botElement) {
112
+ botElement.querySelector('.message-btn-row')?.remove();
113
+
114
+ var messageBtnRow = document.createElement('div');
115
+ messageBtnRow.classList.add('message-btn-row');
116
+ var messageBtnRowLeading = document.createElement('div');
117
+ messageBtnRowLeading.classList.add('message-btn-row-leading');
118
+ var messageBtnRowTrailing = document.createElement('div');
119
+ messageBtnRowTrailing.classList.add('message-btn-row-trailing');
120
+
121
+ messageBtnRow.appendChild(messageBtnRowLeading);
122
+ messageBtnRow.appendChild(messageBtnRowTrailing);
123
+
124
+ botElement.appendChild(messageBtnRow);
125
+
126
+ var regenerateButton = document.createElement('button');
127
+ regenerateButton.classList.add('chuanhu-btn');
128
+ regenerateButton.classList.add('regenerate-btn');
129
+ regenerateButton.setAttribute('aria-label', 'Regenerate');
130
+ regenerateButton.innerHTML = regenIcon + `<span>${i18n(regenerate_i18n)}</span>`;
131
+
132
+ var gradioRetryBtn = gradioApp().querySelector('#gr-retry-btn');
133
+ regenerateButton.addEventListener('click', () => {
134
+ gradioRetryBtn.click();
135
+ });
136
+
137
+ var deleteButton = document.createElement('button');
138
+ deleteButton.classList.add('chuanhu-btn');
139
+ deleteButton.classList.add('delete-latest-btn');
140
+ deleteButton.setAttribute('aria-label', 'Delete');
141
+ deleteButton.innerHTML = deleteIcon + `<span>${i18n(delete_i18n)}</span>`;
142
+
143
+ var gradioDelLastBtn = gradioApp().querySelector('#gr-dellast-btn');
144
+ deleteButton.addEventListener('click', () => {
145
+ gradioDelLastBtn.click();
146
+ chatbotContentChanged(2);
147
+ });
148
+
149
+ messageBtnRowLeading.appendChild(regenerateButton);
150
+ messageBtnRowLeading.appendChild(deleteButton);
151
+ }
152
+
153
+
154
+ // button svg code
155
+ const copyIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span>';
156
+ const copiedIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><polyline points="20 6 9 17 4 12"></polyline></svg></span>';
157
+ const mdIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1" viewBox="0 0 14 18" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><path d="M1.5,0 L12.5,0 C13.3284271,-1.52179594e-16 14,0.671572875 14,1.5 L14,16.5 C14,17.3284271 13.3284271,18 12.5,18 L1.5,18 C0.671572875,18 1.01453063e-16,17.3284271 0,16.5 L0,1.5 C-1.01453063e-16,0.671572875 0.671572875,1.52179594e-16 1.5,0 Z" stroke-width="1.8"></path><line x1="3.5" y1="3.5" x2="10.5" y2="3.5"></line><line x1="3.5" y1="6.5" x2="8" y2="6.5"></line></g><path d="M4,9 L10,9 C10.5522847,9 11,9.44771525 11,10 L11,13.5 C11,14.0522847 10.5522847,14.5 10,14.5 L4,14.5 C3.44771525,14.5 3,14.0522847 3,13.5 L3,10 C3,9.44771525 3.44771525,9 4,9 Z" stroke="none" fill="currentColor"></path></svg></span>';
158
+ const rawIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1.8" viewBox="0 0 18 14" stroke-linecap="round" stroke-linejoin="round" height=".8em" width=".8em" xmlns="http://www.w3.org/2000/svg"><g transform-origin="center" transform="scale(0.85)"><polyline points="4 3 0 7 4 11"></polyline><polyline points="14 3 18 7 14 11"></polyline><line x1="12" y1="0" x2="6" y2="14"></line></g></svg></span>';
159
 
160
+ const regenIcon = '<span><svg viewBox="0 0 15.6737 14.3099" height="11px" width="10px" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M8.52344 14.3043C12.4453 14.3043 15.6737 11.0704 15.6737 7.15396C15.6737 3.23385 12.4453 0 8.52344 0C4.61357 0 1.39193 3.20969 1.37314 7.11614L2.77012 7.11614C2.78891 3.94173 5.34391 1.40431 8.52344 1.40431C11.7096 1.40431 14.2785 3.96418 14.2785 7.15396C14.2785 10.3401 11.7096 12.9163 8.52344 12.9073C6.6559 12.9036 5.0325 12.0192 3.98219 10.6317C3.70247 10.3165 3.29141 10.2174 2.96431 10.4686C2.65796 10.6988 2.60863 11.1321 2.91325 11.5028C4.17573 13.1677 6.28972 14.3043 8.52344 14.3043ZM0.520576 5.73631C-0.0035439 5.73631-0.140743 6.14811 0.149274 6.53993L1.86425 8.89772C2.08543 9.20509 2.4372 9.20143 2.65301 8.89772L4.36628 6.53626C4.64726 6.14981 4.51544 5.73631 3.99839 5.73631Z"/></g></svg></span>';
161
+ const deleteIcon = '<span><svg viewBox="0 0 17.0644 12.9388" height="11px" width="11px" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M4.85464 12.9388L12.2098 12.9388C13.6299 12.9388 14.26 12.2074 14.4792 10.7927L15.6069 3.38561L14.2702 3.42907L13.1479 10.686C13.049 11.3506 12.7252 11.6268 12.12 11.6268L4.94444 11.6268C4.32818 11.6268 4.01711 11.3506 3.91652 10.686L2.79421 3.42907L1.45752 3.38561L2.5852 10.7927C2.80443 12.2147 3.43453 12.9388 4.85464 12.9388ZM1.5018 4.10325L15.5643 4.10325C16.5061 4.10325 17.0644 3.49076 17.0644 2.55799L17.0644 1.55796C17.0644 0.623227 16.5061 0.0144053 15.5643 0.0144053L1.5018 0.0144053C0.588798 0.0144053 0 0.623227 0 1.55796L0 2.55799C0 3.49076 0.561696 4.10325 1.5018 4.10325ZM1.72372 2.88176C1.41559 2.88176 1.26666 2.7255 1.26666 2.412L1.26666 1.70028C1.26666 1.39215 1.41559 1.23589 1.72372 1.23589L15.3444 1.23589C15.6542 1.23589 15.7978 1.39215 15.7978 1.70028L15.7978 2.412C15.7978 2.7255 15.6542 2.88176 15.3444 2.88176Z"/><path d="M6.62087 10.2995C6.77686 10.2995 6.90282 10.2353 7.01438 10.1274L8.53038 8.60625L10.0517 10.1274C10.1633 10.2316 10.2876 10.2995 10.4526 10.2995C10.7594 10.2995 11.0131 10.0368 11.0131 9.72824C11.0131 9.56151 10.9542 9.44092 10.8427 9.32936L9.33033 7.81679L10.8463 6.29151C10.965 6.17458 11.0184 6.0557 11.0184 5.90166C11.0184 5.58407 10.7685 5.33044 10.4526 5.33044C10.302 5.33044 10.1814 5.38928 10.0608 5.5062L8.53038 7.03269L7.01072 5.50987C6.89379 5.39831 6.77686 5.33947 6.62087 5.33947C6.31036 5.33947 6.05307 5.59311 6.05307 5.90166C6.05307 6.05936 6.11019 6.18899 6.22346 6.29688L7.73579 7.81679L6.22346 9.33303C6.1119 9.44092 6.05307 9.56688 6.05307 9.72824C6.05307 10.0405 6.3067 10.2995 6.62087 10.2995Z"/></g></svg></span>';
162
+ // const deleteIcon = '<span><svg stroke="currentColor" fill="none" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" height="11px" width="11px" viewBox="0 0 216 163" version="1.1" xmlns="http://www.w3.org/2000/svg"><rect x="0.5" y="0.5" width="215" height="39" rx="9"/><path d="M197.485,39.535 L181.664,145.870 C180.953,150.648 178.547,154.805 175.110,157.768 C171.674,160.731 167.207,162.500 162.376,162.500 L53.558,162.500 C48.737,162.500 44.278,160.738 40.843,157.785 C37.409,154.831 34.999,150.686 34.278,145.919 L18.173,39.535 L197.485,39.535 Z" /><line x1="79.5" y1="71.5" x2="135.5" y2="127.5"/><line x1="79.5" y1="127.5" x2="135.5" y2="71.5"/></svg></span>'
web_assets/stylesheet/chatbot.css CHANGED
@@ -136,6 +136,10 @@ hr.append-display {
136
  justify-content: flex-end;
137
  }
138
 
 
 
 
 
139
  /* 屏幕宽度大于等于500px的设备 */
140
  /* update on 2023.4.8: 高度的细致调整已写入JavaScript */
141
  @media screen and (min-width: 500px) {
@@ -227,8 +231,6 @@ hr.append-display {
227
  /* background-color: #E6E6E6 !important; */
228
  color: rgba(120, 120, 120, 0.64) !important;
229
  padding: 4px !important;
230
- position: absolute;
231
- right: -22px;
232
  cursor: pointer !important;
233
  transition: color .2s ease, background-color .2s ease;
234
  }
@@ -243,14 +245,50 @@ hr.append-display {
243
  outline: none;
244
  }
245
 
246
- .copy-bot-btn {
247
- /* top: 18px; */
 
248
  bottom: 0;
 
 
 
 
249
  }
250
- .toggle-md-btn {
251
- /* top: 0; */
252
- bottom: 20px;
 
 
 
 
 
 
 
253
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
 
255
  /* note: this is deprecated */
256
  .copy-code-btn {
 
136
  justify-content: flex-end;
137
  }
138
 
139
+ /* .message-row.has-message-btn-row{
140
+ padding-bottom: 19px !important;
141
+ } */
142
+
143
  /* 屏幕宽度大于等于500px的设备 */
144
  /* update on 2023.4.8: 高度的细致调整已写入JavaScript */
145
  @media screen and (min-width: 500px) {
 
231
  /* background-color: #E6E6E6 !important; */
232
  color: rgba(120, 120, 120, 0.64) !important;
233
  padding: 4px !important;
 
 
234
  cursor: pointer !important;
235
  transition: color .2s ease, background-color .2s ease;
236
  }
 
245
  outline: none;
246
  }
247
 
248
+ .message-btn-column {
249
+ position: absolute;
250
+ right: -23px;
251
  bottom: 0;
252
+ display: flex;
253
+ flex-direction: column;
254
+ align-content: end;
255
+ gap: 2px;
256
  }
257
+
258
+ .message-btn-row {
259
+ /* background: red; */
260
+ width: 100%;
261
+ height: 19px;
262
+ position: absolute;
263
+ top: calc(100% + 2px);
264
+ left: 0;
265
+ display: flex;
266
+ justify-content: space-between;
267
  }
268
+ .message-btn-row-leading, .message-btn-row-trailing {
269
+ display: inline-flex;
270
+ gap: 4px;
271
+ }
272
+ .message-btn-row button {
273
+ font-size: 10px;
274
+ align-self: center;
275
+ align-items: center;
276
+ flex-wrap: nowrap;
277
+ white-space: nowrap;
278
+ display: inline-flex;
279
+ flex-direction: row;
280
+ gap: 4px;
281
+ padding-block: 2px !important;
282
+ }
283
+
284
+ /* .copy-bot-btn {
285
+ top: 18px; */
286
+ /* bottom: 0;
287
+ }
288
+ .toggle-md-btn {
289
+ top: 0; */
290
+ /* bottom: 20px;
291
+ } */
292
 
293
  /* note: this is deprecated */
294
  .copy-code-btn {