foliko 1.0.56 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foliko",
3
- "version": "1.0.56",
3
+ "version": "1.0.57",
4
4
  "description": "简约的插件化 Agent 框架",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  const { Plugin } = require('../src/core/plugin-base')
12
-
12
+ const {cleanResponse} =require('../src/utils')
13
13
  class FeishuPlugin extends Plugin {
14
14
  constructor(config = {}) {
15
15
  super()
@@ -284,7 +284,7 @@ class FeishuPlugin extends Plugin {
284
284
  try {
285
285
  // 使用非流式响应
286
286
  const result = await agent.chat(text, { sessionId })
287
- const fullResponse = result.message || ''
287
+ const fullResponse = cleanResponse(result.message || '')
288
288
 
289
289
  if (this._sessionPlugin) {
290
290
  this._sessionPlugin.addMessage(sessionId, { role: 'assistant', content: fullResponse })
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  const { Plugin } = require('../src/core/plugin-base')
11
+ const {cleanResponse} =require('../src/utils')
11
12
  const { z } = require('zod')
12
13
  const { WeixinBot } = require('@chnak/weixin-bot')
13
14
 
@@ -246,7 +247,7 @@ class WeixinPlugin extends Plugin {
246
247
  const result = await agent.chat(text, {
247
248
  sessionId: sessionId
248
249
  })
249
- const fullResponse = result.message || ''
250
+ const fullResponse = cleanResponse(result.message || '')
250
251
 
251
252
  // 保存助手回复到历史(使用 SessionPlugin)
252
253
  if (this._sessionPlugin) {
@@ -0,0 +1,3 @@
1
+ exports.cleanResponse=function (text) {
2
+ return text.replace(/<think>[\s\S]*?<\/think>/g, '').trim();
3
+ }