feat: add new stores for cron, locale, providers, script, shared data, skills, and user info

- Implemented `cron` store to manage scheduled tasks with CRUD operations.
- Created `locale` store for language settings with persistence and system language detection.
- Added `providers` store to handle provider accounts and configurations with API interactions.
- Developed `script` store for managing automation scripts, including recording and execution.
- Introduced `sharedStore` for managing shared data across components.
- Established `skills` store for fetching, installing, and managing skills from a marketplace.
- Created `userinfo` store for user authentication and session management.

chore: update path aliases from `@store` to `@stores` in TypeScript configuration and Vite config
This commit is contained in:
duanshuwen
2026-04-15 21:49:25 +08:00
parent 364db041eb
commit e77c815a86
32 changed files with 192 additions and 128 deletions

View File

@@ -9,7 +9,7 @@
<script setup lang="ts">
import { onMounted } from 'vue'
import { useThemeStore } from '@src/stores/theme'
import { useLocaleStore } from '@src/store/locale'
import { useLocaleStore } from '@src/stores/locale'
// 初始化主题和语言设置
const themeStore = useThemeStore()

View File

@@ -1,74 +0,0 @@
<template>
<div class="task p-[12px]">
<div class="flex border border-[#BEDBFF] dark:border-[#2a2a2d] h-[48px] p-[4px] rounded-[10px] bg-[#EFF6FF] dark:bg-[#1f1f22] task-tab">
<div v-for="item in tabs" :key="item.value" class="flex-1 flex text-center items-center h-full align-middle text" :class="active === item.value && 'active'" @click="changeTab(item.value)">
<div class="flex-1">{{ item.name }}<span v-if="item.total">{{`${item.total > 98 && item.total + '+' || item.total}`}}</span></div>
</div>
</div>
<div class="flex justify-between mt-[12px] mb-[12px] text-[14px]">
<div class="text-[#171717] dark:text-gray-100">今天</div>
<div class="text-[#99A0AE] dark:text-gray-500">02:32:05</div>
</div>
<div>
<TaskCard />
</div>
</div>
</template>
<script setup lang="ts">
import TaskCard from './Card.vue';
import { ref, reactive } from "vue";
const tabs = reactive([{
name: '待处理',
value: 1,
total: 10,
},{
name: '已处理',
value: 2,
total: 99,
}])
const active = ref(1);
const changeTab = (val:number) => {
active.value = val;
};
</script>
<style scoped>
.task-tab .text {
color: #525866;
font-size: 14px;
cursor: pointer;
}
:global(.dark) .task-tab .text {
color: #9ca3af;
}
.task-tab .active {
position: relative;
color: #2B7FFF;
background: #FFFFFF;
border-radius: 8px;
}
:global(.dark) .task-tab .active {
color: #2B7FFF;
background: #1f1f22;
}
.task-tab .active::after {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
content: '';
border-radius: 8px;
border: 1px solid #2B7FFF;
}
:global(.dark) .task-tab .active::after {
border: 1px solid #2B7FFF;
}
</style>

View File

