mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-04-12 17:37:23 +00:00
fix chat ai width
This commit is contained in:
@@ -1,17 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="[
|
<div
|
||||||
'fixed top-0 right-0 h-full z-50 bg-white shadow-lg transform transition-transform duration-300 ease-in-out',
|
class="h-[calc(100vh-3.5rem)] flex flex-col box-border p-3 overflow-y-auto md:w-80 w-full overflow-x-hidden border-gray-200 border-l"
|
||||||
'flex flex-col box-border overflow-y-auto w-full sm:w-96',
|
ref="chatContainer">
|
||||||
isVisible ? 'translate-x-0' : 'translate-x-full'
|
|
||||||
]" ref="chatContainer">
|
|
||||||
<div class="flex items-center justify-between p-3 border-b">
|
|
||||||
<h2 class="text-lg font-semibold text-gray-900">助手</h2>
|
|
||||||
<button @click="closeAssistant" class="text-gray-500 hover:text-gray-700">
|
|
||||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-y-5 flex-1 pb-2">
|
<div class="flex flex-col gap-y-5 flex-1 pb-2">
|
||||||
<li v-for="chatElement in messages" :key="chatElement.content"
|
<li v-for="chatElement in messages" :key="chatElement.content"
|
||||||
:class="['flex items-start gap-2.5', chatElement.isUser ? 'flex-row-reverse max-w-full break-words' : 'flex-row']">
|
:class="['flex items-start gap-2.5', chatElement.isUser ? 'flex-row-reverse max-w-full break-words' : 'flex-row']">
|
||||||
@@ -47,22 +37,25 @@
|
|||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="sticky bottom-0 z-10">
|
<form class="sticky">
|
||||||
<div class="w-full border border-gray-200 rounded-lg bg-gray-50">
|
<div class="w-full border border-gray-200 rounded-lg bg-gray-50">
|
||||||
<div class="px-3 py-2 sm:px-4 sm:py-2 bg-white rounded-t-lg">
|
<div class="px-4 py-2 bg-white rounded-t-lg">
|
||||||
<label for="comment" class="sr-only">你的消息</label>
|
<label for="comment" class="sr-only"></label>
|
||||||
<textarea id="comment" :rows="2" v-model="inputMessage"
|
<textarea id="comment" rows="3" v-model="inputMessage"
|
||||||
class="w-full px-0 text-sm sm:text-base text-gray-900 bg-white border-0 focus:ring-0 resize-none"
|
class="w-full px-0 text-gray-900 bg-white border-0 focus:ring-0" :placeholder="
|
||||||
:placeholder="commandPlaceholderMap[commandMode]" required></textarea>
|
commandPlaceholderMap[commandMode]
|
||||||
|
" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-between px-2 py-2 sm:px-3 sm:py-2 border-t border-gray-200">
|
<div class="flex justify-between px-2 py-2 border-t border-gray-200">
|
||||||
<select id="commandModeSelect" v-model="commandMode"
|
<form>
|
||||||
class="bg-white border border-gray-300 text-gray-900 text-xs sm:text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2 sm:p-2.5">
|
<select id="countries" v-model="commandMode"
|
||||||
<option selected :value="'chat'">询问模式</option>
|
class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg block">
|
||||||
<option :value="'search'">搜索模式</option>
|
<option selected :value="'chat'">询问模式</option>
|
||||||
<option :value="'execute'">指令模式</option>
|
<option :value="'search'">搜索模式</option>
|
||||||
</select>
|
<option :value="'execute'">指令模式</option>
|
||||||
<Button size="sm" :abortable="true" :isLoading="isLoading" :loadingContent="'中止'" :submitContent="'发送'"
|
</select>
|
||||||
|
</form>
|
||||||
|
<Button :abortable="true" :isLoading="isLoading" :loadingContent="'中止'" :submitContent="'发送'"
|
||||||
:handleClick="() => handleSendClick(inputMessage, commandMode)" />
|
:handleClick="() => handleSendClick(inputMessage, commandMode)" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -329,16 +322,6 @@ onMounted(async () => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
isVisible: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits(['close']);
|
|
||||||
|
|
||||||
const closeAssistant = () => {
|
|
||||||
emit('close');
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css">
|
<style lang="css">
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<Headbar :changeAssistantVisible="changeAssistantVisible"></Headbar>
|
<Headbar :changeAssistantVisible="changeAssistantVisible"></Headbar>
|
||||||
<Sidebar />
|
<Sidebar>
|
||||||
|
</Sidebar>
|
||||||
<div class="flex flex-row h-[calc(100vh-3.5rem)] mt-14">
|
<div class="flex flex-row h-[calc(100vh-3.5rem)] mt-14">
|
||||||
<article class="flex-1 sm:ml-44 overflow-y-auto">
|
<article class="flex-1 sm:ml-44 overflow-y-auto">
|
||||||
<RouterView></RouterView>
|
<RouterView></RouterView>
|
||||||
</article>
|
</article>
|
||||||
<!-- Assistant is now fixed positioned and controlled by isAssistantVisible -->
|
<Assistant v-if="isAssistantVisible"></Assistant>
|
||||||
</div>
|
</div>
|
||||||
<Assistant :isVisible="isAssistantVisible" @close="changeAssistantVisible"></Assistant>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
<span class="text-sm py-0.5 px-2 font-medium">0.1k</span>
|
<span class="text-sm py-0.5 px-2 font-medium">0.1k</span>
|
||||||
</a>
|
</a>
|
||||||
<span class="flex space-x-2 sm:space-x-3">
|
<span class="flex space-x-2 sm:space-x-3">
|
||||||
<button class="cursor-pointer" @click="changeAssistantVisible">
|
<button class="cursor-pointer p-1" @click="changeAssistantVisible">
|
||||||
<AiChatIcon class="w-5 h-5 sm:w-6 sm:h-6 text-gray-600" />
|
<AiChatIcon class="w-7 h-7 text-gray-600 sm:w-5 sm:h-5" />
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import RoleIcon from "./icons/RoleIcon.vue";
|
|||||||
import SchedulerIcon from "./icons/SchedulerIcon.vue";
|
import SchedulerIcon from "./icons/SchedulerIcon.vue";
|
||||||
import SettingsIcon from "./icons/SettingsIcon.vue";
|
import SettingsIcon from "./icons/SettingsIcon.vue";
|
||||||
import UsersIcon from "./icons/UsersIcon.vue";
|
import UsersIcon from "./icons/UsersIcon.vue";
|
||||||
import AiChatIcon from "./icons/AiChatIcon.vue";
|
|
||||||
import LlmConfigIcon from "./icons/LlmConfigIcon.vue";
|
import LlmConfigIcon from "./icons/LlmConfigIcon.vue";
|
||||||
|
|
||||||
// 菜单配置
|
// 菜单配置
|
||||||
|
|||||||
Reference in New Issue
Block a user