add AIAgent
This commit is contained in:
@@ -39,6 +39,18 @@
|
||||
<t-icon name="help-circle"/>
|
||||
</template>
|
||||
</t-button>
|
||||
<t-button
|
||||
v-if="canUseAi"
|
||||
class="ai"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
content="AI 小糕"
|
||||
@click="openAiChat"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon name="robot-2" />
|
||||
</template>
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -46,7 +58,7 @@
|
||||
<script setup lang="ts">
|
||||
import { NotifyAPI, useUserStore } from "timi-web-api";
|
||||
import { useNavBarStore } from "@/store/navBarStore";
|
||||
import { corePermissionCodes, permissionCodes } from "@/utils/permission";
|
||||
import { corePermissionCodes, gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
|
||||
defineOptions({
|
||||
name: "HomeTab"
|
||||
@@ -136,6 +148,11 @@ const visibleEntryGroupList = computed(() => entryGroupList
|
||||
const visibleEntryCount = computed(() => visibleEntryGroupList.value
|
||||
.reduce((count, group) => count + group.entryList.length, 0));
|
||||
const canReadNotify = computed(() => userStore.hasPermissions(corePermissionCodes.notify.read));
|
||||
const canUseAi = computed(() => userStore.hasRoles(gaoRoleCodes.storeManager));
|
||||
|
||||
async function openAiChat(): Promise<void> {
|
||||
await router.push("/ai/chat");
|
||||
}
|
||||
|
||||
async function loadUnreadNotifyCount(): Promise<void> {
|
||||
try {
|
||||
@@ -240,12 +257,16 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.help-wrap {
|
||||
--td-button-border-radius: 1rem;
|
||||
|
||||
gap: 1rem;
|
||||
width: fit-content;
|
||||
margin: 0 auto;
|
||||
|
||||
.help {
|
||||
--td-button-border-radius: 1rem;
|
||||
margin: 1rem auto 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.help,
|
||||
.ai {
|
||||
width: 8rem;
|
||||
background: white;
|
||||
box-shadow: var(--td-shadow-3);
|
||||
|
||||
Reference in New Issue
Block a user