mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-26 16:24:39 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
73a67b8f64 | ||
![]() |
222b3eaa4c | ||
![]() |
c4baccdc48 | ||
![]() |
7021a08ecf | ||
![]() |
e88b9bef13 | ||
![]() |
c17cc16c0e | ||
![]() |
d7d037618f | ||
![]() |
01edad7717 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,4 +30,3 @@ coverage
|
||||
|
||||
# Environment variables files
|
||||
/service/.env
|
||||
/.env
|
||||
|
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,16 @@
|
||||
## v2.10.2
|
||||
|
||||
`2023-03-09`
|
||||
|
||||
衔接 `2.10.1` 版本[详情](https://github.com/Chanzhaoyu/chatgpt-web/releases/tag/v2.10.1)
|
||||
|
||||
## Enhancement
|
||||
- 移动端下输入框获得焦点时左侧按钮隐藏
|
||||
|
||||
## BugFix
|
||||
- 修复 `2.10.1` 中添加 `OPENAI_API_MODEL` 变量的判断错误,会导致默认模型指定失效,抱歉
|
||||
- 回退 `2.10.1` 中前端变量影响 `Docker` 打包
|
||||
|
||||
## v2.10.1
|
||||
|
||||
`2023-03-09`
|
||||
@@ -24,7 +37,6 @@
|
||||
- 修复深色模式导出图片的样式问题
|
||||
|
||||
|
||||
|
||||
## v2.10.0
|
||||
|
||||
`2023-03-07`
|
||||
|
@@ -266,7 +266,7 @@ PS: 不进行打包,直接在服务器上运行 `pnpm start` 也可
|
||||
|
||||
#### 前端网页
|
||||
|
||||
1、参考根目录下 `.env.example` 文件内容创建 `.env` 文件,修改 `VITE_APP_API_BASE_URL` 为你的实际后端接口地址
|
||||
1、修改根目录下 `.env` 文件中的 `VITE_APP_API_BASE_URL` 为你的实际后端接口地址
|
||||
|
||||
2、根目录下运行以下命令,然后将 `dist` 文件夹内的文件复制到你网站服务的根目录下
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chatgpt-web",
|
||||
"version": "2.10.1",
|
||||
"version": "2.10.2",
|
||||
"private": false,
|
||||
"description": "ChatGPT Web",
|
||||
"author": "ChenZhaoYu <chenzhaoyu1994@gmail.com>",
|
||||
|
@@ -31,11 +31,14 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
|
||||
// More Info: https://github.com/transitive-bullshit/chatgpt-api
|
||||
|
||||
if (process.env.OPENAI_API_KEY) {
|
||||
const OPENAI_API_MODEL = process.env.OPENAI_API_MODEL
|
||||
const model = (typeof OPENAI_API_MODEL === 'string' && OPENAI_API_MODEL.length > 0)
|
||||
? OPENAI_API_MODEL
|
||||
: 'gpt-3.5-turbo'
|
||||
|
||||
const options: ChatGPTAPIOptions = {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
completionParams: {
|
||||
model: process.env.OPENAI_API_MODEL ?? 'gpt-3.5-turbo',
|
||||
},
|
||||
completionParams: { model },
|
||||
debug: false,
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ const chatStore = useChatStore()
|
||||
useCopyCode()
|
||||
const { isMobile } = useBasicLayout()
|
||||
const { addChat, updateChat, updateChatSome, getChatByUuidAndIndex } = useChat()
|
||||
const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll()
|
||||
const { scrollRef, scrollToBottom } = useScroll()
|
||||
|
||||
const { uuid } = route.params as { uuid: string }
|
||||
|
||||
@@ -34,6 +34,7 @@ const conversationList = computed(() => dataSources.value.filter(item => (!item.
|
||||
const prompt = ref<string>('')
|
||||
const loading = ref<boolean>(false)
|
||||
const usingContext = ref<boolean>(true)
|
||||
const actionVisible = ref<boolean>(true)
|
||||
|
||||
function handleSubmit() {
|
||||
onConversation()
|
||||
@@ -114,7 +115,7 @@ async function onConversation() {
|
||||
requestOptions: { prompt: message, options: { ...options } },
|
||||
},
|
||||
)
|
||||
scrollToBottomIfAtBottom()
|
||||
scrollToBottom()
|
||||
}
|
||||
catch (error) {
|
||||
//
|
||||
@@ -165,10 +166,10 @@ async function onConversation() {
|
||||
requestOptions: { prompt: message, options: { ...options } },
|
||||
},
|
||||
)
|
||||
scrollToBottom()
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
scrollToBottom()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,20 +368,20 @@ function handleStop() {
|
||||
|
||||
function toggleUsingContext() {
|
||||
usingContext.value = !usingContext.value
|
||||
if (usingContext.value) {
|
||||
dialog.info({
|
||||
title: t('chat.usingContext'),
|
||||
content: t('chat.turnOnContext'),
|
||||
positiveText: t('common.yes'),
|
||||
})
|
||||
}
|
||||
else {
|
||||
dialog.info({
|
||||
title: t('chat.usingContext'),
|
||||
content: t('chat.turnOffContext'),
|
||||
positiveText: t('common.yes'),
|
||||
})
|
||||
}
|
||||
if (usingContext.value)
|
||||
ms.success(t('chat.turnOnContext'))
|
||||
else
|
||||
ms.warning(t('chat.turnOffContext'))
|
||||
}
|
||||
|
||||
function onInputFocus() {
|
||||
if (isMobile.value)
|
||||
actionVisible.value = false
|
||||
}
|
||||
|
||||
function onInputBlur() {
|
||||
if (isMobile.value)
|
||||
actionVisible.value = true
|
||||
}
|
||||
|
||||
const placeholder = computed(() => {
|
||||
@@ -402,7 +403,7 @@ const wrapClass = computed(() => {
|
||||
const footerClass = computed(() => {
|
||||
let classes = ['p-4']
|
||||
if (isMobile.value)
|
||||
classes = ['sticky', 'left-0', 'bottom-0', 'right-0', 'p-2', 'pr-4', 'overflow-hidden']
|
||||
classes = ['sticky', 'left-0', 'bottom-0', 'right-0', 'p-2', 'overflow-hidden']
|
||||
return classes
|
||||
})
|
||||
|
||||
@@ -464,26 +465,30 @@ onUnmounted(() => {
|
||||
<footer :class="footerClass">
|
||||
<div class="w-full max-w-screen-xl m-auto">
|
||||
<div class="flex items-center justify-between space-x-2">
|
||||
<HoverButton @click="handleClear">
|
||||
<span class="text-xl text-[#4f555e] dark:text-white">
|
||||
<SvgIcon icon="ri:delete-bin-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
<HoverButton @click="handleExport">
|
||||
<span class="text-xl text-[#4f555e] dark:text-white">
|
||||
<SvgIcon icon="ri:download-2-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
<HoverButton @click="toggleUsingContext">
|
||||
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
|
||||
<SvgIcon icon="ri:chat-history-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
<div v-if="actionVisible" class="flex items-center space-x-2">
|
||||
<HoverButton @click="handleClear">
|
||||
<span class="text-xl text-[#4f555e] dark:text-white">
|
||||
<SvgIcon icon="ri:delete-bin-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
<HoverButton @click="handleExport">
|
||||
<span class="text-xl text-[#4f555e] dark:text-white">
|
||||
<SvgIcon icon="ri:download-2-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
<HoverButton @click="toggleUsingContext">
|
||||
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
|
||||
<SvgIcon icon="ri:chat-history-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
</div>
|
||||
<NInput
|
||||
v-model:value="prompt"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 1, maxRows: 2 }"
|
||||
:placeholder="placeholder"
|
||||
@focus="onInputFocus"
|
||||
@blur="onInputBlur"
|
||||
@keypress="handleEnter"
|
||||
/>
|
||||
<NButton type="primary" :disabled="buttonDisabled" @click="handleSubmit">
|
||||
|
Reference in New Issue
Block a user