openaxies 0.5.3 → 0.5.4

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/package.json +1 -1
  2. package/src/App.js +16 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openaxies",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
package/src/App.js CHANGED
@@ -180,23 +180,21 @@ function AppRoot() {
180
180
  }
181
181
  if (event.type === 'thinking' || event.type === 'token') {
182
182
  const content = typeof event.content === 'string' ? event.content : '';
183
- for (let i = 0; i < content.length; i++) {
184
- accumulated = accumulated + content[i];
185
- const inside = checkThink(accumulated);
186
- setStreamText(accumulated);
187
- setIsThinking(inside);
188
- if (inside === true && thinkStarted === false) {
189
- thinkStarted = true;
190
- thinkStartRef.current = Date.now();
191
- setThinkingElapsed(0);
192
- }
193
- if (inside === false && thinkStarted === true) {
194
- thinkStarted = false;
195
- thinkStartRef.current = null;
196
- setThinkingElapsed(0);
197
- }
198
- await new Promise(function (r) { setTimeout(r, 0); });
183
+ accumulated = accumulated + content;
184
+ const inside = checkThink(accumulated);
185
+ setStreamText(accumulated);
186
+ setIsThinking(inside);
187
+ if (inside === true && thinkStarted === false) {
188
+ thinkStarted = true;
189
+ thinkStartRef.current = Date.now();
190
+ setThinkingElapsed(0);
191
+ }
192
+ if (inside === false && thinkStarted === true) {
193
+ thinkStarted = false;
194
+ thinkStartRef.current = null;
195
+ setThinkingElapsed(0);
199
196
  }
197
+ await new Promise(function (r) { setTimeout(r, 0); });
200
198
  }
201
199
  if (event.type === 'done') break;
202
200
  if (event.type === 'timeout') {
@@ -210,10 +208,9 @@ function AppRoot() {
210
208
  thinkStartRef.current = null;
211
209
  setThinkingElapsed(0);
212
210
  setStreamingActive(false);
213
- const finalText = streamText;
214
211
  setStreamText('');
215
- if (finalText.length > 0) {
216
- setMessages(function (p) { return p.concat([{ role: 'assistant', content: finalText, id: 'a-' + Date.now() }]); });
212
+ if (accumulated.length > 0) {
213
+ setMessages(function (p) { return p.concat([{ role: 'assistant', content: accumulated, id: 'a-' + Date.now() }]); });
217
214
  }
218
215
  } catch (err) {
219
216
  if (connRef.current !== null) clearInterval(connRef.current), connRef.current = null;