From 613b33251b27f08763ff5a9877d5f0227f1e4357 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sat, 27 Jul 2024 14:32:57 +0800 Subject: [PATCH] update some web details --- run.sh | 4 +- web/src/components/ChatComponent.vue | 24 ++++- web/src/layouts/AppLayout.vue | 128 ++++++++++------------- web/src/stores/{counter.js => config.js} | 0 web/src/views/ChatView.vue | 9 ++ web/src/views/SettingView.vue | 15 ++- 6 files changed, 93 insertions(+), 87 deletions(-) rename web/src/stores/{counter.js => config.js} (100%) diff --git a/run.sh b/run.sh index 34060f8c..4631b502 100644 --- a/run.sh +++ b/run.sh @@ -4,7 +4,7 @@ stop_services() { echo "Stopping services..." pkill -f "npm run server" - pkill -f "flask --app=api run" + pkill -f "python api.py" exit } @@ -13,7 +13,7 @@ trap stop_services SIGINT SIGTERM # Start the server cd src -python api.py +python api.py & # Start the frontend service cd ../web diff --git a/web/src/components/ChatComponent.vue b/web/src/components/ChatComponent.vue index eb020973..5e844a45 100644 --- a/web/src/components/ChatComponent.vue +++ b/web/src/components/ChatComponent.vue @@ -39,7 +39,7 @@
@@ -122,7 +122,7 @@
-

即便强如雅典娜也可能会出错,请注意辨别内容的可靠性

+

即便强如雅典娜也可能会出错,请注意辨别内容的可靠性 模型供应商:{{ configStore.config?.model_provider }}

@@ -142,8 +142,11 @@ import { SettingOutlined, SettingFilled, PlusCircleOutlined, + FolderOutlined, + FolderOpenOutlined, } from '@ant-design/icons-vue' import { marked } from 'marked'; +import { useConfigStore } from '@/stores/config' const props = defineProps({ conv: Object, @@ -151,6 +154,7 @@ const props = defineProps({ }) const emit = defineEmits(['renameTitle']) +const configStore = useConfigStore() const { conv, state } = toRefs(props) const chatContainer = ref(null) @@ -666,6 +670,22 @@ button:disabled { } } + .bottom { + padding: 0.5rem 0.5rem; + + .input-box { + border-radius: 8px; + padding: 0.5rem; + + textarea.user-input { + padding: 0.5rem 0; + } + } + .note { + display: none; + } + } + } diff --git a/web/src/layouts/AppLayout.vue b/web/src/layouts/AppLayout.vue index 244f340f..85a3ba03 100644 --- a/web/src/layouts/AppLayout.vue +++ b/web/src/layouts/AppLayout.vue @@ -7,10 +7,11 @@ import { SettingOutlined, SettingFilled, BookOutlined, - BookFilled + BookFilled, + GithubOutlined, } from '@ant-design/icons-vue' import { themeConfig } from '@/assets/theme' -import { useConfigStore } from '@/stores/counter' +import { useConfigStore } from '@/stores/config' const configStore = useConfigStore() @@ -39,18 +40,26 @@ console.log(route)
+ +
+ 对话 + 知识 + 设置 +
@@ -70,6 +79,10 @@ console.log(route) width: 100%; height: 100vh; min-width: var(--min-width); + + .header-mobile { + display: none; + } } div.header, #app-router-view { @@ -112,6 +125,28 @@ div.header, #app-router-view { } } + .nav-item { + padding: 8px 16px; + border: none; + border-radius: 8px; + background-color: transparent; + color: #222; + font-size: 20px; + transition: background-color 0.2s ease-in-out; + margin: 0 10px; + + &.active { + font-weight: bold; + color: var(--main-color); + background-color: var(--main-light-2); + } + + &:hover { + background-color: var(--main-light-2); + cursor: pointer; + } + } + .setting { width: auto; font-size: 20px; @@ -132,95 +167,38 @@ div.header, #app-router-view { position: relative; height: 45px; gap: 16px; - - .nav-item { - padding: 8px 16px; - border: none; - border-radius: 8px; - background-color: transparent; - color: #222; - font-size: 20px; - transition: background-color 0.2s ease-in-out; - margin: 0 10px; - - .text { - display: none; - } - - &.active { - font-weight: bold; - color: var(--main-color); - background-color: var(--main-light-2); - } - - &:hover { - background-color: var(--main-light-2); - cursor: pointer; - } - } } @media (max-width: 520px) { .app-layout { flex-direction: column-reverse; + + div.header { + display: none; + } } - .app-layout div.header { + .app-layout div.header-mobile { + display: flex; flex-direction: row; width: 100%; - height: 40px; padding: 0 20px; - justify-content: space-between; + justify-content: space-around; align-items: center; flex: 0 0 60px; border-right: none; - border-top: 1px solid var(--main-light-2); - - .logo { - display: none; - flex-shrink: 0; - width: 40px; - height: 40px; - margin: 0; - } - - .setting { - margin: 0; - width: 60px; - } - } - - - - .app-layout .nav { - flex-direction: row; - height: 100%; - width: 100%; - justify-content: center; - gap: 0; .nav-item { text-decoration: none; - - span.text { - display: block; - color: #333; - } - span.icon { - display: none; - } - } - - .nav-item:hover { - background-color: transparent; - } - - .nav-item.active { + width: 40px; + color: var(--c-text-light-2); + font-size: 1rem; font-weight: bold; - background-color: transparent; + transition: color 0.1s ease-in-out, font-size 0.1s ease-in-out; - span.text { - font-weight: bold; + &.active { + color: black; + font-size: 1.1rem; } } } diff --git a/web/src/stores/counter.js b/web/src/stores/config.js similarity index 100% rename from web/src/stores/counter.js rename to web/src/stores/config.js diff --git a/web/src/views/ChatView.vue b/web/src/views/ChatView.vue index 78d7ea90..c46b8295 100644 --- a/web/src/views/ChatView.vue +++ b/web/src/views/ChatView.vue @@ -222,4 +222,13 @@ onMounted(() => { } } +@media (max-width: 520px) { + .conversations { + position: absolute; + z-index: 101; + width: 300px; + border-radius: 0 16px 16px 0; + box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.05); + } +} diff --git a/web/src/views/SettingView.vue b/web/src/views/SettingView.vue index 1ba6b100..db340e11 100644 --- a/web/src/views/SettingView.vue +++ b/web/src/views/SettingView.vue @@ -11,7 +11,7 @@ 需要重启 - @@ -27,7 +27,7 @@ 需要重启 - @@ -43,7 +43,7 @@ 需要重启 - @@ -92,7 +92,7 @@