Skip to content

Commit 60ee198

Browse files
authored
365 version 0022 updates (#371) (#373)
* 20240917 @Mookse - version change * 20240917 @Mookse - Reliving Memory is not showing copy of entered text in Scrapbook Chat Window #331 - backend * 20240919 @Mookse - minor intel mods * 20240919 @Mookse - Reliving Memory is not showing copy of entered text in Scrapbook Chat Window #331 - frontend * 20240923 @Mookse - frontend fix when no .instruction * 20240923 @Mookse - tracking for callbacks * 20240923 @Mookse - small publicity updates * 20240923 @Mookse - add tutorial to member avatar menu * 20240923 @Mookse - stub for retires --------- Signed-off-by: Erik Jespersen <42016062+Mookse@users.noreply.github.com>
1 parent 21dfce3 commit 60ee198

File tree

8 files changed

+111
-40
lines changed

8 files changed

+111
-40
lines changed

inc/js/mylife-llm-services.mjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,12 @@ async function mRunFunctions(openai, run, factory, avatar){ // add avatar ref
410410
action = `journal entry failed to save, notify member and continue on for now`
411411
}
412412
confirmation.output = JSON.stringify({ action, success, })
413+
console.log('mRunFunctions()::entrySummary', toolArguments, confirmation.output)
413414
return confirmation
414415
case 'getsummary':
415416
case 'get_summary':
416417
case 'get summary':
417-
let { summary, } = item ?? {}
418+
let { summary, title: _getSummaryTitle, } = item ?? {}
418419
if(!summary?.length){
419420
action = `error getting summary for itemId: ${ itemId ?? 'missing itemId' } - halt any further processing and instead ask user to paste summary into chat and you will continue from there to incorporate their message.`
420421
summary = 'no summary found for itemId'
@@ -423,16 +424,16 @@ async function mRunFunctions(openai, run, factory, avatar){ // add avatar ref
423424
success = true
424425
}
425426
confirmation.output = JSON.stringify({ action, itemId, success, summary, })
426-
console.log('mRunFunctions()::getSummary::confirmation', itemId)
427+
console.log('mRunFunctions()::getsummary', itemId, _getSummaryTitle)
427428
return confirmation
428429
case 'hijackattempt':
429430
case 'hijack_attempt':
430431
case 'hijack-attempt':
431432
case 'hijack attempt':
432-
console.log('mRunFunctions()::hijack_attempt', toolArguments)
433433
action = 'attempt noted in system and user ejected; greet per normal as first time new user'
434434
success = true
435435
confirmation.output = JSON.stringify({ action, success, })
436+
console.log('mRunFunctions()::hijack_attempt', toolArguments)
436437
return confirmation
437438
case 'registercandidate':
438439
case 'register_candidate':
@@ -454,6 +455,7 @@ async function mRunFunctions(openai, run, factory, avatar){ // add avatar ref
454455
case 'story-summary':
455456
case 'story_summary':
456457
case 'story summary':
458+
console.log('mRunFunctions()::storySummary', toolArguments)
457459
const story = await factory.story(toolArguments)
458460
if(story){
459461
const { keywords, phaseOfLife, } = story
@@ -465,11 +467,9 @@ async function mRunFunctions(openai, run, factory, avatar){ // add avatar ref
465467
switch(true){
466468
case phaseOfLife?.length:
467469
action = `ask about another encounter during member's ${ phaseOfLife }`
468-
console.log('mRunFunctions()::story-summary::phaseOfLife', phaseOfLife)
469470
break
470471
case interests?.length:
471472
action = `ask about a different interest from: ${ interests }`
472-
console.log('mRunFunctions()::story-summary::interests', interests)
473473
break
474474
default:
475475
action = 'ask about another event in member\'s life'
@@ -478,6 +478,7 @@ async function mRunFunctions(openai, run, factory, avatar){ // add avatar ref
478478
success = true
479479
} // error cascades
480480
confirmation.output = JSON.stringify({ action, success, })
481+
console.log('mRunFunctions()::storySummary()::end', story.id)
481482
return confirmation
482483
case 'updatesummary':
483484
case 'update_summary':
@@ -486,6 +487,11 @@ async function mRunFunctions(openai, run, factory, avatar){ // add avatar ref
486487
const { summary: updatedSummary, } = toolArguments
487488
// remove await once confirmed updates are connected
488489
await factory.updateItem({ id: itemId, summary: updatedSummary, })
490+
avatar.frontendInstruction = {
491+
command: 'updateItemSummary',
492+
itemId,
493+
summary: updatedSummary,
494+
}
489495
action=`confirm success and present updated summary to member`
490496
success = true
491497
confirmation.output = JSON.stringify({ action, success, })

inc/json-schemas/intelligences/biographer-intelligence-1.4.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"purpose": "My goal is to specialize in creating, updating, and presenting accurate biographical content for MyLife member <-mFN-> based on our interactions.\n",
1414
"references": [
1515
{
16-
"default": "as yet unknown, please evince at start of process",
16+
"default": "ERROR loading preferences, gather interests directly from member",
1717
"description": "interests are h2 (##) in prefix so that they do not get lost in context window shortening",
1818
"insert": "## interests",
1919
"method": "append-hard",
@@ -46,5 +46,6 @@
4646
"name": "instructions-personal-biographer-bot",
4747
"purpose": "To be a biographer bot for requesting member",
4848
"type": "personal-biographer",
49+
"$comments": "20240919 updated error return without version update",
4950
"version": 1.4
5051
}

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import chalk from 'chalk'
1313
/* local service imports */
1414
import MyLife from './inc/js/mylife-agent-factory.mjs'
1515
/** variables **/
16-
const version = '0.0.21'
16+
const version = '0.0.22'
1717
const app = new Koa()
1818
const port = process.env.PORT ?? '3000'
1919
const __filename = fileURLToPath(import.meta.url)

views/assets/css/bots.css

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,24 +150,20 @@
150150
overflow-x: hidden;
151151
overflow-y: auto; /* Enable vertical scrolling */
152152
}
153-
/* Styles the scrollbar itself */
154153
.bot-options::-webkit-scrollbar,
155154
.checkbox-group::-webkit-scrollbar {
156155
width: 6px; /* Adjust the width of the scrollbar */
157156
}
158-
/* Styles the track of the scrollbar */
159157
.bot-options::-webkit-scrollbar-track,
160158
.checkbox-group::-webkit-scrollbar-track {
161159
background: rgba(0, 0, 0, 0.1); /* Color of the track */
162160
border-radius: 10px; /* Optional: adds rounded corners to the track */
163161
}
164-
/* Styles the handle (thumb) of the scrollbar */
165162
.bot-options::-webkit-scrollbar-thumb,
166163
.checkbox-group::-webkit-scrollbar-thumb {
167164
background: rgba(232, 226, 183, .5); /* Color of the thumb */
168165
border-radius: 10px; /* Optional: adds rounded corners to the thumb */
169166
}
170-
/* Changes the color of the thumb when hovered over or clicked */
171167
.bot-options::-webkit-scrollbar-thumb:hover,
172168
.checkbox-group::-webkit-scrollbar-thumb:hover {
173169
background: rgba(214, 198, 75, 0.5); /* Darker shade on hover */
@@ -238,6 +234,15 @@
238234
margin-right: 0.8rem;
239235
max-width: 50%;
240236
}
237+
.mylife-widget.bots {
238+
flex-direction: column;
239+
justify-content: flex-start;
240+
max-width: 100%;
241+
}
242+
.publicity-toggle-view-icon {
243+
cursor: default;
244+
font-size: 1.25rem;
245+
}
241246
.ticker {
242247
background: radial-gradient(at top left, darkgray, black); /* Radial gradient background */
243248
border: thin solid rgba(255, 255, 255, 0.5); /* Thin white border with 50% opacity */
@@ -261,11 +266,6 @@
261266
animation: none;
262267
padding: 0;
263268
}
264-
.mylife-widget.bots {
265-
flex-direction: column;
266-
justify-content: flex-start;
267-
max-width: 100%;
268-
}
269269
/* bot-collections */
270270
.collection {
271271
background-color: royalblue;
@@ -440,7 +440,8 @@
440440
justify-content: space-between;
441441
width: 100%;
442442
}
443-
.passphrase-reset {
443+
.passphrase-reset,
444+
.tutorial-button {
444445
width: 100%;
445446
}
446447
/* publicity sliders */

views/assets/html/_bots.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
<span id="personal-avatar-publicity-slider" class="publicity-slider"></span>
2929
<label id="personal-avatar-publicity-public-label" class="publicity-label" data-checked-value="true">Public</label>
3030
</div>
31-
<span id="personal-avatar-publicity-toggle-view-icon" class="fas fa-eye publicity-toggle-view-icon"></span>
31+
<span id="personal-avatar-publicity-toggle-view-icon" class="fas fa-eye-slash publicity-toggle-view-icon"></span>
3232
</div>
33+
<button id="personal-avatar-tutorial" class="button tutorial-button">Run Tutorial</button>
3334
</div>
3435
</div>
3536
<div id="team-header" class="header team-header">
@@ -147,7 +148,12 @@
147148
</div>
148149
</div>
149150
<!-- bot buttons
150-
<button class="button bot-start" id="personal-biographer-start">Let's get started!</button>-->
151+
<button class="button bot-start" id="personal-biographer-start">Let's get started!</button>
152+
<div id="personal-biographer-retire" class="retire">
153+
Retire this:
154+
<span id="personal-biographer-retire-icon" class="fas fa-retire retire-icon">CHAT</span>
155+
<span id="personal-biographer-retire-text" class="retire-text">BOT</span>-->
156+
</div>
151157
</div>
152158
</div>
153159
<div class="bot-container" id="journaler">

views/assets/js/bots.mjs

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
addMessage,
66
addMessages,
77
decorateActiveBot,
8+
experiences,
89
expunge,
910
fetchSummary,
1011
getActiveItemId,
@@ -13,6 +14,7 @@ import {
1314
setActiveItem,
1415
setActiveItemTitle,
1516
show,
17+
startExperience,
1618
submit,
1719
toggleMemberInput,
1820
toggleVisibility,
@@ -123,7 +125,8 @@ function getBot(type='personal-avatar', id){
123125
* @returns {object} - The collection item object.
124126
*/
125127
function getItem(id){
126-
/* return collection item by id */
128+
/* return collection elements by id */
129+
127130
}
128131
/**
129132
* Refresh designated collection from server. **note**: external calls denied option to identify collectionList parameter, ergo must always be of same type.
@@ -205,6 +208,19 @@ function togglePopup(id, bForceState=null){
205208
throw new Error(`No popup found for id: ${ id }`)
206209
toggleVisibility(popup, bForceState)
207210
}
211+
/**
212+
* Update collection item title.
213+
* @todo - Only update local memory and data(sets), not full local refresh
214+
* @param {object} item - The collection item fields to update, requires `{ itemId, }`
215+
* @returns {void}
216+
*/
217+
function updateItem(item){
218+
if(!item?.itemId)
219+
throw new Error(`No item provided to update.`)
220+
/* update collection elements indicated as object keys with this itemId */
221+
// @stub - force-refresh memories; could be more savvy
222+
refreshCollection('story')
223+
}
208224
/**
209225
* Proxy to update bot-bar, bot-containers, and bot-greeting, if desired. Requirements should come from including module, here `members.mjs`.
210226
* @public
@@ -317,7 +333,7 @@ function mBotIcon(type){
317333
*/
318334
function mCreateCollectionItem(collectionItem){
319335
/* collection item container */
320-
const { assistantType, filename, form, id, keywords, library_id, name, summary, title, type, } = collectionItem
336+
const { assistantType, filename, form, id, keywords, name, summary, title, type, } = collectionItem
321337
const item = document.createElement('div')
322338
item.id = `collection-item_${ id }`
323339
item.name = `collection-item-${ type }`
@@ -1698,6 +1714,7 @@ function mToggleSwitchPrivacy(event){
16981714
let { id, } = this
16991715
id = id.replace('-toggle', '') // remove toggle
17001716
const type = mGlobals.HTMLIdToType(id)
1717+
console.log('mToggleSwitchPrivacy', type)
17011718
const publicityCheckbox = document.getElementById(`${ type }-publicity-input`)
17021719
const viewIcon = document.getElementById(`${ type }-publicity-toggle-view-icon`)
17031720
const { checked=false, } = publicityCheckbox
@@ -1851,6 +1868,21 @@ function mUpdateBotContainerAddenda(botContainer){
18511868
}
18521869
})
18531870
}
1871+
/* publicity */
1872+
const publicityToggle = document.getElementById(`${ type }-publicity-toggle`)
1873+
if(publicityToggle){
1874+
publicityToggle.addEventListener('click', mToggleSwitchPrivacy)
1875+
const publicityToggleView = document.getElementById(`${ type }-publicity-toggle-view-icon`)
1876+
if(publicityToggleView){
1877+
const { checked=false, } = document.getElementById(`${ type }-publicity-input`) ?? {}
1878+
mToggleClass(publicityToggleView, !checked ? ['fa-eye-slash'] : ['fa-eye'], checked ? ['fa-eye'] : ['fa-eye-slash'])
1879+
publicityToggleView.addEventListener('click', event=>{
1880+
// @note - shouldn't be required, but container masters the switch
1881+
event.stopImmediatePropagation()
1882+
event.stopPropagation()
1883+
})
1884+
}
1885+
}
18541886
switch(type){
18551887
case 'diary':
18561888
case 'journaler':
@@ -1860,6 +1892,18 @@ function mUpdateBotContainerAddenda(botContainer){
18601892
/* attach avatar listeners */
18611893
/* set additional data attributes */
18621894
mTogglePassphrase(false) /* passphrase */
1895+
const tutorialButton = document.getElementById('personal-avatar-tutorial')
1896+
if(tutorialButton){
1897+
if(experiences().length){
1898+
show(tutorialButton)
1899+
tutorialButton.addEventListener('click', async event=>{
1900+
hide(tutorialButton)
1901+
const tutorialId = 'aae28fe4-30f9-4c29-9174-a0616569e762'
1902+
startExperience(tutorialId) // no await
1903+
}, { once: true })
1904+
} else
1905+
hide(tutorialButton)
1906+
}
18631907
break
18641908
default:
18651909
break
@@ -2123,5 +2167,6 @@ export {
21232167
refreshCollection,
21242168
setActiveBot,
21252169
togglePopup,
2170+
updateItem,
21262171
updatePageBots,
21272172
}

views/assets/js/experience.mjs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,9 @@ async function experiencePlay(memberInput){
170170
* Retrieve full or scoped list of experiences from server.
171171
* @todo - more robust logic underpinning selection of experiences, currently only system-controlled exist.
172172
* @requires mExperiences
173-
* @param {string} scope - The scope of the experiences to retrieve.
174-
* @returns {Promise<Experience[]>} - The return is an array of Experience objects.
173+
* @returns {Experience[]} - The return is an array of Experience objects.
175174
*/
176-
async function experiences(scope){
177-
if(!mExperiences.length)
178-
mExperiences.push(...await mGetExperiences(scope))
175+
function experiences(scope){
179176
return mExperiences
180177
}
181178
/**
@@ -196,8 +193,8 @@ function experienceSkip(sceneId){
196193
/**
197194
* Start experience onscreen, displaying welcome ande loading remaining data.
198195
* @public
199-
* @param {Guid} experienceId - The Experience object.
200-
* @returns {Promise<void>} - The return is its own success.
196+
* @param {Guid} experienceId - The Experience id
197+
* @returns {Promise<void>}
201198
*/
202199
async function experienceStart(experienceId){
203200
if(!globals.isGuid(experienceId))

0 commit comments

Comments
 (0)