foliko 1.1.55 → 1.1.57

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.
@@ -100,12 +100,18 @@ class ChatUI {
100
100
  (s) => chalk.green(s), // indicatorColorFn
101
101
  (s) => chalk.yellow(s), // messageColorFn
102
102
  "工具调用...",
103
+ {
104
+ frames:["|", "/", "-", "\\"].map(str=>folikoTerracotta(str))
105
+ }
103
106
  )
104
107
  const loader=new Loader(
105
108
  tui,
106
109
  (s) => chalk.cyan(s), // indicatorColorFn
107
110
  (s) => chalk.dim(s), // messageColorFn
108
111
  "正在思考中...",
112
+ {
113
+ frames:["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"].map(str=>folikoPrimary(str))
114
+ }
109
115
  )
110
116
  // Spacer 占位,用于隐藏时保持布局
111
117
  const toolerSpacer = new Spacer(1);
@@ -285,10 +291,11 @@ class ChatUI {
285
291
  sendMessage(message){
286
292
  const self=this;
287
293
  queue.add(function(){
288
- self.agent.sendMessage(message, { sessionId:self.sessionId }).then().then(this.next)
294
+ self.agent.sendMessage(message, { sessionId:self.sessionId }).then(this.next).catch(self.clear_message_done.bind(self));
289
295
  })
290
296
  this.loader.show();
291
- return
297
+ this.tui.setFocus(this.editor);
298
+ return
292
299
  }
293
300
 
294
301
  async handleOnSubmit(value){
@@ -332,7 +339,8 @@ class ChatUI {
332
339
  setTimeout(this.sendMessage.bind(this,message),10)
333
340
 
334
341
  }catch(err){
335
- console.log(err)
342
+ //console.log(err)
343
+ this.create_message(err.message,colored('● ', RED))
336
344
  //this.tui.stop();
337
345
  }
338
346
  }
@@ -478,11 +486,11 @@ class ChatUI {
478
486
  }
479
487
  } else if (chunk.type === 'tool-call') {
480
488
  const args = chunk.input ? JSON.stringify(chunk.input).slice(0, 50) : '';
481
- this.tooler.show(`${chalk.yellow('[Tool]')} ${chalk.blue(chunk.toolName)} ${chalk.gray(args+'...')}`)
489
+ this.tooler.show(`${chalk.yellow('[Tool]')} ${folikoGold(chunk.toolName)} ${chalk.gray(args+'...')}`)
482
490
  } else if(chunk.type==='tool-result'){
483
491
  const result = chunk.result;
484
492
  const shortResult = typeof result === 'string' ? result.slice(0, 30) : JSON.stringify(result).slice(0, 30);
485
- this.tooler.show(`${chalk.green('[Tool]')} ${chalk.blue(chunk.toolName)} ${chalk.gray(shortResult+'...')}`)
493
+ this.tooler.show(`${chalk.green('[Tool]')} ${folikoGold(chunk.toolName)} ${chalk.gray(shortResult+'...')}`)
486
494
  // setTimeout(() => this.tooler.hide(), 3000);
487
495
  }else if (chunk.type === 'error') {
488
496
  this.tooler.show(chalk.red(`[Error] ${chunk.error}`))
@@ -497,8 +505,7 @@ class ChatUI {
497
505
  this.sessionScope.on('queue:completed', this.clear_message_done.bind(this))
498
506
 
499
507
  this.sessionScope.on('queue:failed', ({ error }) => {
500
- //console.error(`\n${colored('[错误]', RED)} ${error}`);
501
- this._currentBotMessage.setText(chalk.red(`[错误] ${error.message}`))
508
+ this.create_message(chalk.red(`[错误] ${error}`),colored('● ', RED))
502
509
  this.clear_message_done()
503
510
  });
504
511
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foliko",
3
- "version": "1.1.55",
3
+ "version": "1.1.57",
4
4
  "description": "简约的插件化 Agent 框架",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",