Skip to content

Commit

Permalink
v2.17.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Dooy committed May 24, 2024
1 parent 5bbb0ef commit 4e00f7f
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 16 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
| UPLOAD_TYPE | 指定上传方式 [`R2` R2上传] [`API` 跟随UI前端中转][`Container` 本地容器][`MyUrl` 自定义链接] ||| x|
| MENU_DISABLE | 菜单禁用 可选:gpts,draws,gallery,music ||||
| VISION_MODEL | 默认使用的识图 可选:`gpt-4o`,`gpt-4-turb`,`gpt-4-vision-preview`||||
| SYSTEM_MESSAGE | 自定义默认角色消息 ||||



Expand Down
1 change: 1 addition & 0 deletions api/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = (req, res) => {
,isCloseMdPreview : process.env.CLOSE_MD_PREVIEW?true:false
,menuDisable: process.env.MENU_DISABLE??""
,visionModel: process.env.VISION_MODEL??""
,systemMessage: process.env.SYSTEM_MESSAGE??""

}
}
Expand Down
5 changes: 5 additions & 0 deletions changlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# 计划

# 2.17.9
- 🐞 修复:自定义模型的tokens配置 #362 #333
- 🐞 修复:手机版界面下 MENU_DISABLE 没有生效 #363
- 🐞 修复:绘图的时候自动新建一个对话 #365

# 2.17.8
- 🐞 修复:MJ在等待队列状态下的处理逻辑
- 😄 优化:读图由原来的 `gpt-4-vision-preview` 改为 自定义
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chatgpt-web-midjourney-proxy",
"version": "2.17.8",
"version": "2.17.9",
"private": false,
"description": "ChatGPT Web Midjourney Proxy",
"author": "Dooy <[email protected]>",
Expand Down
3 changes: 2 additions & 1 deletion service/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ MENU_DISABLE="gpts,music,gallery"
#VISION_MODEL 默认的识图模型 不设置为 gpt-4-vision-preview
VISION_MODEL=gpt-4o


