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.
- package/package.json +1 -1
- package/src/App.js +16 -19
package/package.json
CHANGED
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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 (
|
|
216
|
-
setMessages(function (p) { return p.concat([{ role: 'assistant', content:
|
|
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;
|