@@ -1,25 +1,38 @@
<template>
<div class="task-list w-[392px] h-full rounded-[16px] bg-white dark:bg-[#1b1b1d]">
<slot>
<TaskList />
</slot>
<div class="task p-3">
<div class="flex border border-[#BEDBFF] dark:border-[#2a2a2d] h-12 p-1 rounded-[10px] bg-[#EFF6FF] dark:bg-[#1f1f22] task-tab">
<div v-for="item in tabs" :key="item.value" class="flex-1 flex text-center items-center h-full align-middle text" :class="active === item.value && 'active'" @click="changeTab(item.value)">
<div class="flex-1">{{ item.name }}<span v-if="item.total">{{`${item.total > 98 && item.total + '+' || item.total}`}}</span></div>
</div>
</div>
<div class="flex justify-between mt-3 mb-3 text-[14px]">
<div class="text-[#171717] dark:text-gray-100">今天</div>
<div class="text-[#99A0AE] dark:text-gray-500">02:32:05</div>
</div>
<div>
<Card />
</div>
</div>
</template>
<script setup lang="ts">
import TaskList from './List.vue';
import Card from './Card.vue';
import { ref, reactive } from "vue";
const tabs = reactive([{
name: '待处理',
value: 1,
total: 10,
}, {
name: '已处理',
value: 2,
total: 99,
}])
const tabs = reactive([
{
name: '待处理',
value: 1,
total: 10,
},
{
name: '已处理',
value: 2,
total: 99,
}
])
const active = ref(1);
const changeTab = (val: number) => {
const changeTab = (val:number) => {
active.value = val;
};
</script>

View File

@@ -1,5 +1,5 @@
import { useI18n } from 'vue-i18n';
import { useLocaleStore } from '@src/store/locale';
import { useLocaleStore } from '@src/stores/locale';
import { SUPPORTED_LANGUAGES, type LanguageCode, type Namespace } from '@src/i18n/constants';
/**

View File

@@ -192,7 +192,7 @@ import { ref, computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { Plus, Loading, Check, Warning, Close, TopRight } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import { useProviderStore } from '@src/store/providers';
import { useProviderStore } from '@src/stores/providers';
import { PROVIDER_TYPE_INFO, type ProviderTypeInfo } from '@lib/providers';
import type { ProviderListItem } from '@lib/provider-accounts';

View File

@@ -115,7 +115,7 @@ import {
RiErrorWarningLine,
RiTimeLine,
} from '@remixicon/vue';
import { useCronStore } from '@src/store/cron';
import { useCronStore } from '@src/stores/cron';
import type { CronJob, CronJobCreateInput } from '@lib/cron-types';
import CronStats from './components/CronStats.vue';
import CronJobCard from './components/CronJobCard.vue';

View File

@@ -49,8 +49,8 @@
<script setup lang="ts">
import { ref, computed, watch, nextTick, onMounted } from 'vue'
import { useChatStore } from '@store/chat'
import { stageBuffer } from '@store/chat'
import { useChatStore } from '@stores/chat'
import { stageBuffer } from '@stores/chat'
import type { RawMessage, AttachedFileMeta } from './model/ChatModel'
import { extractText, extractImages } from './model/ChatModel'

View File

@@ -90,7 +90,7 @@
<script setup lang="ts">
import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
import { RiSideBarLine, RiSidebarFoldLine, RiAddLine } from '@remixicon/vue'
import { useChatStore } from '@store/chat'
import { useChatStore } from '@stores/chat'
const chatStore = useChatStore()

View File

@@ -1,5 +1,5 @@
<template>
<div class="task p-[12px]">
<div class="task p-3">
<div class="flex border border-[#BEDBFF] dark:border-[#2a2a2d] h-[48px] p-[4px] rounded-[10px] bg-[#EFF6FF] dark:bg-[#222225] task-tab">
<div v-for="item in tabs" :key="item.value" class="flex-1 flex text-center items-center h-full align-middle text" :class="active === item.value && 'active'" @click="changeTab(item.value)">
<div class="flex-1">{{ item.name }}<span v-if="item.total">{{`${item.total > 98 && item.total + '+' || item.total}`}}</span></div>
@@ -15,15 +15,18 @@
<script setup lang="ts">
import { ref, reactive } from "vue";
const tabs = reactive([{
name: '待处理',
value: 1,
total: 10,
},{
name: '已处理',
value: 2,
total: 99,
}])
const tabs = reactive([
{
name: '待处理',
value: 1,
total: 10,
},
{
name: '已处理',
value: 2,
total: 99,
}
])
const active = ref(1);
const changeTab = (val:number) => {
active.value = val;

View File

@@ -144,7 +144,7 @@ import {
extractToolUse,
} from '../../model/ChatModel'
import { useChatStore } from '@store/chat'
import { useChatStore } from '@stores/chat'
import ChatAvatar from '../ChatAvatar.vue'
import ChatAttach from '../ChatAttach.vue'
import ChatAIMark from '../ChatAIMark.vue'

View File

@@ -6,7 +6,7 @@
<ChatBox class="flex-1" />
<TaskCenter />
</div>
<Task class="w-[392px] h-full rounded-[16px] bg-white dark:bg-[#1b1b1d]" />
<TaskList class="w-98 h-full rounded-2xl bg-white dark:bg-[#1b1b1d]" />
</div>
<TaskOperationDialog ref="taskOperationDialog" />
@@ -15,13 +15,13 @@
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue'
import Task from './components/Task.vue'
import TaskList from '../../components/TaskList/index.vue'
import TaskOperationDialog from './components/TaskOperationDialog.vue'
import ChatHistory from './ChatHistory.vue'
import ChatBox from './ChatBox.vue'
import TaskCenter from './TaskCenter.vue'
import { useChatStore } from '@store/chat'
import { useProviderStore } from '@store/providers'
import { useChatStore } from '@stores/chat'
import { useProviderStore } from '@stores/providers'
import emitter from '@src/utils/emitter'
const chatStore = useChatStore()

View File

@@ -45,7 +45,7 @@
<!-- 登录按钮 -->
<button type="button"
class="w-full py-2 bg-blue-600 cursor-pointer text-white rounded-lg hover:bg-blue-700 disabled:bg-blue-300"
class="w-full py-2 bg-blue-600 cursor-pointer text-white rounded-lg hover:bg-blue-700 disabled:bg-blue-300 mt-4"
:loading="loading" @click="onSubmit">
{{ t('login.loginButton') }}
</button>
@@ -65,7 +65,7 @@
<script setup lang="ts">
import { reactive, ref, onMounted, computed } from "vue"
import { useUserStore } from "../../store/userinfo"
import { useUserStore } from "../../stores/userinfo"
import { RiUser3Fill, RiKey2Fill } from '@remixicon/vue'
import { generateUUID } from "../../utils/generateUUID"
import { rule } from '../../utils/validate'

View File

@@ -149,7 +149,7 @@ import { Codemirror } from 'vue-codemirror';
import { javascript } from '@codemirror/lang-javascript';
import { oneDark } from '@codemirror/theme-one-dark';
import type { AutomationScript, ScriptSaveInput } from '@lib/script-types';
import { useScriptStore } from '@src/store/script';
import { useScriptStore } from '@src/stores/script';
import { channels } from '@constant/channel';
const { t } = useI18n();

View File

@@ -153,7 +153,7 @@ import {
RiErrorWarningLine,
RiCodeLine,
} from '@remixicon/vue';
import { useScriptStore } from '@src/store/script';
import { useScriptStore } from '@src/stores/script';
import type { AutomationScript, ScriptSaveInput } from '@lib/script-types';
import ScriptCard from './components/ScriptCard.vue';
import ScriptEditorDialog from './components/ScriptEditorDialog.vue';

View File

@@ -158,7 +158,7 @@ import TitleSection from '@src/components/TitleSection/index.vue'
import { useThemeStore } from '@src/stores/theme'
import { useUpdateStore } from '@src/stores/update'
import { RiSunLine, RiMoonLine, RiComputerLine, RiRefreshLine } from '@remixicon/vue'
import { useLocaleStore } from '@src/store/locale'
import { useLocaleStore } from '@src/stores/locale'
import type { LanguageCode } from '@src/i18n/constants'
import { SUPPORTED_LANGUAGES } from '@src/i18n/constants'

View File

@@ -94,7 +94,7 @@
<script setup lang="ts">
import { ref, watch } from 'vue'
import type { MarketplaceSkill, Skill } from '@src/lib/skills-types'
import { SEARCH_ERROR_CODES } from '@src/store/skills'
import { SEARCH_ERROR_CODES } from '@src/stores/skills'
import { apiGetSkillsDir } from '@src/lib/skills-api'
import { RiSearchLine, RiCloseLine, RiErrorWarningLine, RiRefreshLine, RiDeleteBinLine, RiArchiveLine } from '@remixicon/vue'

View File

@@ -129,7 +129,7 @@ import { resolveSkillSourceLabel } from '@src/lib/skills-utils'
import { ElMessage } from 'element-plus'
import { RiLockLine, RiKeyLine, RiFileCopyLine, RiFolderOpenLine, RiGlobalLine, RiFileCodeLine } from '@remixicon/vue'
import EnvVarManager from './EnvVarManager.vue'
import { useSkillsStore } from '@src/store/skills'
import { useSkillsStore } from '@src/stores/skills'
const props = defineProps<{
skill: Skill | null

View File

@@ -165,7 +165,7 @@
<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useSkillsStore, FETCH_ERROR_CODES } from '@src/store/skills'
import { useSkillsStore, FETCH_ERROR_CODES } from '@src/stores/skills'
import { MOCK_SKILLS, MOCK_MARKETPLACE } from '@src/lib/skills-api'
import type { Skill, MarketplaceSkill } from '@src/lib/skills-types'
import { ElMessage } from 'element-plus'

View File

@@ -8,7 +8,7 @@ import type {
import { extractText, isToolOnlyMessage, isToolResultRole, isInternalMessage } from '@src/pages/home/model/ChatModel'
import { hostApiFetch } from '@lib/host-api'
import { gatewayRpc, onGatewayEvent } from '@lib/gateway-client'
import { useProviderStore } from '@store/providers'
import { useProviderStore } from '@stores/providers'
// ── Constants ───────────────────────────────────────────────────
const DEFAULT_SESSION_KEY = 'agent:main:main'