#SYSTEM_MESSAGE 用户自定义 默认角色消息
SYSTEM_MESSAGE=“You are ChatGPT, a large language model trained by OpenAI.”
3 changes: 2 additions & 1 deletion service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ router.post('/session', async (req, res) => {
const turnstile= process.env.TURNSTILE_SITE
const menuDisable= process.env.MENU_DISABLE??""
const visionModel= process.env.VISION_MODEL??""
const systemMessage= process.env.SYSTEM_MESSAGE??""

const data= { disableGpt4,isWsrv,uploadImgSize,theme,isCloseMdPreview,uploadType,
notify , baiduId, googleId,isHideServer,isUpload, auth: hasAuth
, model: currentModel(),amodel,isApiGallery,cmodels,isUploadR2,gptUrl
,turnstile,menuDisable,visionModel
,turnstile,menuDisable,visionModel,systemMessage
}
res.send({ status: 'Success', message: '', data})
}
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "ChatGPT-MJ",
"version": "2.17.8"
"version": "2.17.9"
},
"tauri": {
"allowlist": {
Expand Down
4 changes: 3 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NConfigProvider } from 'naive-ui'
import { NaiveProvider } from '@/components/common'
import { useTheme } from '@/hooks/useTheme'
import { useLanguage } from '@/hooks/useLanguage'
import aiOther from "@/views/mj/aiOther.vue"
const { theme, themeOverrides } = useTheme()
const { language } = useLanguage()
</script>
Expand All @@ -19,4 +19,6 @@ const { language } = useLanguage()
<RouterView />
</NaiveProvider>
</NConfigProvider>
<!-- 处理一下chat 与draw 共有的事情 -->
<aiOther/>
</template>
3 changes: 3 additions & 0 deletions src/api/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ export const getSystemMessage = (uuid?:number )=>{
let producer= 'You are ChatGPT, a large language model trained by OpenAI.'
if(model.includes('claude')) producer= 'You are Claude, a large language model trained by Anthropic.';
if(model.includes('gemini')) producer= 'You are Gemini, a large language model trained by Google.';
//用户自定义系统
if(homeStore.myData.session.systemMessage ) producer= homeStore.myData.session.systemMessage

const DEFAULT_SYSTEM_TEMPLATE = `${producer}
Knowledge cutoff: ${KnowledgeCutOffDate[model]??KnowledgeCutOffDate.default}
Current model: ${model}
Expand Down
2 changes: 2 additions & 0 deletions src/views/mj/aiFooter.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script setup lang="ts">
import aiGpts from "./aiGpts.vue"
import aiGallery from "./aiGallery.vue"
</script>
<template>
<aiGpts/>
<aiGallery/>
<!-- <aiOther/> -->
</template>
7 changes: 4 additions & 3 deletions src/views/mj/aiMobileMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { router } from '@/router'
import aiDrawInput from './aiDrawInput.vue';
import {NDrawerContent,NDrawer} from "naive-ui";
import { isDisableMenu } from '@/api';
const st= ref({show:true})
const goHome =computed( () => {
Expand Down Expand Up @@ -37,17 +38,17 @@ watch(()=>homeStore.myData.act, (n:string)=>{
<SvgIcon icon="ri:wechat-line" class="text-3xl"></SvgIcon>
<div class="text-[13px]">{{$t('mjtab.chat')}}</div>
</div>
<div class="flex items-center justify-center flex-col " @click="homeStore.setMyData({act:'showgpts'}) " >
<div v-if="!isDisableMenu ( 'gpts')" class="flex items-center justify-center flex-col " @click="homeStore.setMyData({act:'showgpts'}) " >
<SvgIcon icon="ri:apps-fill" class="text-3xl"></SvgIcon>
<div class="text-[13px]">GPTs</div>
</div>


<div class="flex items-center justify-center flex-col " @click="homeStore.setMyData({act:'showDraw'}) " :class="[goHome=='draw' ? 'active' : '']" >
<div v-if="!isDisableMenu ( 'draws')" class="flex items-center justify-center flex-col " @click="homeStore.setMyData({act:'showDraw'}) " :class="[goHome=='draw' ? 'active' : '']" >
<SvgIcon icon="ic:outline-palette" class="text-3xl"></SvgIcon>
<div class="text-[13px]">{{$t('mjtab.draw')}}</div>
</div>
<div class="flex items-center justify-center flex-col " @click="homeStore.setMyData({act:'gallery'})" >
<div v-if="!isDisableMenu ( 'gallery')" class="flex items-center justify-center flex-col " @click="homeStore.setMyData({act:'gallery'})" >
<SvgIcon icon="material-symbols:imagesmode-outline" class="text-3xl"></SvgIcon>
<div class="text-[13px]">{{$t('mjtab.gallery')}}</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/views/mj/aiModel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ const saveChat=(type:string)=>{
watch(()=>nGptStore.value.model,(n)=>{
nGptStore.value.gpts=undefined;
let max=4096;
let max=4096*2*2;
if( n.indexOf('vision')>-1){
max=4096;
max=4096*2;
}else if( n.indexOf('gpt-4')>-1 || n.indexOf('16k')>-1 ){ //['16k','8k','32k','gpt-4'].indexOf(n)>-1
max=4096*2;
}else if( n.toLowerCase().includes('claude-3') ){
Expand Down
19 changes: 19 additions & 0 deletions src/views/mj/aiOther.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { mlog } from '@/api';
import { homeStore ,useChatStore} from '@/store';
import { watch } from 'vue';
const chatStore = useChatStore() //const chatStore = useChatStore()
//const dataSources = computed(() => chatStore.getChatByUuid(+uuid))
watch( ()=>homeStore.myData.local,n=>{
if(! chatStore.active) return ;
const dataSources = chatStore.getChatByUuid(+chatStore.active) ;
if( dataSources.length> 0 ){
chatStore.addHistory({ title: 'New Chat', uuid: Date.now(), isEdit: false })
}
})
</script>

<template></template>
14 changes: 8 additions & 6 deletions src/views/mj/aiSider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ import { useBasicLayout } from '@/hooks/useBasicLayout'
const { isMobile } = useBasicLayout()
import { NAvatar,NTooltip } from 'naive-ui'
import { homeStore, useUserStore,useChatStore } from '@/store'
const chatStore = useChatStore()
import defaultAvatar from '@/assets/avatar.jpg'
import { router } from '@/router'
import { isDisableMenu } from "@/api";
import { useRouter } from "vue-router";
//import gallery from '@/views/gallery/index.vue'
const chatStore = useChatStore()
const Setting = defineAsyncComponent(() => import('@/components/common/Setting/index.vue'))
const userStore = useUserStore()
const st= ref({'show':false,showImg:false, menu:[],active:'chat'})
const userInfo = computed(() => userStore.userInfo)
import { router } from '@/router'
import { isDisableMenu } from "@/api";
const urouter = useRouter() //
const goHome =computed( () => {
//router.push('/')
Expand All @@ -41,7 +43,7 @@ const chatId= computed(()=>chatStore.active??'1002' );
<div class="flex-shrink-0 w-[60px] z-[1000] h-full" v-if="!isMobile" data-tauri-drag-region>
<div class="flex h-full select-none flex-col items-center justify-between bg-[#e8eaf1] px-2 pt-4 pb-8 dark:bg-[#25272d]">
<div class="flex flex-col space-y-4 flex-1 " :class="{ 'pt-5': homeStore.myData.isClient }" data-tauri-drag-region>
<a :href="`#/chat/${chatId}`" @click="st.active='chat'" class="router-link-active router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]">
<a @click="st.active='chat'; urouter.push(`/chat`)" class="router-link-active router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]">
<n-tooltip placement="right" trigger="hover">
<template #trigger>
<div class="flex h-full justify-center items-center py-1 flex-col " :class="[ goHome =='Chat' ? 'active' : '']">
Expand All @@ -65,7 +67,7 @@ const chatId= computed(()=>chatStore.active??'1002' );
</a>


<a v-if="!isDisableMenu ( 'draws')" :href="`#/draw/${chatId}`" @click="st.active='draw'" class=" router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]">
<a v-if="!isDisableMenu ( 'draws')" @click="st.active='draw'; urouter.push(`/draw`)" class=" router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]">
<n-tooltip placement="right" trigger="hover">
<template #trigger>
<div class="flex h-full justify-center items-center py-1 flex-col" :class="[goHome=='draw' ? 'active' : '']">
Expand All @@ -92,7 +94,7 @@ const chatId= computed(()=>chatStore.active??'1002' );
</a>


<a v-if="!isDisableMenu ( 'music')" :href="`#/music`" @click="st.active='music'" class=" router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]"
<a v-if="!isDisableMenu ( 'music')" @click="st.active='music'; urouter.push('/music')" class=" router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]"
>
<n-tooltip placement="right" trigger="hover">
<template #trigger>
Expand Down

0 comments on commit 4e00f7f

Please sign in to comment.