Merge pull request #31 from xerrors/dev

Dev 更新一些细节
This commit is contained in:
Wenjie Zhang 2025-02-26 12:39:37 +08:00 committed by GitHub
commit 7ccfb7106a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 67 additions and 10 deletions

View File

@ -122,7 +122,7 @@
知识图谱
</div>
<a-dropdown
v-if="configStore.config.enable_knowledge_base"
v-if="configStore.config.enable_knowledge_base && opts.databases.length > 0"
:class="{'opt-item': true, 'active': meta.selectedKB !== null}"
>
<a class="ant-dropdown-link" @click.prevent>
@ -786,6 +786,7 @@ watch(
text-align: left;
word-wrap: break-word;
margin: 0;
max-width: 100%;
padding-bottom: 0;
padding-top: 16px;
padding-left: 0;
@ -821,10 +822,10 @@ watch(
max-width: 900px;
margin: 0 auto;
padding: 0.25rem 0.5rem;
border: 2px solid #E5E5E5;
border: 2px solid var(--gray-200);
border-radius: 1rem;
background: #fcfdfd;
transition: background 0.3s, box-shadow 0.3s;
background: var(--gray-50);
transition: background, border 0.3s, box-shadow 0.3s;
&:focus-within {
border: 2px solid var(--main-500);
background: white;
@ -1068,6 +1069,7 @@ watch(
}
.message-md {
max-width: 100%;
h1, h2, h3, h4, h5, h6 {
font-size: 1rem;
}

View File

@ -35,6 +35,10 @@ const layoutSettings = reactive({
useTopBar: false, // 使
})
// Add state for GitHub stars
const githubStars = ref(0)
const isLoadingStars = ref(false)
const getRemoteConfig = () => {
configStore.refreshConfig()
}
@ -46,9 +50,24 @@ const getRemoteDatabase = () => {
databaseStore.refreshDatabase()
}
// Fetch GitHub stars count
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('Error fetching GitHub stars:', error)
} finally {
isLoadingStars.value = false
}
}
onMounted(() => {
getRemoteConfig()
getRemoteDatabase()
fetchGithubStars() // Fetch GitHub stars on mount
})
// 使 vue3 setup composition API
@ -114,8 +133,11 @@ console.log(route)
</div>
<div class="fill" style="flex-grow: 1;"></div>
<div class="github nav-item">
<a href="https://github.com/xerrors/ProjectAthena" target="_blank">
<GithubOutlined class="icon" style="color: #222;"/>
<a href="https://github.com/xerrors/Yuxi-Know" target="_blank" class="github-link">
<GithubOutlined class="icon" style="color: #222;"/>
<span v-if="githubStars > 0" class="github-stars">
<span class="star-count">{{ githubStars }}</span>
</span>
</a>
</div>
<RouterLink class="nav-item setting" to="/setting" active-class="active">
@ -231,6 +253,30 @@ div.header, #app-router-view {
background-color: transparent;
border: 1px solid transparent;
}
.github-link {
display: flex;
flex-direction: column;
align-items: center;
color: inherit;
}
.github-stars {
display: flex;
align-items: center;
font-size: 12px;
margin-top: 4px;
.star-icon {
color: #f0a742;
font-size: 12px;
margin-right: 2px;
}
.star-count {
font-weight: 600;
}
}
}
&.setting {
@ -389,7 +435,6 @@ div.header, #app-router-view {
font-size: 15px;
}
&.github, &.setting {
padding: 8px 12px;
@ -406,11 +451,21 @@ div.header, #app-router-view {
&.github {
a {
display: flex;
justify-content: center;
align-items: center;
}
.github-stars {
display: flex;
align-items: center;
margin-left: 6px;
.star-icon {
color: #f0a742;
font-size: 14px;
margin-right: 2px;
}
}
}
}
}
</style>
</style>