diff --git a/changlog.md b/changlog.md index d860d5fe58..9e17bf91d3 100644 --- a/changlog.md +++ b/changlog.md @@ -1,16 +1,20 @@ # 功能升级日志 # 计划 +# 2.19.6 +- 😄 新增:gpt-4o-mini模型 +- 🐞 修复:viggle 下载有问题 + # 2.19.5 - 🐞 修复:后续会有luma尾帧么 #452 -- +- 😄 新增:viggle pro 跟 relax 能相互切换 # 2.19.4 - 🐞 修复:luma pro 与 relax版本切换 获取任务有问题 -- 😄 新增:viggle pro 跟 relax 能相互切换 + # 2.19.3 -- 🐞 修复:viggle个人上传视频无效 +- 🐞 修复:viggle 个人上传视频无效 # 2.19.2 - 😄 新增:跳舞视频viggle模块 diff --git a/package.json b/package.json index fcb3e75d0e..f50c526a2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chatgpt-web-midjourney-proxy", - "version": "2.19.5", + "version": "2.19.6", "private": false, "description": "ChatGPT Web Midjourney Proxy", "author": "Dooy ", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e0320facc5..ed3ff4d82a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "ChatGPT-MJ", - "version": "2.19.5" + "version": "2.19.6" }, "tauri": { "allowlist": { diff --git a/src/api/openapi.ts b/src/api/openapi.ts index 93b829257f..4c752ce04a 100644 --- a/src/api/openapi.ts +++ b/src/api/openapi.ts @@ -23,6 +23,8 @@ export const KnowledgeCutOffDate: Record = { "gpt-4-turbo-2024-04-09": "2023-12", "gpt-4o-2024-05-13": "2023-10", "gpt-4o": "2023-10", + "gpt-4o-mini": "2023-10", + "gpt-4o-mini-2024-07-18": "2023-10", "gpt-4-turbo": "2023-12", "gpt-4-turbo-preview": "2023-12", "claude-3-opus-20240229": "2023-08", diff --git a/src/api/runway.ts b/src/api/runway.ts new file mode 100644 index 0000000000..e25890d875 --- /dev/null +++ b/src/api/runway.ts @@ -0,0 +1,122 @@ +import { gptServerStore, homeStore, useAuthStore } from "@/store"; +import { mlog } from "./mjapi"; + +function getHeaderAuthorization(){ + let headers={} + if( homeStore.myData.vtoken ){ + const vtokenh={ 'x-vtoken': homeStore.myData.vtoken ,'x-ctoken': homeStore.myData.ctoken}; + headers= {...headers, ...vtokenh} + } + if(!gptServerStore.myData.RUNWAY_KEY){ + const authStore = useAuthStore() + if( authStore.token ) { + const bmi= { 'x-ptoken': authStore.token }; + headers= {...headers, ...bmi } + return headers; + } + return headers + } + const bmi={ + 'Authorization': 'Bearer ' +gptServerStore.myData.RUNWAY_KEY + } + headers= {...headers, ...bmi } + return headers +} + +export const getUrl=(url:string)=>{ + if(url.indexOf('http')==0) return url; + + const pro_prefix= url.indexOf('/pro')>-1?'/pro':'';//homeStore.myData.is_luma_pro?'/pro':'' + url= url.replaceAll('/pro','') + if(gptServerStore.myData.RUNWAY_SERVER ){ + if(gptServerStore.myData.RUNWAY_SERVER.indexOf('/pro')>0){ + return `${ gptServerStore.myData.RUNWAY_SERVER}/runway${url}`; + } + return `${ gptServerStore.myData.RUNWAY_SERVER}${pro_prefix}/runway${url}`; + } + return `${pro_prefix}/runway${url}`; +} + + +export const runwayFetch=(url:string,data?:any,opt2?:any )=>{ + mlog('viggleFetch', url ); + let headers= opt2?.upFile?{}: {'Content-Type':'application/json'} + + if(opt2 && opt2.headers ) headers= opt2.headers; + + headers={...headers,...getHeaderAuthorization()} + + return new Promise((resolve, reject) => { + let opt:RequestInit ={method:'GET'}; + + opt.headers= headers ; + if(opt2?.upFile ){ + opt.method='POST'; + opt.body=data as FormData ; + } + else if(data) { + opt.body= JSON.stringify(data) ; + opt.method='POST'; + } + fetch(getUrl(url), opt ) + .then( async (d) =>{ + if (!d.ok) { + let msg = '发生错误: '+ d.status + try{ + let bjson:any = await d.json(); + msg = '('+ d.status+')发生错误: '+(bjson?.error?.message??'' ) + }catch( e ){ + } + homeStore.myData.ms && homeStore.myData.ms.error(msg ) + throw new Error( msg ); + } + + d.json().then(d=> resolve(d)).catch(e=>{ + + homeStore.myData.ms && homeStore.myData.ms.error('发生错误'+ e ) + reject(e) + } + )}) + .catch(e=>{ + if (e.name === 'TypeError' && e.message === 'Failed to fetch') { + homeStore.myData.ms && homeStore.myData.ms.error('跨域|CORS error' ) + } + else homeStore.myData.ms && homeStore.myData.ms.error('发生错误:'+e ) + mlog('e', e.stat ) + reject(e) + }) + }) + +} + + +export const runwayUpload= async (file:any , type :string)=>{ + let obj={ + "filename": file.name, + "numberOfParts": 1, + type //"DATASET_PREVIEW" + } + const d:any = await runwayFetch('/uploads',obj) + mlog("runwayUpload",d) + + const response= await fetch( d.uploadUrls[0], { + method: 'PUT', + body: file, + headers: { + 'Content-Type': d.uploadHeaders["Content-Type"], + 'Accept': '/', + 'Accept-Language': 'zh-CN,zh;q=0.9', + 'Connection': 'keep-alive' + } + }) ; + //const djson:any = await response.json(); + if (response.status!=200){ + throw "upload file faile" + } + //mlog("runwayUpload2", djson) + // return djson uploads/0e01608a-89f8-4cb8-920a-669813fb224f/complete + let obj2={"parts":[{"PartNumber":1,"ETag":"ca3b00c313b6fd9a5c48889ad16f7d5e"}]} + const d2:any = await runwayFetch(`/uploads/${d.id}/complete`, obj2 ) + mlog("runwayUpload2", d2) + return d2; +} diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index f78475fe00..fad3418c0f 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -445,6 +445,11 @@ export default { download:'下载', extend:'延展', + runwayabout:'Runway 相关', + runwayserver:'Runway 接口地址', + setOpenKeyPlaceholder2:'Runway API 的key, 可不填', + endImg:'尾帧图', + } ,dance:{ menu:"舞蹈", diff --git a/src/store/homeStore.ts b/src/store/homeStore.ts index 2ef643907b..4bf1dc3065 100644 --- a/src/store/homeStore.ts +++ b/src/store/homeStore.ts @@ -106,10 +106,14 @@ export interface gptServerType{ LUMA_KEY:string VIGGLE_SERVER:string VIGGLE_KEY:string + RUNWAY_SERVER:string + RUNWAY_KEY:string IS_SET_SYNC?:boolean GPTS_GX?:boolean IS_LUMA_PRO?:boolean IS_VIGGLE_PRO?:boolean + TAB_VIDEO?:string + } const getServerDefault=()=>{ @@ -127,6 +131,9 @@ let v:gptServerType={ LUMA_KEY:'', VIGGLE_SERVER:'', VIGGLE_KEY:'', + TAB_VIDEO:'luma', + RUNWAY_SERVER:'', + RUNWAY_KEY:'' } return v ; } diff --git a/src/views/luma/lumaInput.vue b/src/views/luma/lumaInput.vue new file mode 100644 index 0000000000..afe4598bc7 --- /dev/null +++ b/src/views/luma/lumaInput.vue @@ -0,0 +1,199 @@ + + + \ No newline at end of file diff --git a/src/views/luma/runwayInput.vue b/src/views/luma/runwayInput.vue new file mode 100644 index 0000000000..98151c57f7 --- /dev/null +++ b/src/views/luma/runwayInput.vue @@ -0,0 +1,55 @@ + + \ No newline at end of file diff --git a/src/views/luma/runwayList.vue b/src/views/luma/runwayList.vue new file mode 100644 index 0000000000..bea0bf77b4 --- /dev/null +++ b/src/views/luma/runwayList.vue @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/src/views/luma/video.vue b/src/views/luma/video.vue index ed0ec0a873..26ef8e9599 100644 --- a/src/views/luma/video.vue +++ b/src/views/luma/video.vue @@ -1,6 +1,9 @@