优化小部分UI
This commit is contained in:
parent
cc57de2bd6
commit
55b05df6dd
@ -29,6 +29,17 @@
|
|||||||
<div class="flex-center">
|
<div class="flex-center">
|
||||||
最大历史轮数 <a-input-number id="inputNumber" v-model:value="meta.history_round" :min="1" :max="50" />
|
最大历史轮数 <a-input-number id="inputNumber" v-model:value="meta.history_round" :min="1" :max="50" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex-center">
|
||||||
|
字体大小
|
||||||
|
<a-select v-model:value="meta.fontSize" style="width: 100px" placeholder="选择字体大小">
|
||||||
|
<a-select-option value="smaller">更小</a-select-option>
|
||||||
|
<a-select-option value="default">默认</a-select-option>
|
||||||
|
<a-select-option value="larger">更大</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</div>
|
||||||
|
<div class="flex-center" @click="meta.wideScreen = !meta.wideScreen">
|
||||||
|
宽屏模式 <div @click.stop><a-switch v-model:checked="meta.wideScreen" /></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -45,7 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-box">
|
<div class="chat-box" :class="{ 'wide-screen': meta.wideScreen, 'font-smaller': meta.fontSize === 'smaller', 'font-larger': meta.fontSize === 'larger' }">
|
||||||
<div
|
<div
|
||||||
v-for="message in conv.messages"
|
v-for="message in conv.messages"
|
||||||
:key="message.id"
|
:key="message.id"
|
||||||
@ -93,7 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<div class="input-box">
|
<div class="input-box" :class="{ 'wide-screen': meta.wideScreen }">
|
||||||
<div class="input-area">
|
<div class="input-area">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
class="user-input"
|
class="user-input"
|
||||||
@ -227,6 +238,8 @@ const meta = reactive(JSON.parse(localStorage.getItem('meta')) || {
|
|||||||
summary_title: false,
|
summary_title: false,
|
||||||
history_round: 5,
|
history_round: 5,
|
||||||
db_id: null,
|
db_id: null,
|
||||||
|
fontSize: 'default',
|
||||||
|
wideScreen: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const marked = new Marked(
|
const marked = new Marked(
|
||||||
@ -751,6 +764,27 @@ watch(
|
|||||||
padding: 1rem 2rem;
|
padding: 1rem 2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
transition: max-width 0.3s ease;
|
||||||
|
|
||||||
|
&.wide-screen {
|
||||||
|
max-width: 1200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.font-smaller {
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
.message-box {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.font-larger {
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
.message-box {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.message-box {
|
.message-box {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -759,7 +793,7 @@ watch(
|
|||||||
padding: 0.625rem 1.25rem;
|
padding: 0.625rem 1.25rem;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
font-size: 0.9rem;
|
font-size: 15px;
|
||||||
font-variation-settings: 'wght' 400, 'opsz' 10.5;
|
font-variation-settings: 'wght' 400, 'opsz' 10.5;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -842,7 +876,12 @@ watch(
|
|||||||
border: 2px solid var(--gray-200);
|
border: 2px solid var(--gray-200);
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
background: var(--gray-50);
|
background: var(--gray-50);
|
||||||
transition: background, border 0.3s, box-shadow 0.3s;
|
transition: background, border 0.3s, box-shadow 0.3s, max-width 0.3s ease;
|
||||||
|
|
||||||
|
&.wide-screen {
|
||||||
|
max-width: 1200px;
|
||||||
|
}
|
||||||
|
|
||||||
&:focus-within {
|
&:focus-within {
|
||||||
border: 2px solid var(--main-500);
|
border: 2px solid var(--main-500);
|
||||||
background: white;
|
background: white;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<div class="conversations" :class="['conversations', { 'is-open': state.isSidebarOpen }]">
|
<div class="conversations" :class="['conversations', { 'is-open': state.isSidebarOpen }]">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<!-- <div class="action new" @click="addNewConv"><FormOutlined /></div> -->
|
<!-- <div class="action new" @click="addNewConv"><FormOutlined /></div> -->
|
||||||
<span style="font-weight: bold; user-select: none;">对话历史</span>
|
<span class="header-title">对话历史</span>
|
||||||
<div class="action close" @click="state.isSidebarOpen = false"><MenuOutlined /></div>
|
<div class="action close" @click="state.isSidebarOpen = false"><MenuOutlined /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="conversation-list">
|
<div class="conversation-list">
|
||||||
@ -129,6 +129,12 @@ onMounted(() => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-container .conversations {
|
||||||
|
transition: width 0.3s ease, opacity 0.3s ease, flex 0.3s ease;
|
||||||
|
white-space: nowrap; /* 防止文本换行 */
|
||||||
|
overflow: hidden; /* 确保内容不溢出 */
|
||||||
|
}
|
||||||
|
|
||||||
.chat-container .conversations:not(.is-open) {
|
.chat-container .conversations:not(.is-open) {
|
||||||
width: 0;
|
width: 0;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@ -136,15 +142,14 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chat-container .conversations.is-open {
|
.chat-container .conversations.is-open {
|
||||||
overflow: hidden; /* 确保内容不溢出 */
|
|
||||||
white-space: nowrap; /* 防止文本换行 */
|
|
||||||
flex: 1 1 auto; /* 当侧边栏打开时,占据可用空间 */
|
flex: 1 1 auto; /* 当侧边栏打开时,占据可用空间 */
|
||||||
|
width: 230px;
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.conversations {
|
.conversations {
|
||||||
width: 230px; /* 初始宽度 */
|
width: 230px; /* 初始宽度 */
|
||||||
max-width: 230px;
|
max-width: 230px;
|
||||||
border-right: 1px solid var(--main-light-3);
|
border-right: 1px solid var(--main-light-3);
|
||||||
overflow: hidden; /* 确保内容不溢出 */
|
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
background-color: var(--bg-sider);
|
background-color: var(--bg-sider);
|
||||||
|
|
||||||
@ -157,6 +162,13 @@ onMounted(() => {
|
|||||||
z-index: 9;
|
z-index: 9;
|
||||||
border-bottom: 1px solid var(--main-light-3);
|
border-bottom: 1px solid var(--main-light-3);
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-weight: bold;
|
||||||
|
user-select: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
width: 2.5rem;
|
width: 2.5rem;
|
||||||
|
|||||||
@ -5,21 +5,51 @@
|
|||||||
<p>大模型驱动的知识库管理工具</p>
|
<p>大模型驱动的知识库管理工具</p>
|
||||||
<button class="home-btn" @click="goToChat">开始对话</button>
|
<button class="home-btn" @click="goToChat">开始对话</button>
|
||||||
<img src="/home.png" alt="Placeholder Image" />
|
<img src="/home.png" alt="Placeholder Image" />
|
||||||
|
|
||||||
|
<div class="github-info">
|
||||||
|
<a href="https://github.com/xerrors/Yuxi-Know" target="_blank">
|
||||||
|
<svg height="24" width="24" viewBox="0 0 16 16" version="1.1">
|
||||||
|
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path>
|
||||||
|
</svg>
|
||||||
|
<span class="stars-count">{{ isLoadingStars ? '加载中...' : githubStars }} ⭐</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer>© 江南语析 2025 [WIP] v0.12.138</footer>
|
<footer>© 江南语析 2025 [WIP] v0.12.138</footer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const title = ref('📢 Yuxi-Know ✨')
|
const title = ref('📢 Yuxi-Know ✨')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const githubStars = ref(0)
|
||||||
|
const isLoadingStars = ref(false)
|
||||||
|
|
||||||
const goToChat = () => {
|
const goToChat = () => {
|
||||||
router.push("/chat")
|
router.push("/chat")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取GitHub stars数量
|
||||||
|
const fetchGithubStars = async () => {
|
||||||
|
try {
|
||||||
|
isLoadingStars.value = true
|
||||||
|
const response = await fetch('https://api.github.com/repos/xerrors/Yuxi-Know')
|
||||||
|
const data = await response.json()
|
||||||
|
githubStars.value = data.stargazers_count
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取GitHub stars失败:', error)
|
||||||
|
} finally {
|
||||||
|
isLoadingStars.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchGithubStars()
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@ -92,6 +122,36 @@ img {
|
|||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.github-info {
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 20px;
|
||||||
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
|
transition: all 0.3s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.8);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stars-count {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: #666;
|
color: #666;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user