Compare commits

...

8 Commits

Author SHA1 Message Date
ChenZhaoYu
73a67b8f64 chore: 2.10.2_2 2023-03-10 00:47:56 +08:00
ChenZhaoYu
222b3eaa4c feat: 移动端下按钮收缩 2023-03-10 00:46:09 +08:00
ChenZhaoYu
c4baccdc48 chore: v2.10.2_1 2023-03-10 00:03:19 +08:00
ChenZhaoYu
7021a08ecf chore: reset scrollToBottom 2023-03-10 00:02:02 +08:00
ChenZhaoYu
e88b9bef13 chore: reset .env 2023-03-09 23:57:47 +08:00
ChenZhaoYu
c17cc16c0e chore: 异常打印和调整日志 2023-03-09 22:58:06 +08:00
ChenZhaoYu
d7d037618f chore: version 2.10.2 2023-03-09 22:49:15 +08:00
ChenZhaoYu
01edad7717 fix: 修复默认模型判断错误 2023-03-09 22:45:43 +08:00
7 changed files with 59 additions and 40 deletions

View File

1
.gitignore vendored
View File

@@ -30,4 +30,3 @@ coverage
# Environment variables files
/service/.env
/.env

View File

@@ -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`

View File

@@ -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` 文件夹内的文件复制到你网站服务的根目录下

View File

@@ -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>",

View File

@@ -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,
}

View File

@@ -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">