Skip to content

Commit bc4566f

Browse files
author
linyuan.yang
committed
memory 模块改名 note
1 parent 48492bf commit bc4566f

50 files changed

Lines changed: 550 additions & 550 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/admin/src/components/SessionConfigOverridesEditor.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { ApprovalTimeoutValue } from 'sbot.commons'
55
66
/**
77
* profile 上的可覆盖配置字段。null = 跟随 ChannelConfig 默认值。
8-
* memories/wikis 使用数组形式(提交时父组件负责 JSON.stringify)。
8+
* notes/wikis 使用数组形式(提交时父组件负责 JSON.stringify)。
99
*/
1010
export interface SessionOverrides {
1111
agentId: string | null
1212
saver: string | null
13-
memories: string[] | null
13+
notes: string[] | null
1414
wikis: string[] | null
15-
useChannelMemories: boolean | null
15+
useChannelNotes: boolean | null
1616
useChannelWikis: boolean | null
1717
workPath: string | null
1818
streamVerbose: boolean | null
@@ -37,7 +37,7 @@ const props = defineProps<{
3737
resolved?: Partial<Record<keyof SessionOverrides, any>>
3838
agentOptions: Option[]
3939
saverOptions: Option[]
40-
memoryOptions: Option[]
40+
noteOptions: Option[]
4141
wikiOptions: Option[]
4242
modelOptions: Option[]
4343
}>()
@@ -97,10 +97,10 @@ const fmtApprovalValue = (v: any) => v === ApprovalTimeoutValue.Allow ? t('chann
9797
</SSelect>
9898
</SFormItem>
9999

100-
<SFormItem :label="t('common.memory')" :hint="inheritLabel('memories', fmtList)">
101-
<SMultiSelect :model-value="modelValue.memories ?? []" :options="memoryOptions" @update:model-value="v => update('memories', v as string[])" />
102-
<SFormItem :label="t('channels.use_channel_memories')" :hint="t('channels.use_channel_memories_hint')" class="nested-form-item">
103-
<SSelect :model-value="modelValue.useChannelMemories === null ? '' : String(modelValue.useChannelMemories)" @update:model-value="v => update('useChannelMemories', v === '' ? null : v === 'true')">
100+
<SFormItem :label="t('common.note')" :hint="inheritLabel('notes', fmtList)">
101+
<SMultiSelect :model-value="modelValue.notes ?? []" :options="noteOptions" @update:model-value="v => update('notes', v as string[])" />
102+
<SFormItem :label="t('channels.use_channel_notes')" :hint="t('channels.use_channel_notes_hint')" class="nested-form-item">
103+
<SSelect :model-value="modelValue.useChannelNotes === null ? '' : String(modelValue.useChannelNotes)" @update:model-value="v => update('useChannelNotes', v === '' ? null : v === 'true')">
104104
<option value="">{{ t('channels.use_channel_default') }}</option>
105105
<option value="true">{{ t('common.enabled') }}</option>
106106
<option value="false">{{ t('common.disabled') }}</option>

packages/admin/src/layouts/Layout.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const menuGroups = computed(() => [
9191
group: t('nav.group_storage'),
9292
items: [
9393
{ label: t('nav.savers'), key: '/savers' },
94-
{ label: t('nav.memories'), key: '/memories' },
94+
{ label: t('nav.notes'), key: '/notes' },
9595
{ label: t('nav.wikis'), key: '/wikis' },
9696
],
9797
},
@@ -132,7 +132,7 @@ const activeKey = computed(() => {
132132
const p = route.path
133133
if (p.startsWith('/agents/')) return '/agents'
134134
if (p.startsWith('/savers/') && p.endsWith('/view')) return '/savers'
135-
if (p.startsWith('/memories/') && p.endsWith('/view')) return '/memories'
135+
if (p.startsWith('/notes/') && p.endsWith('/view')) return '/notes'
136136
return p
137137
})
138138

packages/admin/src/router/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const routes = [
1515
{ path: '/agents', component: () => import('@/views/agents/AgentsView.vue') },
1616
{ path: '/agent-store', component: () => import('@/views/agents/AgentStoreView.vue') },
1717
{ path: '/savers', component: () => import('@/views/savers/SaversView.vue') },
18-
{ path: '/memories', component: () => import('@/views/memory/MemoriesView.vue') },
19-
{ path: '/wikis', component: () => import('@/views/memory/WikisView.vue') },
18+
{ path: '/notes', component: () => import('@/views/note/NotesView.vue') },
19+
{ path: '/wikis', component: () => import('@/views/note/WikisView.vue') },
2020
{ path: '/mcp', component: () => import('@/views/runtime/McpView.vue') },
2121
{ path: '/skills', component: () => import('@/views/runtime/SkillsView.vue') },
2222
{ path: '/prompts', component: () => import('@/views/runtime/PromptsView.vue') },

packages/admin/src/views/memory/MemoryViewModal.vue renamed to packages/admin/src/views/note/NoteViewModal.vue

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ import { useI18n } from 'vue-i18n'
44
import { apiFetch } from '@/shared/api'
55
import { useToast, useConfirm } from 'sbot-ui'
66
import { SModal, SButton, SBadge, SFormItem, SInput, STextarea, SCheckCard, STable, type STableColumn } from 'sbot-ui'
7-
import type { MemoryItem, MemoryConfig } from '@/shared/types'
7+
import type { NoteItem, NoteConfig } from '@/shared/types'
88
99
const { t } = useI18n()
1010
const { show } = useToast()
1111
const { confirm } = useConfirm()
1212
1313
const columns = computed<STableColumn[]>(() => [
14-
{ key: 'content', label: t('memories.content_col'), primary: true, ellipsis: true },
15-
{ key: 'createdAt', label: t('memories.created_col'), width: '150px', ellipsis: true },
16-
{ key: 'accessCount', label: t('memories.access_count_col'), width: '60px', align: 'center' },
17-
{ key: 'lastAccessed', label: t('memories.last_accessed_col'), width: '150px', ellipsis: true },
18-
{ key: 'ops', label: t('common.ops'), width: '140px', align: 'center', ops: true },
14+
{ key: 'content', label: t('notes.content_col'), primary: true, ellipsis: true },
15+
{ key: 'createdAt', label: t('notes.created_col'), width: '150px', ellipsis: true },
16+
{ key: 'accessCount', label: t('notes.access_count_col'), width: '60px', align: 'center' },
17+
{ key: 'lastAccessed', label: t('notes.last_accessed_col'), width: '150px', ellipsis: true },
18+
{ key: 'ops', label: t('common.ops'), width: '140px', align: 'center', ops: true },
1919
])
2020
21-
const visible = ref(false)
22-
const memoryId = ref('')
23-
const memoryConfig = ref<Partial<MemoryConfig>>({})
24-
const memories = ref<MemoryItem[]>([])
25-
const loading = ref(false)
21+
const visible = ref(false)
22+
const noteId = ref('')
23+
const noteConfig = ref<Partial<NoteConfig>>({})
24+
const notes = ref<NoteItem[]>([])
25+
const loading = ref(false)
2626
2727
const showAddModal = ref(false)
2828
const addContent = ref('')
@@ -35,15 +35,15 @@ const editId = ref('')
3535
const editContent = ref('')
3636
const saving = ref(false)
3737
38-
function memUrl(path = '') {
39-
return `/api/memories/${encodeURIComponent(memoryId.value)}${path}`
38+
function noteUrl(path = '') {
39+
return `/api/notes/${encodeURIComponent(noteId.value)}${path}`
4040
}
4141
4242
async function load() {
4343
loading.value = true
4444
try {
45-
const res = await apiFetch(memUrl())
46-
memories.value = res.data || []
45+
const res = await apiFetch(noteUrl())
46+
notes.value = res.data || []
4747
} catch (e: any) {
4848
show(e.message, 'error')
4949
} finally {
@@ -53,7 +53,7 @@ async function load() {
5353
5454
async function remove(id: string) {
5555
try {
56-
await apiFetch(memUrl(`/${encodeURIComponent(id)}`), 'DELETE')
56+
await apiFetch(noteUrl(`/${encodeURIComponent(id)}`), 'DELETE')
5757
show(t('common.deleted'))
5858
await load()
5959
} catch (e: any) {
@@ -62,10 +62,10 @@ async function remove(id: string) {
6262
}
6363
6464
async function clearAll() {
65-
if (!await confirm(t('memories.confirm_clear', { name: memoryConfig.value.name || memoryId.value }), { danger: true })) return
65+
if (!await confirm(t('notes.confirm_clear', { name: noteConfig.value.name || noteId.value }), { danger: true })) return
6666
try {
67-
await apiFetch(memUrl(), 'DELETE')
68-
memories.value = []
67+
await apiFetch(noteUrl(), 'DELETE')
68+
notes.value = []
6969
} catch (e: any) {
7070
show(e.message, 'error')
7171
}
@@ -79,15 +79,15 @@ function openAdd() {
7979
}
8080
8181
async function confirmAdd() {
82-
if (!addContent.value.trim()) { show(t('memories.error_content'), 'error'); return }
82+
if (!addContent.value.trim()) { show(t('notes.error_content'), 'error'); return }
8383
adding.value = true
8484
try {
85-
const res = await apiFetch(memUrl('/add'), 'POST', {
85+
const res = await apiFetch(noteUrl('/add'), 'POST', {
8686
content: addContent.value.trim(),
8787
autoSplit: autoSplit.value,
8888
chunkSize: autoSplit.value ? chunkSize.value : undefined,
8989
})
90-
show(t('memories.added_count', { count: res.data?.ids?.length ?? 0 }))
90+
show(t('notes.added_count', { count: res.data?.ids?.length ?? 0 }))
9191
showAddModal.value = false
9292
await load()
9393
} catch (e: any) {
@@ -97,17 +97,17 @@ async function confirmAdd() {
9797
}
9898
}
9999
100-
function openEdit(row: MemoryItem) {
100+
function openEdit(row: NoteItem) {
101101
editId.value = row.id
102102
editContent.value = row.content
103103
showEditModal.value = true
104104
}
105105
106106
async function confirmEdit() {
107-
if (!editContent.value.trim()) { show(t('memories.error_content'), 'error'); return }
107+
if (!editContent.value.trim()) { show(t('notes.error_content'), 'error'); return }
108108
saving.value = true
109109
try {
110-
await apiFetch(memUrl(`/${encodeURIComponent(editId.value)}`), 'PUT', { content: editContent.value.trim() })
110+
await apiFetch(noteUrl(`/${encodeURIComponent(editId.value)}`), 'PUT', { content: editContent.value.trim() })
111111
show(t('common.saved'))
112112
showEditModal.value = false
113113
await load()
@@ -118,11 +118,11 @@ async function confirmEdit() {
118118
}
119119
}
120120
121-
function open(id: string, config: Partial<MemoryConfig>) {
122-
memoryId.value = id
123-
memoryConfig.value = config
124-
memories.value = []
125-
visible.value = true
121+
function open(id: string, config: Partial<NoteConfig>) {
122+
noteId.value = id
123+
noteConfig.value = config
124+
notes.value = []
125+
visible.value = true
126126
load()
127127
}
128128
@@ -133,29 +133,29 @@ defineExpose({ open })
133133
<SModal v-model:visible="visible" width="xl">
134134
<template #header>
135135
<div style="display:flex;align-items:center;gap:10px">
136-
<h3 class="s-modal-title">{{ t('memories.content_title') }}</h3>
137-
<SBadge variant="neutral" size="sm">{{ memoryConfig.name || memoryId }}</SBadge>
138-
<span v-if="!loading" class="mem-count-badge">{{ t('memories.count', { count: memories.length }) }}</span>
136+
<h3 class="s-modal-title">{{ t('notes.content_title') }}</h3>
137+
<SBadge variant="neutral" size="sm">{{ noteConfig.name || noteId }}</SBadge>
138+
<span v-if="!loading" class="note-count-badge">{{ t('notes.count', { count: notes.length }) }}</span>
139139
</div>
140140
</template>
141141

142142
<template #toolbar>
143143
<SButton type="outline" size="sm" :disabled="loading" @click="load">
144144
{{ loading ? t('common.loading') : t('common.refresh') }}
145145
</SButton>
146-
<SButton type="primary" size="sm" @click="openAdd">{{ t('memories.add_memory') }}</SButton>
147-
<SButton type="danger" size="sm" style="margin-left:auto" :disabled="memories.length === 0" @click="clearAll">
148-
{{ t('memories.clear_all') }}
146+
<SButton type="primary" size="sm" @click="openAdd">{{ t('notes.add_note') }}</SButton>
147+
<SButton type="danger" size="sm" style="margin-left:auto" :disabled="notes.length === 0" @click="clearAll">
148+
{{ t('notes.clear_all') }}
149149
</SButton>
150150
</template>
151151

152152
<STable
153153
:columns="columns"
154-
:rows="memories"
154+
:rows="notes"
155155
row-key="id"
156156
:loading="loading"
157157
:loading-text="t('common.loading')"
158-
:empty-text="t('memories.no_memories')"
158+
:empty-text="t('notes.no_notes')"
159159
>
160160
<template #content="{ row }">
161161
<span :title="row.content">{{ row.content }}</span>
@@ -176,27 +176,27 @@ defineExpose({ open })
176176
</STable>
177177
</SModal>
178178

179-
<!-- Add memory modal (nested) -->
180-
<SModal v-model:visible="showAddModal" :title="t('memories.add_memory_title')" width="sm" nested>
181-
<SFormItem :label="t('memories.memory_content')">
182-
<STextarea v-model="addContent" :rows="7" :placeholder="t('memories.memory_placeholder')" />
179+
<!-- Add note modal (nested) -->
180+
<SModal v-model:visible="showAddModal" :title="t('notes.add_note_title')" width="sm" nested>
181+
<SFormItem :label="t('notes.note_content')">
182+
<STextarea v-model="addContent" :rows="7" :placeholder="t('notes.note_placeholder')" />
183183
</SFormItem>
184-
<SCheckCard v-model="autoSplit" style="margin-top:8px">{{ t('memories.auto_split') }}</SCheckCard>
185-
<SFormItem v-if="autoSplit" :label="t('memories.chunk_size')" style="margin-top:8px">
186-
<SInput v-model.number="chunkSize" type="number" min="50" :placeholder="t('memories.chunk_size_placeholder')" />
184+
<SCheckCard v-model="autoSplit" style="margin-top:8px">{{ t('notes.auto_split') }}</SCheckCard>
185+
<SFormItem v-if="autoSplit" :label="t('notes.chunk_size')" style="margin-top:8px">
186+
<SInput v-model.number="chunkSize" type="number" min="50" :placeholder="t('notes.chunk_size_placeholder')" />
187187
</SFormItem>
188188
<template #footer>
189189
<SButton type="outline" :disabled="adding" @click="showAddModal = false">{{ t('common.cancel') }}</SButton>
190190
<SButton type="primary" :disabled="adding" :loading="adding" @click="confirmAdd">
191-
{{ adding ? t('memories.adding') : t('memories.add_btn') }}
191+
{{ adding ? t('notes.adding') : t('notes.add_btn') }}
192192
</SButton>
193193
</template>
194194
</SModal>
195195

196-
<!-- Edit memory modal (nested) -->
197-
<SModal v-model:visible="showEditModal" :title="t('memories.edit_memory_title')" width="sm" nested>
198-
<SFormItem :label="t('memories.memory_content')">
199-
<STextarea v-model="editContent" :rows="7" :placeholder="t('memories.memory_placeholder')" />
196+
<!-- Edit note modal (nested) -->
197+
<SModal v-model:visible="showEditModal" :title="t('notes.edit_note_title')" width="sm" nested>
198+
<SFormItem :label="t('notes.note_content')">
199+
<STextarea v-model="editContent" :rows="7" :placeholder="t('notes.note_placeholder')" />
200200
</SFormItem>
201201
<template #footer>
202202
<SButton type="outline" :disabled="saving" @click="showEditModal = false">{{ t('common.cancel') }}</SButton>
@@ -208,7 +208,7 @@ defineExpose({ open })
208208
</template>
209209

210210
<style scoped>
211-
.mem-count-badge {
211+
.note-count-badge {
212212
font-size: var(--sui-fs-sm);
213213
color: var(--sui-fg-disabled);
214214
}

0 commit comments

Comments
 (0)