kingkont 0.7.18 → 0.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.html +24 -4
  2. package/package.json +1 -1
package/index.html CHANGED
@@ -3575,11 +3575,31 @@ async function renderNodeBody(node, body) {
3575
3575
  if (node.status === 'error') {
3576
3576
  const wrap = document.createElement('div');
3577
3577
  wrap.className = 'gen-error';
3578
- wrap.textContent = node.error || 'Ошибка генерации';
3579
- // Если ошибка указывает на отсутствующую авторизацию KingKont — показываем
3580
- // кнопку «Войти», открывающую окно настроек (там Chatium login flow).
3581
3578
  const errStr = String(node.error || '');
3582
- if (/[KК](?:ing|инг)?[Kк]ont|войдите/i.test(errStr) && /KingKont/i.test(errStr)) {
3579
+ const errBlock = document.createElement('div');
3580
+ // Делаем text selectable — для копирования при необходимости.
3581
+ errBlock.style.cssText = 'user-select: text; -webkit-user-select: text; cursor: text; word-break: break-word; margin-bottom: 8px;';
3582
+ errBlock.textContent = errStr || 'Ошибка генерации';
3583
+ wrap.appendChild(errBlock);
3584
+ // Кнопка «Скопировать» — для длинных server-ошибок.
3585
+ if (errStr) {
3586
+ const copyBtn = document.createElement('button');
3587
+ copyBtn.textContent = '📋 Скопировать';
3588
+ copyBtn.style.marginRight = '6px';
3589
+ copyBtn.addEventListener('click', async e => {
3590
+ e.stopPropagation();
3591
+ try {
3592
+ await navigator.clipboard.writeText(errStr);
3593
+ const orig = copyBtn.textContent;
3594
+ copyBtn.textContent = '✓ Скопировано';
3595
+ setTimeout(() => { copyBtn.textContent = orig; }, 1500);
3596
+ } catch {}
3597
+ });
3598
+ wrap.appendChild(copyBtn);
3599
+ }
3600
+ // Кнопка «Войти» — ТОЛЬКО когда сервер прислал 503 «Войдите в KingKont…»
3601
+ // (т.е. реально auth-проблема, а не любая ошибка которая упоминает KingKont).
3602
+ if (/Войдите в KingKont/i.test(errStr)) {
3583
3603
  const loginBtn = document.createElement('button');
3584
3604
  loginBtn.textContent = '🔑 Войти';
3585
3605
  loginBtn.style.marginRight = '6px';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kingkont",
3
- "version": "0.7.18",
3
+ "version": "0.7.20",
4
4
  "description": "KingKont \u00b7 Chatium \u2014 \u043d\u043e\u0434-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0441\u0446\u0435\u043d \u0441 AI-\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438/\u0432\u0438\u0434\u0435\u043e/\u0433\u043e\u043b\u043e\u0441/SFX/\u043c\u0443\u0437\u044b\u043a\u0430/\u0442\u0435\u043a\u0441\u0442)",
5
5
  "main": "main.js",
6
6
  "bin": {