@@ -391,6 +391,15 @@ class BotAgent {
391
391
const Conversation = await mConversationStart ( type , form , bot_id , null , llm_id , this . #llm, this . #factory, prompt )
392
392
return Conversation
393
393
}
394
+ /**
395
+ * Given an itemId, evaluates aspects of item summary. Evaluate content is a vanilla function for MyLife, so does not require intervening intelligence and relies on the factory's modular LLM.
396
+ * @param {Guid } itemId - The item id
397
+ * @returns {Object } - The Response object { instruction, responses, success, }
398
+ */
399
+ async evaluate ( itemId ) {
400
+ const response = await this . #factory. evaluate ( itemId , this . avatar . llm_id )
401
+ return response
402
+ }
394
403
/**
395
404
* Gets the correct bot for the item type and form.
396
405
* @todo - deprecate
@@ -405,6 +414,7 @@ class BotAgent {
405
414
return itemForm . toLowerCase ( ) === 'diary'
406
415
? 'diary'
407
416
: 'journaler'
417
+ return 'avatar'
408
418
}
409
419
/**
410
420
* Get a static or dynamic greeting from active bot.
@@ -432,9 +442,9 @@ class BotAgent {
432
442
const messages = [ ]
433
443
messages . push ( {
434
444
content : `## MEMORY SUMMARY Reference for id: ${ item . id } \n### FOR REFERENCE ONLY\n${ item . summary } \n` ,
435
- role : 'assistant ' ,
445
+ role : 'user ' ,
436
446
} )
437
- memberInput = `${ message } Let's begin to LIVE MEMORY, id: ${ item . id } , MEMORY SUMMARY in previous message `
447
+ memberInput = `${ message } Let's begin to LIVE MEMORY, id: ${ item . id } , MEMORY SUMMARY starts this conversation `
438
448
const Conversation = await mConversationStart ( 'memory' , type , bot_id , null , llm_id , this . #llm, this . #factory, memberInput , messages )
439
449
Conversation . action = 'living'
440
450
livingMemory . Conversation = Conversation
@@ -580,8 +590,7 @@ class BotAgent {
580
590
}
581
591
await Bot . update ( _bot , botOptions )
582
592
if ( migrateThread )
583
- if ( ! await Bot . migrateChat ( ) )
584
- console . log ( `thread migration failed for bot: ${ bot_id } ` )
593
+ await Bot . migrateChat ( )
585
594
}
586
595
return Bot
587
596
}
@@ -1005,9 +1014,9 @@ async function mCallLLM(Conversation, allowSave=true, llm, factory, avatar){
1005
1014
if ( ! prompt ?. length )
1006
1015
throw new Error ( 'No `prompt` found in Conversation for `mCallLLM`.' )
1007
1016
const botResponses = await llm . getLLMResponse ( thread_id , llm_id , prompt , factory , avatar )
1008
- const run_id = botResponses ?. [ 0 ] ?. run_id
1009
- if ( ! run_id ?. length )
1017
+ if ( ! botResponses ?. length )
1010
1018
return
1019
+ const { run_id, } = botResponses [ 0 ]
1011
1020
Conversation . addRun ( run_id )
1012
1021
botResponses
1013
1022
. filter ( botResponse => botResponse ?. run_id === Conversation . run_id )
@@ -1095,12 +1104,17 @@ function mGetAIFunctions(type, globals, vectorstoreId){
1095
1104
case 'avatar' :
1096
1105
case 'personal-assistant' :
1097
1106
case 'personal-avatar' :
1107
+ tools . push (
1108
+ globals . getGPTJavascriptFunction ( 'changeTitle' ) ,
1109
+ globals . getGPTJavascriptFunction ( 'getSummary' ) ,
1110
+ )
1098
1111
includeSearch = true
1099
1112
break
1100
1113
case 'biographer' :
1101
1114
case 'personal-biographer' :
1102
1115
tools . push (
1103
1116
globals . getGPTJavascriptFunction ( 'changeTitle' ) ,
1117
+ globals . getGPTJavascriptFunction ( 'endReliving' ) ,
1104
1118
globals . getGPTJavascriptFunction ( 'getSummary' ) ,
1105
1119
globals . getGPTJavascriptFunction ( 'itemSummary' ) ,
1106
1120
globals . getGPTJavascriptFunction ( 'updateSummary' ) ,
@@ -1297,6 +1311,7 @@ async function mMigrateChat(Bot, llm, saveConversation=false){
1297
1311
conversation . save ( ) // no `await`
1298
1312
}
1299
1313
await Bot . setThread ( newThread . id ) // autosaves `thread_id`, no `await`
1314
+ console . log ( `chat migrated::from ${ thread_id } to ${ newThread . id } ` , botType )
1300
1315
}
1301
1316
/**
1302
1317
* Gets or creates a new thread in LLM provider.
0 commit comments