openaxies 1.0.0 → 1.0.1
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 +12 -9
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -7,7 +7,6 @@ import { callModel } from './providers/index.js';
|
|
|
7
7
|
import { Typography } from './components/ui/Typography.js';
|
|
8
8
|
import { Separator } from './components/ui/Separator.js';
|
|
9
9
|
import { ActivityItem } from './components/timeline/ActivityItem.js';
|
|
10
|
-
import { TodoTracker } from './components/timeline/TodoTracker.js';
|
|
11
10
|
|
|
12
11
|
const h = React.createElement;
|
|
13
12
|
|
|
@@ -33,7 +32,6 @@ export default function AppRoot() {
|
|
|
33
32
|
const [thinkingElapsed, setThinkingElapsed] = React.useState(0);
|
|
34
33
|
const [isThinking, setIsThinking] = React.useState(false);
|
|
35
34
|
const [startupDone, setStartupDone] = React.useState(false);
|
|
36
|
-
const [todos, setTodos] = React.useState([]);
|
|
37
35
|
|
|
38
36
|
const abortControllerRef = React.useRef(null);
|
|
39
37
|
|
|
@@ -52,9 +50,9 @@ export default function AppRoot() {
|
|
|
52
50
|
|
|
53
51
|
async function handleSubmit(text) {
|
|
54
52
|
if (!text || streamingActive) return;
|
|
55
|
-
|
|
53
|
+
setStartupDone(true);
|
|
56
54
|
|
|
57
|
-
const userMsg = {
|
|
55
|
+
const userMsg = { type: 'user', content: text };
|
|
58
56
|
setMessages(prev => [...prev, userMsg]);
|
|
59
57
|
setInputBuffer('');
|
|
60
58
|
setStreamingActive(true);
|
|
@@ -65,7 +63,12 @@ export default function AppRoot() {
|
|
|
65
63
|
abortControllerRef.current = new AbortController();
|
|
66
64
|
|
|
67
65
|
try {
|
|
68
|
-
const history =
|
|
66
|
+
const history = messages.map(m => ({
|
|
67
|
+
role: m.type === 'user' ? 'user' : 'assistant',
|
|
68
|
+
content: m.content
|
|
69
|
+
}));
|
|
70
|
+
history.push({ role: 'user', content: text });
|
|
71
|
+
|
|
69
72
|
const stream = callModel({ id: activeModel }, history, abortControllerRef.current.signal);
|
|
70
73
|
|
|
71
74
|
for await (const event of stream) {
|
|
@@ -78,8 +81,9 @@ export default function AppRoot() {
|
|
|
78
81
|
setThoughtContent(prev => prev + content.replace('<think>', ''));
|
|
79
82
|
} else if (content.includes('</think>')) {
|
|
80
83
|
setIsThinking(false);
|
|
81
|
-
|
|
82
|
-
setMessages(prev => [...prev, { type: 'thought', content:
|
|
84
|
+
const finalThought = thoughtContent + content.replace('</think>', '');
|
|
85
|
+
setMessages(prev => [...prev, { type: 'thought', content: finalThought, elapsed: thinkingElapsed.toFixed(1) + 's' }]);
|
|
86
|
+
setThoughtContent('');
|
|
83
87
|
} else if (isThinking) {
|
|
84
88
|
setThoughtContent(prev => prev + content);
|
|
85
89
|
} else {
|
|
@@ -99,7 +103,6 @@ export default function AppRoot() {
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
const renderHeader = () => {
|
|
102
|
-
if (!startupDone) return null;
|
|
103
106
|
return h(Box, { height: 1, paddingLeft: 1, paddingRight: 1 },
|
|
104
107
|
h(Typography.Header, 'OpenAxies'),
|
|
105
108
|
h(Typography.Muted, ` \u2022 ${modelLabel}`),
|
|
@@ -164,7 +167,7 @@ export default function AppRoot() {
|
|
|
164
167
|
height: rows,
|
|
165
168
|
overflow: 'hidden'
|
|
166
169
|
},
|
|
167
|
-
|
|
170
|
+
!startupDone ? renderStartup() : null,
|
|
168
171
|
startupDone && renderHeader(),
|
|
169
172
|
startupDone && h(Separator),
|
|
170
173
|
startupDone && renderTimeline(),
|