koneck 2.87.1 → 2.88.0
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.
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +20 -11
- package/dist/engine.js.map +1 -1
- package/dist/web/ui-client.d.ts.map +1 -1
- package/dist/web/ui-client.js +65 -2
- package/dist/web/ui-client.js.map +1 -1
- package/dist/web/ui-css.d.ts.map +1 -1
- package/dist/web/ui-css.js +259 -215
- package/dist/web/ui-css.js.map +1 -1
- package/package.json +1 -1
package/dist/web/ui-client.js
CHANGED
|
@@ -158,6 +158,55 @@ function md(src) {
|
|
|
158
158
|
.replace(/^#{2,4} (.*)$/gm, '<h3>$1</h3>')
|
|
159
159
|
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
|
160
160
|
.replace(new RegExp(T + '([^' + T + '\n]+)' + T, 'g'), '<code>$1</code>');
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
* Lists and paragraphs, which this did not have at all.
|
|
164
|
+
*
|
|
165
|
+
* Headings, bold, tables, inline code and fenced blocks were rendered; a bulleted list came out
|
|
166
|
+
* as literal hyphens and a numbered one as "1." at the start of a line, held together only by
|
|
167
|
+
* the white-space:pre-wrap on the element around it. So a model that answers in steps — which is
|
|
168
|
+
* how models answer — produced a wall with punctuation in it.
|
|
169
|
+
*
|
|
170
|
+
* Line-based rather than a parser: this renders one model's reply, not a document, and a real
|
|
171
|
+
* markdown implementation is larger than the page it would be serving. Nested lists are not
|
|
172
|
+
* handled, and that is a limit rather than an oversight — one level is what a reply uses.
|
|
173
|
+
*/
|
|
174
|
+
const lines = text.split('\n');
|
|
175
|
+
const out = [];
|
|
176
|
+
let list = null; // 'ul' | 'ol' while one is open
|
|
177
|
+
let para = [];
|
|
178
|
+
|
|
179
|
+
const closeList = () => { if (list) { out.push('</' + list + '>'); list = null; } };
|
|
180
|
+
const closePara = () => {
|
|
181
|
+
if (para.length === 0) return;
|
|
182
|
+
out.push('<p>' + para.join('<br>') + '</p>');
|
|
183
|
+
para = [];
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
for (const line of lines) {
|
|
187
|
+
const bullet = /^[-*+]\s+(.*)$/.exec(line);
|
|
188
|
+
const number = /^(\d+)[.)]\s+(.*)$/.exec(line);
|
|
189
|
+
// A block the earlier passes already produced stands on its own: wrapping a table or a heading
|
|
190
|
+
// in a paragraph is invalid, and wrapping a fenced block's placeholder would put a pre inside
|
|
191
|
+
// one, which browsers unpick in ways nobody intends.
|
|
192
|
+
const already = /^\s*<(h3|table|pre)/.test(line) || line.indexOf(HOLE) !== -1;
|
|
193
|
+
|
|
194
|
+
if (bullet || number) {
|
|
195
|
+
closePara();
|
|
196
|
+
const want = bullet ? 'ul' : 'ol';
|
|
197
|
+
if (list !== want) { closeList(); out.push('<' + want + '>'); list = want; }
|
|
198
|
+
out.push('<li>' + (bullet ? bullet[1] : number[2]) + '</li>');
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
closeList();
|
|
202
|
+
if (already) { closePara(); out.push(line); continue; }
|
|
203
|
+
if (line.trim() === '') { closePara(); continue; }
|
|
204
|
+
para.push(line);
|
|
205
|
+
}
|
|
206
|
+
closeList();
|
|
207
|
+
closePara();
|
|
208
|
+
text = out.join('\n');
|
|
209
|
+
|
|
161
210
|
return text.replace(new RegExp(HOLE + '(\\d+)' + HOLE, 'g'), (m, i) => blocks[Number(i)]);
|
|
162
211
|
}
|
|
163
212
|
|
|
@@ -543,8 +592,22 @@ function onEvent(e) {
|
|
|
543
592
|
// Separate thoughts arrive as separate deliveries with no whitespace between them, which ran
|
|
544
593
|
// together as "kill it properlyThe port 3001 is being used by". A sentence boundary with no
|
|
545
594
|
// space at it is the tell, and it is a safe one: real prose never has it.
|
|
546
|
-
|
|
547
|
-
|
|
595
|
+
/*
|
|
596
|
+
* Reasoning read as reasoning, not as a wall.
|
|
597
|
+
*
|
|
598
|
+
* It was set with textContent and pre-wrap, so a model that thinks in headings, numbered
|
|
599
|
+
* steps and bullets rendered every one of them as literal asterisks and hashes running
|
|
600
|
+
* together — the thing being reasoned about was there and unreadable. It is markdown, so it
|
|
601
|
+
* is rendered as markdown, through the same renderer the replies use: escaped first, fenced
|
|
602
|
+
* blocks lifted out, a single tag inserted after. Model output is untrusted text and often
|
|
603
|
+
* contains HTML, and none of that changes because it happens to be a thought.
|
|
604
|
+
*
|
|
605
|
+
* The raw text is kept on the element, because each delivery appends to what came before and
|
|
606
|
+
* reading it back out of rendered HTML would lose the newlines that separate the paragraphs.
|
|
607
|
+
*/
|
|
608
|
+
const grown = joinChunk(state.thinkEl.dataset.raw || '', e.text).slice(-4000);
|
|
609
|
+
state.thinkEl.dataset.raw = grown;
|
|
610
|
+
state.thinkEl.innerHTML = md(grown);
|
|
548
611
|
break;
|
|
549
612
|
}
|
|
550
613
|
case 'tool':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-client.js","sourceRoot":"","sources":["../../src/web/ui-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"ui-client.js","sourceRoot":"","sources":["../../src/web/ui-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA24LlB,CAAC;AACF,CAAC"}
|
package/dist/web/ui-css.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-css.d.ts","sourceRoot":"","sources":["../../src/web/ui-css.ts"],"names":[],"mappings":"AA8CA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"ui-css.d.ts","sourceRoot":"","sources":["../../src/web/ui-css.ts"],"names":[],"mappings":"AA8CA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAwzC3C"}
|