diff --git a/addons/internal/uibuild/kitstub.mjs b/addons/internal/uibuild/kitstub.mjs index c41fd8101f..795e60a635 100644 --- a/addons/internal/uibuild/kitstub.mjs +++ b/addons/internal/uibuild/kitstub.mjs @@ -3,7 +3,7 @@ // (core/http/react-ui/src/addons/hostComponents.jsx); these keep the same // props and draw plain markup with the test ids, so a test can check what an // add-on asks the host to draw without the host's build. -export const KIT = ['Section', 'Field', 'Select', 'TextInput', 'Switch', 'Choice', 'Callout', 'StatusChip', 'List', 'ListRow', 'Code', 'Actions', 'Table', 'ExternalLink'] +export const KIT = ['Section', 'Field', 'Select', 'TextInput', 'Switch', 'Choice', 'Callout', 'Notice', 'StatusChip', 'List', 'ListRow', 'Code', 'Actions', 'Table', 'ExternalLink'] export function kitStubs(React) { const h = React.createElement @@ -18,6 +18,7 @@ export function kitStubs(React) { (p.options || []).map(o => h('label', { key: o.value, 'data-value': o.value, 'data-selected': p.value === o.value ? '' : undefined }, h('input', { type: 'radio', checked: p.value === o.value, onChange: () => {}, disabled: o.disabled }), o.label, o.chip || null, o.description ? h('span', null, o.description) : null))), Callout: (p) => h('div', { 'data-kit': 'Callout', 'data-tone': p.tone || 'info', role: p.role, ...tid(p) }, p.title ? h('strong', null, p.title) : null, p.children, p.actions || null), + Notice: (p) => h('div', { 'data-kit': 'Notice', 'data-severity': p.severity || 'info', role: 'note', ...tid(p) }, p.title ? h('strong', null, p.title) : null, p.reason ? h('p', null, p.reason) : null, p.fixLabel ? h('button', { type: 'button', onClick: p.onFix }, p.fixLabel) : null, p.children), StatusChip: (p) => h('span', { 'data-kit': 'StatusChip', 'data-tone': p.tone || 'idle', ...tid(p) }, p.children), List: (p) => h('ul', { 'data-kit': 'List', 'aria-label': p.label, ...tid(p) }, p.children), ListRow: (p) => h('li', { 'data-kit': 'ListRow', ...tid(p) }, h('strong', null, p.title), p.status || null, p.meta ? h('span', null, p.meta) : null, p.children, diff --git a/addons/memory/ui/src/index.jsx b/addons/memory/ui/src/index.jsx index 439c41644c..a3a9ea79b6 100644 --- a/addons/memory/ui/src/index.jsx +++ b/addons/memory/ui/src/index.jsx @@ -9,6 +9,8 @@ // validates it. The rules that make it safe are the host's: this page only // states them. export const NOTES_ADDRESS = '/app/account?tab=memory' +// Memory is built in; the save level lives in Settings > Memory. +export const SETTINGS_ADDRESS = '/app/account?tab=memory' export const SAVE_MODE_KEY = 'save-mode' export const SAVE_MODES = ['ask', 'auto', 'never'] @@ -23,6 +25,9 @@ export function createAddon(sdk) { 'memory.rules.scopes': 'There are three kinds of notes: yours for every chat, one for each saved agent, and one for each conversation that comes from a messaging app. A saved agent reads notes only when you allow this add-on for it.', 'memory.rules.limits': 'The model reads a short list, at most 40 lines for each kind, and opens a topic when it needs the details.', 'memory.open': 'Open my notes', + 'memory.builtin.title': 'Memory is built in', + 'memory.builtin.reason': 'Memory is part of LocalAI now, and you do not need this add-on for it. Choose how notes are saved in Settings > Memory.', + 'memory.builtin.fix': 'Open Settings > Memory', 'memory.save.title': 'Saving a note', 'memory.save.legend': 'When the assistant wants to save something to my memory', 'memory.save.ask': 'Ask me first', @@ -86,11 +91,22 @@ export function createAddon(sdk) { failed ? h(sdk.ui.Callout, { tone: 'warning', role: 'alert', testId: 'memory-save-failed' }, t('memory.save.failed')) : null) } + // Memory is part of the host now. Older hosts have no Notice; they get the + // Callout with the same words. + function BuiltinNotice() { + const open = () => sdk.navigation.openApp(SETTINGS_ADDRESS) + if (sdk.ui.Notice) { + return h(sdk.ui.Notice, { severity: 'info', title: t('memory.builtin.title'), reason: t('memory.builtin.reason'), fixLabel: t('memory.builtin.fix'), onFix: open, testId: 'memory-builtin-notice' }) + } + return h(sdk.ui.Callout, { tone: 'info', title: t('memory.builtin.title'), testId: 'memory-builtin-notice' }, t('memory.builtin.reason')) + } + function Component({ page }) { if (page !== 'memory') return null return (

{t('memory.title')}

+

{t('memory.intro')}