xiaozhi-esp32-server/main/manager-mobile/src/store/plugin.ts
lapy 2be70e8e6c feat(manager-mobile): westernize H5 app, copy, and shared crypto
- English locale defaults; remove duplicate zh-only locale files

- SM2 utility sharing with the web client where applicable
2026-04-25 17:05:15 +01:00

58 lines
1.4 KiB
TypeScript

import type { AgentFunction, PluginDefinition } from '@/api/agent/types'
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const usePluginStore = defineStore(
'plugin',
() => {
// All available plugins
const allFunctions = ref<PluginDefinition[]>([])
// Current agent plugin configuration
const currentFunctions = ref<AgentFunction[]>([])
// Currently editing agent ID
const currentAgentId = ref('')
// Set all available plugins
const setAllFunctions = (functions: PluginDefinition[]) => {
allFunctions.value = functions
}
// Set current agent plugin configuration
const setCurrentFunctions = (functions: AgentFunction[]) => {
currentFunctions.value = functions
}
// Set current agent ID
const setCurrentAgentId = (agentId: string) => {
currentAgentId.value = agentId
}
// Update plugin configuration (called when saving)
const updateFunctions = (functions: AgentFunction[]) => {
currentFunctions.value = functions
}
// Clear data
const clear = () => {
allFunctions.value = []
currentFunctions.value = []
currentAgentId.value = ''
}
return {
allFunctions,
currentFunctions,
currentAgentId,
setAllFunctions,
setCurrentFunctions,
setCurrentAgentId,
updateFunctions,
clear,
}
},
{
persist: false, // Not persistent, reload every time entering page
},
)