feat: 增加带格式的复制 (#182)

* feat: 增加带格式的复制

* feat: 移除前端超时设定

* chore: update deps

* feat: 添加权限页面

* feat: 设定页面优化

* feat: 更新 chatgpt 以支持 `gpt-3.5-turbo-0301`

* chore: version 2.9.0
This commit is contained in:
Redon
2023-03-02 12:59:20 +08:00
committed by GitHub
parent 42e320fe35
commit 32ebbec8ad
28 changed files with 689 additions and 306 deletions

View File

@@ -1,8 +1,9 @@
<script setup lang='ts'>
import { computed, ref, watch } from 'vue'
import { NCard, NModal } from 'naive-ui'
import pkg from '../../../../package.json'
import { fetchChatConfig } from '@/api'
import { computed, ref } from 'vue'
import { NCard, NModal, NTabPane, NTabs } from 'naive-ui'
import General from './General.vue'
import About from './About.vue'
import { SvgIcon } from '@/components/common'
interface Props {
visible: boolean
@@ -12,17 +13,14 @@ interface Emit {
(e: 'update:visible', visible: boolean): void
}
interface ConfigState {
timeoutMs?: number
reverseProxy?: string
apiModel?: string
socksProxy?: string
}
const props = defineProps<Props>()
const emit = defineEmits<Emit>()
const active = ref('General')
const reload = ref(false)
const show = computed({
get() {
return props.visible
@@ -32,46 +30,35 @@ const show = computed({
},
})
const config = ref<ConfigState>()
async function fetchConfig() {
try {
const { data } = await fetchChatConfig<ConfigState>()
config.value = data
}
catch (error) {
// ...
}
function handleReload() {
reload.value = true
setTimeout(() => {
reload.value = false
}, 0)
}
watch(
() => props.visible,
(val) => {
if (val)
fetchConfig()
},
)
</script>
<template>
<NModal v-model:show="show" style="width: 80%; max-width: 460px;">
<NCard>
<div class="space-y-4">
<h2 class="text-xl font-bold text-center">
Version - {{ pkg.version }}
</h2>
<hr>
<p>
此项目开源于
<a class="text-blue-600" href="https://github.com/Chanzhaoyu/chatgpt-web" target="_blank">Github</a>
如果你觉得此项目对你有帮助请帮我点个 Star谢谢
</p>
<hr>
<p>API方式{{ config?.apiModel ?? '-' }}</p>
<p>反向代理{{ config?.reverseProxy ?? '-' }}</p>
<p>超时时间{{ config?.timeoutMs ?? '-' }}</p>
<p>Socks代理{{ config?.socksProxy ?? '-' }}</p>
</div>
<NModal v-model:show="show">
<NCard role="dialog" aria-modal="true" :bordered="false" style="width: 100%; max-width: 640px">
<NTabs v-model:value="active" type="line" animated>
<NTabPane name="General" tab="General">
<template #tab>
<SvgIcon class="text-lg" icon="ri:file-user-line" />
<span class="ml-2">General</span>
</template>
<div class="min-h-[100px]">
<General v-if="!reload" @update="handleReload" />
</div>
</NTabPane>
<NTabPane name="Config" tab="Config">
<template #tab>
<SvgIcon class="text-lg" icon="ri:list-settings-line" />
<span class="ml-2">Config</span>
</template>
<About />
</NTabPane>
</NTabs>
</NCard>
</NModal>
</template>