openaxies 0.5.2 → 0.5.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openaxies",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
package/src/App.js CHANGED
@@ -279,7 +279,7 @@ function AppRoot() {
279
279
  h(Text, { key: 'l' + r, color: LOGO_COLORS[r % LOGO_COLORS.length], bold: true }, LOGO[r])
280
280
  );
281
281
  }
282
- const logo = h(Box, { flexDirection: 'column', width: '100%', flexShrink: 0, paddingLeft: 1 }, ...logoEls);
282
+ const logo = h(Box, { flexDirection: 'column', width: '100%', flexShrink: 0, paddingLeft: 0 }, ...logoEls);
283
283
 
284
284
  const viewLines = [];
285
285
  for (let i = 0; i < messages.length; i++) {
@@ -310,7 +310,10 @@ function AppRoot() {
310
310
  }
311
311
 
312
312
  if (viewLines.length === 0) {
313
- viewLines.push({ t: 'idle', text: ' \u25B8 type a message to begin... [/help for commands]' });
313
+ viewLines.push({ t: 'idle', text: ' \u25B8 type a message to begin | /model to switch models | /help for commands' });
314
+ viewLines.push({ t: 'idle', text: '' });
315
+ viewLines.push({ t: 'idle-sm', text: ' Models: OpenAxies Llama | OpenAxies GPT | OpenAxies DeepSeek' });
316
+ viewLines.push({ t: 'idle-sm', text: ' Current: ' + activeLabel });
314
317
  }
315
318
 
316
319
  const visible = Math.max(1, availLines - 1);
@@ -352,7 +355,13 @@ function AppRoot() {
352
355
  } else if (l.t === 'idle') {
353
356
  viewEls.push(
354
357
  h(Box, { key: 'i-' + i, height: 1, paddingLeft: 1 },
355
- h(Text, { color: '#444466' }, l.text)
358
+ h(Text, { color: '#555577' }, l.text)
359
+ )
360
+ );
361
+ } else if (l.t === 'idle-sm') {
362
+ viewEls.push(
363
+ h(Box, { key: 'is-' + i, height: 1, paddingLeft: 1 },
364
+ h(Text, { color: '#333355' }, l.text)
356
365
  )
357
366
  );
358
367
  }
@@ -82,6 +82,7 @@ export async function* callModel(modelConfig, messages, signal) {
82
82
  messages: modelMessages,
83
83
  max_tokens: 4096,
84
84
  temperature: 0.7,
85
+ stream: true,
85
86
  };
86
87
 
87
88
  let lastError = null;
@@ -78,7 +78,7 @@ export async function* streamResponse(endpoint, body, signal) {
78
78
  }, READ_TIMEOUT);
79
79
  }
80
80
 
81
- resetReadTimeout();
81
+ let firstChunk = true;
82
82
 
83
83
  try {
84
84
  while (true) {
@@ -86,12 +86,48 @@ export async function* streamResponse(endpoint, body, signal) {
86
86
  resetReadTimeout();
87
87
 
88
88
  if (result.done === true) {
89
+ if (buffer.trim().length > 0 && firstChunk === false) {
90
+ try {
91
+ const parsed = JSON.parse(buffer);
92
+ const choice = parsed.choices && parsed.choices[0];
93
+ if (choice !== null && choice !== undefined) {
94
+ const msg = choice.message || choice.delta;
95
+ if (msg !== null && msg !== undefined) {
96
+ if (typeof msg.content === 'string' && msg.content.length > 0) {
97
+ yield { type: 'token', content: msg.content };
98
+ }
99
+ }
100
+ }
101
+ } catch (_) {
102
+ }
103
+ }
89
104
  yield { type: 'done' };
90
105
  return;
91
106
  }
92
107
 
93
108
  const chunk = decoder.decode(result.value, { stream: true });
94
109
  buffer = buffer + chunk;
110
+
111
+ if (firstChunk === true && buffer.includes('data: ') === false && buffer.trim().startsWith('{') === true) {
112
+ try {
113
+ const parsed = JSON.parse(buffer);
114
+ const choice = parsed.choices && parsed.choices[0];
115
+ if (choice !== null && choice !== undefined) {
116
+ const msg = choice.message || choice.delta;
117
+ if (msg !== null && msg !== undefined) {
118
+ if (typeof msg.content === 'string' && msg.content.length > 0) {
119
+ yield { type: 'token', content: msg.content };
120
+ }
121
+ }
122
+ }
123
+ yield { type: 'done' };
124
+ return;
125
+ } catch (_) {
126
+ }
127
+ }
128
+
129
+ firstChunk = false;
130
+
95
131
  const lines = buffer.split('\n');
96
132
  buffer = lines.pop() || '';
97
133