feat: 增强命令面板功能与AI助手集成

This commit is contained in:
Ray.Hao
2026-01-06 20:21:29 +08:00
parent 2953642e99
commit 4a8efc770e
6 changed files with 314 additions and 55 deletions

View File

@@ -119,10 +119,11 @@
</template>
<script setup lang="ts">
import { onBeforeUnmount, onMounted, watch } from "vue";
import { nextTick, onBeforeUnmount, onMounted, watch } from "vue";
import { useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import AiCommandApi from "@/api/ai";
import { useSettingsStore } from "@/store";
type ToolFunctionCall = {
name: string;
@@ -156,6 +157,7 @@ type AiResponse = {
};
const router = useRouter();
const settingsStore = useSettingsStore();
// 状态管理
const dialogVisible = ref(false);
@@ -188,7 +190,7 @@ const getActiveRightDrawerWidth = (): number => {
continue;
}
const rect = drawer.getBoundingClientRect();
if (rect.width > 0 && rect.right >= window.innerWidth - 1) {
if (rect.width > 0 && rect.right >= window.innerWidth - 8) {
return rect.width;
}
}
@@ -255,6 +257,16 @@ watch(
{ flush: "post" }
);
watch(
() => settingsStore.settingsVisible,
() => {
nextTick(() => {
scheduleUpdateFabPositionBurst();
});
},
{ flush: "post" }
);
let domObserver: MutationObserver | null = null;
let rafId: number | null = null;
@@ -268,6 +280,18 @@ const scheduleUpdateFabPosition = () => {
});
};
const scheduleUpdateFabPositionBurst = (frames = 18) => {
let count = 0;
const tick = () => {
scheduleUpdateFabPosition();
count += 1;
if (count < frames) {
window.requestAnimationFrame(tick);
}
};
tick();
};
// 快捷命令示例
const examples = [
"修改test用户的姓名为测试人员",