diff --git a/README.md b/README.md index f26c9df297..d42968a888 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ | AUTH_SECRET_KEY | 验证密码 | 无 | ✅ | ✅| | API_UPLOADER | 支持上传 | 关闭 | ✅ | x| | HIDE_SERVER | 前端ui隐藏服务端| | ✅ | x| +| CUSTOM_MODELS | 自定义可选模型 | 无 | ✅ | ✅| ## docker 部署 **假设**: diff --git a/api/session.js b/api/session.js index a8acb10917..74dd1e6ef8 100644 --- a/api/session.js +++ b/api/session.js @@ -12,6 +12,7 @@ module.exports = (req, res) => { "model": "ChatGPTAPI", "amodel": process.env.OPENAI_API_MODEL?? "gpt-3.5-turbo" ,isApiGallery: process.env.MJ_API_GALLERY ? true : false + ,cmodels : process.env.CUSTOM_MODELS??'' } } res.writeHead(200).end( diff --git a/changlog.md b/changlog.md index 8b9d75f0b3..afe677db91 100644 --- a/changlog.md +++ b/changlog.md @@ -1,5 +1,12 @@ # 功能升级日志 +## 2.12.10 +- 🐞 修复:希望实现左侧绘画功能区固定,不随对话界面上下滚动 #29 +- 🐞 修复:当服务端有错误,ui错误显示为空bug +- 🔨 优化:新增 `CUSTOM_MODELS` 环境变量 可自定义可选模型 #32 + + + ## 2.12.9 - 🐞 修复:按住回车不放,会一直触发提交刷新页面 #24 - 🔨 优化:我的画廊 支持来之服务端的数据(适合自建服务器) diff --git a/package.json b/package.json index 2bb891d61a..56068fefac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chatgpt-web-midjourney-proxy", - "version": "2.12.9", + "version": "2.12.10", "private": false, "description": "ChatGPT Web Midjourney Proxy", "author": "Dooy ", diff --git a/service/.env.example b/service/.env.example index 5f2da5c70f..054a07bc7a 100644 --- a/service/.env.example +++ b/service/.env.example @@ -53,3 +53,6 @@ API_UPLOADER= #HIDE_SERVER 隐藏服务端 1 HIDE_SERVER= + +#自定义模型 CUSTOM_MODELS=-gpt-3.5-turbo-0301,gpt-4.5 不显示 gpt-3.5-turbo-0301 新增加 gpt-4.5 +CUSTOM_MODELS= \ No newline at end of file diff --git a/service/src/index.ts b/service/src/index.ts index d08e66159b..ca34d6a3cf 100644 --- a/service/src/index.ts +++ b/service/src/index.ts @@ -74,7 +74,8 @@ router.post('/session', async (req, res) => { const isHideServer= isNotEmptyString( process.env.HIDE_SERVER ); const amodel= process.env.OPENAI_API_MODEL?? "gpt-3.5-turbo" ; const isApiGallery= isNotEmptyString( process.env.MJ_API_GALLERY ); - res.send({ status: 'Success', message: '', data: {isHideServer,isUpload, auth: hasAuth, model: currentModel(),amodel,isApiGallery } }) + const cmodels = process.env.CUSTOM_MODELS??'' ; + res.send({ status: 'Success', message: '', data: {isHideServer,isUpload, auth: hasAuth, model: currentModel(),amodel,isApiGallery,cmodels } }) } catch (error) { res.send({ status: 'Fail', message: error.message, data: null }) diff --git a/src/api/sse/fetchsse.ts b/src/api/sse/fetchsse.ts index 96d140046b..6826d03b9e 100644 --- a/src/api/sse/fetchsse.ts +++ b/src/api/sse/fetchsse.ts @@ -16,7 +16,12 @@ export async function fetchSSE( fetch: types.FetchFn = globalFetch ) { const { onMessage, onError, ...fetchOptions } = options - const res = await fetch(url, fetchOptions) + let res ; + try{ + res = await fetch(url, fetchOptions) + }catch(e :any ){ + throw {reason: JSON.stringify({message:'fetch error, pleace check url',url ,code:'fetch_error'}) } + } if (!res.ok) { let reason: string diff --git a/src/views/chat/components/Header/index.vue b/src/views/chat/components/Header/index.vue index cded3e8a16..51d5afa619 100644 --- a/src/views/chat/components/Header/index.vue +++ b/src/views/chat/components/Header/index.vue @@ -86,7 +86,7 @@ const st = ref({isShow:false});