forked from Chanzhaoyu/chatgpt-web
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 支持 accessToken 请求 web api 调用 (Chanzhaoyu#80)
* feat: 支持 markdown 格式和图片 * perf: 重载的时候滚动条保持 * chore: version 2.5.2 * feat: 添加文字换行 * chore: 添加新封面 * chore: 更新 cover * feat: 支持 web api 的形式 * feat: 支持新模型和调整超时 * feat: 添加反向代理 * chore: 更新 README.md * feat: 添加超时和反向代理显示 * chore: version 2.6.0 * chore: update README
- Loading branch information
1 parent
ac9536a
commit f40048f
Showing
18 changed files
with
236 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
VITE_GLOB_API_URL=/api | ||
|
||
VITE_APP_API_BASE_URL=http://localhost:3002/ | ||
|
||
VITE_GLOB_API_TIMEOUT=100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
"chatgpt", | ||
"chenzhaoyu", | ||
"commitlint", | ||
"davinci", | ||
"dockerhub", | ||
"esno", | ||
"GPTAPI", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "chatgpt-web", | ||
"version": "2.5.2", | ||
"version": "2.6.0", | ||
"private": false, | ||
"description": "ChatGPT Web", | ||
"author": "ChenZhaoYu <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
# OpenAI API Key - https://platform.openai.com/overview | ||
OPENAI_API_KEY= | ||
|
||
# change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response | ||
OPENAI_ACCESS_TOKEN= | ||
|
||
# Reverse Proxy | ||
API_REVERSE_PROXY= | ||
|
||
# timeout | ||
TIMEOUT_MS=60000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script setup lang='ts'> | ||
import { computed, ref, watch } from 'vue' | ||
import { NCard, NModal } from 'naive-ui' | ||
import { fetchChatConfig } from '@/api' | ||
interface Props { | ||
visible: boolean | ||
} | ||
interface Emit { | ||
(e: 'update:visible', visible: boolean): void | ||
} | ||
interface ConfigState { | ||
timeoutMs?: number | ||
reverseProxy?: string | ||
apiModel?: string | ||
} | ||
const props = defineProps<Props>() | ||
const emit = defineEmits<Emit>() | ||
const show = computed({ | ||
get() { | ||
return props.visible | ||
}, | ||
set(visible: boolean) { | ||
emit('update:visible', visible) | ||
}, | ||
}) | ||
const config = ref<ConfigState>() | ||
async function fetchConfig() { | ||
try { | ||
const { data } = await fetchChatConfig<ConfigState>() | ||
config.value = data | ||
} | ||
catch (error) { | ||
// ... | ||
} | ||
} | ||
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"> | ||
<h1 class="text-xl font-bold"> | ||
当前后台设置 | ||
</h1> | ||
<p>API方式:{{ config?.apiModel ?? '-' }}</p> | ||
<p>反向代理:{{ config?.reverseProxy ?? '-' }}</p> | ||
<p>超时时间:{{ config?.timeoutMs ?? '-' }}</p> | ||
</div> | ||
</NCard> | ||
</NModal> | ||
</template> |
Oops, something went wrong.