@@ -17,6 +17,7 @@ const { isMobile } = useResponsive()
1717interface PluginInfo {
1818 type: string
1919 label: string
20+ builtin: boolean
2021 configSchema: Record <string , { label: string ; type: string ; required? : boolean ; description? : string ; default? : string | boolean | number ; options? : Array <{ label: string ; value: string }> }>
2122}
2223
@@ -156,9 +157,6 @@ function formatTokens(n: number): string {
156157 return n .toLocaleString ()
157158}
158159
159- function threadId(channelId : string , c : any , sessionId : string ): string {
160- return ` ${c .type }_${channelId }_${sessionId } `
161- }
162160
163161const showModal = ref (false )
164162const editingId = ref <string | null >(null )
@@ -304,7 +302,8 @@ async function waitForQRConfirm(key: string, channelId: string | null, type: str
304302function openAdd() {
305303 editingId .value = null
306304 clearActionState ()
307- form .value = { name: ' ' , type: plugins .value [0 ]?.type || ' ' , config: {}, agent: ' ' , saver: ' ' , memories: [], wikis: [], workPath: ' ' , streamVerbose: false , autoApproveAllTools: false , intentModel: ' ' , intentPrompt: ' ' , intentThreshold: 0.7 , mergeWindow: 0 }
305+ const defaultType = plugins .value .find (p => ! p .builtin )?.type || ' '
306+ form .value = { name: ' ' , type: defaultType , config: {}, agent: ' ' , saver: ' ' , memories: [], wikis: [], workPath: ' ' , streamVerbose: false , autoApproveAllTools: false , intentModel: ' ' , intentPrompt: ' ' , intentThreshold: 0.7 , mergeWindow: 0 }
308307 showModal .value = true
309308}
310309
@@ -368,6 +367,12 @@ async function save() {
368367 }
369368}
370369
370+ function isBuiltin(id : string ): boolean {
371+ const c = channels .value [id ]
372+ if (! c ) return false
373+ return plugins .value .some (p => p .type === c .type && p .builtin )
374+ }
375+
371376async function remove(id : string ) {
372377 const c = channels .value [id ]
373378 const label = c ?.name || id
@@ -417,7 +422,7 @@ async function refresh() {
417422 <div class =" channel-card-right" @click.stop >
418423 <span class =" channel-card-agent" >{{ agentOptions.find(a => a.id === c.agent)?.label || c.agent || '-' }}</span >
419424 <button class =" btn-outline btn-sm" @click =" openEdit(id as string)" >{{ t('common.edit') }}</button >
420- <button class =" btn-danger btn-sm" @click =" remove(id as string)" >{{ t('common.delete') }}</button >
425+ <button v-if = " !isBuiltin(id as string) " class =" btn-danger btn-sm" @click =" remove(id as string)" >{{ t('common.delete') }}</button >
421426 </div >
422427 </div >
423428 <!-- Card meta -->
@@ -461,7 +466,7 @@ async function refresh() {
461466 <span v-if =" s.totalTokens > 0" class =" session-item-tokens" :title =" `${t('usage.total')}: ${formatTokens(s.totalTokens)} tokens\n ${t('usage.input_tokens')}: ${formatTokens(s.inputTokens)} / ${t('usage.output_tokens')}: ${formatTokens(s.outputTokens)}` + (s.lastTotalTokens > 0 ? `\n${t('usage.last')}: ${formatTokens(s.lastTotalTokens)} tokens` : '')" >{{ formatTokens(s.totalTokens) }} tok</span >
462467 </div >
463468 <div class =" ops-cell" >
464- <button v-if =" s.saver || c.saver" class =" btn-outline btn-sm" @click =" saverViewModal?.open (s.saver || c.saver , saverOptions.find(o => o.id === (s.saver || c.saver))?.label || (s.saver || c.saver), threadId(id as string, c, s.sessionId ))" >{{ t('channels.history') }}</button >
469+ <button v-if =" s.saver || c.saver" class =" btn-outline btn-sm" @click =" saverViewModal?.openByDbId (s.id , saverOptions.find(o => o.id === (s.saver || c.saver))?.label || (s.saver || c.saver))" >{{ t('channels.history') }}</button >
465470 <button class =" btn-outline btn-sm" @click =" openEditSession(s)" >{{ t('common.edit') }}</button >
466471 <button class =" btn-danger btn-sm" @click =" removeSession(id as string, s)" >{{ t('common.delete') }}</button >
467472 </div >
@@ -523,7 +528,7 @@ async function refresh() {
523528 </div >
524529 <div class =" mobile-card-ops" >
525530 <button class =" btn-outline btn-sm" @click =" openEdit(id as string)" >{{ t('common.edit') }}</button >
526- <button class =" btn-danger btn-sm" @click =" remove(id as string)" >{{ t('common.delete') }}</button >
531+ <button v-if = " !isBuiltin(id as string) " class =" btn-danger btn-sm" @click =" remove(id as string)" >{{ t('common.delete') }}</button >
527532 </div >
528533 <!-- Expandable detail -->
529534 <div v-if =" expandedChannels[id as string]" style =" margin-top :10px " >
@@ -597,7 +602,7 @@ async function refresh() {
597602 <div class =" form-group" >
598603 <label >{{ t('channels.channel_type') }} *</label >
599604 <select v-model =" form.type" @change =" form.config = {}" :disabled =" !!editingId" >
600- <option v-for =" p in plugins" :key =" p.type" :value =" p.type" >{{ p.label }}</option >
605+ <option v-for =" p in plugins.filter(p => !p.builtin || editingId) " :key =" p.type" :value =" p.type" >{{ p.label }}</option >
601606 </select >
602607 </div >
603608 <div class =" form-group" >
0 commit comments