Skip to content

Commit

Permalink
2.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dooy committed Oct 10, 2024
1 parent c46473d commit a979e4b
Show file tree
Hide file tree
Showing 21 changed files with 838 additions and 17 deletions.
3 changes: 3 additions & 0 deletions changlog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# 功能升级日志

# 计划
# 2.21.2
- 😄 新增:支持实时语音对话服务 realtime `gpt-4o-realtime-preview`

# 2.21.1
- 😄 优化:dall格式图片本地存储(flex,idemgram 不会图片链接过期而找不到 )
- 😄 优化:kling图片本地存储
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.21.1",
"version": "2.21.2",
"private": false,
"description": "ChatGPT Web Midjourney Proxy",
"author": "Dooy <[email protected]>",
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.21.1"
"version": "2.21.2"
},
"tauri": {
"allowlist": {
Expand Down
10 changes: 10 additions & 0 deletions src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ export default {
"left_turn_forward": "Turn Left and Push Forward"
,kling:'Kling'

,rttab: 'RealTime',
rtinfo: 'Realtime voice conversation service',
rtsetting: 'Please set the server. Currently, Realtime only supports remote services; for local services, please contact the author.',
rjcloded: 'Connection has been disconnected',
checkkey: 'Please check if the API key is correct',
rtsuccess: 'Connection is normal, maintaining the call',
rtservererror: 'WebSocket connection server error!',
rtservererror2: 'Recording is not supported, it may be due to device reasons!',
rtconecting: 'Connecting to the server'

},
"mjset": {
"server": "Server",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/fr-FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,15 @@ export default {
"right_turn_forward": "Tourner à droite et avancer",
"left_turn_forward": "Tourner à gauche et avancer"
,kling:'Kling'
,rttab: 'Voix',
rtinfo: 'Service de conversation vocale en temps réel (realtime)',
rtsetting: 'Veuillez configurer le serveur. Actuellement, Realtime ne prend en charge que les services à distance ; pour les services locaux, veuillez contacter l\'auteur.',
rjcloded: 'La connexion a été déconnectée',
checkkey: 'Veuillez vérifier si la clé API est correcte',
rtsuccess: 'Connexion normale, maintien de l\'appel',
rtservererror: 'Erreur de connexion au serveur WebSocket !',
rtservererror2: 'Enregistrement non pris en charge, cela peut être dû à un problème de matériel !',
rtconecting: 'Connexion au serveur en cours'
},
"mjset": {
"server": "Serveur",
Expand Down
11 changes: 10 additions & 1 deletion src/locales/ko-KR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,16 @@ export default {
"forward_up": "앞으로 밀고 위로 이동하기",
"right_turn_forward": "오른쪽으로 돌리고 앞으로 밀기",
"left_turn_forward": "왼쪽으로 돌리고 앞으로 밀기"
,kling:'Kling'
,kling:'Kling',
rttab: '음성',
rtinfo: '실시간 음성 대화 서비스 (realtime)',
rtsetting: '서버를 설정하십시오. 현재 Realtime은 원격 서비스만 지원합니다. 로컬 서비스가 필요하면 저자에게 문의하십시오.',
rjcloded: '연결이 끊어졌습니다',
checkkey: 'API 키가 올바른지 확인하십시오',
rtsuccess: '연결이 정상이며 통화를 유지하고 있습니다',
rtservererror: 'WebSocket 서버 연결 오류!',
rtservererror2: '녹음이 지원되지 않습니다. 장치 문제일 수 있습니다!',
rtconecting: '서버에 연결 중'
},
"mjset": {
"server": "서버"
Expand Down
11 changes: 10 additions & 1 deletion src/locales/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,16 @@ export default {
"forward_up": "Продвинуть вперед и поднять",
"right_turn_forward": "Повернуть вправо и продвинуться вперед",
"left_turn_forward": "Повернуть влево и продвинуться вперед"
,kling:'Kling'
,kling:'Kling',
rttab: 'Голос',
rtinfo: 'Служба голосового общения в реальном времени (realtime)',
rtsetting: 'Пожалуйста, настройте сервер. В настоящее время Realtime поддерживает только удаленные службы; для локальных услуг свяжитесь с автором.',
rjcloded: 'Соединение разорвано',
checkkey: 'Пожалуйста, проверьте правильность API-ключа',
rtsuccess: 'Соединение нормально, поддерживаем звонок',
rtservererror: 'Ошибка подключения к серверу WebSocket!',
rtservererror2: 'Запись не поддерживается, возможно, это связано с устройством!',
rtconecting: 'Подключение к серверу'

},
"mjset": {
Expand Down
11 changes: 10 additions & 1 deletion src/locales/tr-TR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,16 @@ export default {
"forward_up": "İleri it ve yukarı kaldır",
"right_turn_forward": "Sağa dön ve ileri git",
"left_turn_forward": "Sola dön ve ileri git"
,kling:'Kling'
,kling:'Kling',
rttab: 'Ses',
rtinfo: 'Gerçek zamanlı sesli görüşme hizmeti (realtime)',
rtsetting: 'Lütfen sunucuyu ayarlayın. Şu anda Realtime yalnızca uzaktan hizmetleri desteklemektedir; yerel hizmetler için lütfen yazarla iletişime geçin.',
rjcloded: 'Bağlantı kesildi',
checkkey: 'API anahtarının doğru olup olmadığını kontrol edin',
rtsuccess: 'Bağlantı normal, görüşmeyi sürdürüyor',
rtservererror: 'WebSocket sunucu bağlantı hatası!',
rtservererror2: 'Kaydetme desteklenmiyor, bu cihaz kaynaklı bir sorun olabilir!',
rtconecting: 'Sunucuya bağlanılıyor'
},
"mjset": {
"server": "Sunucu",
Expand Down
9 changes: 9 additions & 0 deletions src/locales/vi-VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ export default {
"right_turn_forward": "Quay phải và đẩy tới",
"left_turn_forward": "Quay trái và đẩy tới"
,kling:'Kling'
,rttab: 'Giọng nói',
rtinfo: 'Dịch vụ hội thoại giọng nói thời gian thực (realtime)',
rtsetting: 'Vui lòng thiết lập máy chủ. Hiện tại, Realtime chỉ hỗ trợ dịch vụ từ xa; nếu cần dịch vụ cục bộ, vui lòng liên hệ với tác giả.',
rjcloded: 'Kết nối đã bị ngắt',
checkkey: 'Vui lòng kiểm tra xem API key có chính xác không',
rtsuccess: 'Kết nối bình thường, duy trì cuộc gọi',
rtservererror: 'Lỗi kết nối máy chủ WebSocket!',
rtservererror2: 'Không hỗ trợ ghi âm, có thể do thiết bị!',
rtconecting: 'Đang kết nối đến máy chủ'
},
"mjset": {
"server": "Máy chủ",
Expand Down
10 changes: 10 additions & 0 deletions src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ export default {
,left_turn_forward: '左旋推进'

,kling:'可灵'

,rttab:'语音'
,rtinfo:'实时语音对话服务(realtime)'
,rtsetting:'请设置服务端,目前Realtime 仅支持远程服务;需本地服务请联系作者'
,rjcloded:'连接已断开'
,checkkey:'请检查 api key 是否正确'
,rtsuccess:'连接正常保持通话'
,rtservererror:'websocket 连接服务器错误!'
,rtservererror2:'不支持录音,可能是设备原因!'
,rtconecting:'正在连接服务器'
},

draw: {
Expand Down
11 changes: 10 additions & 1 deletion src/locales/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,16 @@ export default {
"forward_up": "推進上移",
"right_turn_forward": "右旋推進",
"left_turn_forward": "左旋推進"
,kling:'可灵'
,kling:'可灵',
rttab: '語音',
rtinfo: '實時語音對話服務(realtime)',
rtsetting: '請設置服務器,目前Realtime僅支持遠程服務;需本地服務請聯繫作者',
rjcloded: '連接已斷開',
checkkey: '請檢查api key是否正確',
rtsuccess: '連接正常保持通話',
rtservererror: 'websocket連接服務器錯誤!',
rtservererror2: '不支持錄音,可能是設備原因!',
rtconecting: '正在連接服務器'

},
"mjset": {
Expand Down
111 changes: 111 additions & 0 deletions src/utils/wav_renderer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
const dataMap = new WeakMap();

/**
* Normalizes a Float32Array to Array(m): We use this to draw amplitudes on a graph
* If we're rendering the same audio data, then we'll often be using
* the same (data, m, downsamplePeaks) triplets so we give option to memoize
*/
const normalizeArray = (
data: Float32Array,
m: number,
downsamplePeaks: boolean = false,
memoize: boolean = false
) => {
let cache, mKey, dKey;
if (memoize) {
mKey = m.toString();
dKey = downsamplePeaks.toString();
cache = dataMap.has(data) ? dataMap.get(data) : {};
dataMap.set(data, cache);
cache[mKey] = cache[mKey] || {};
if (cache[mKey][dKey]) {
return cache[mKey][dKey];
}
}
const n = data.length;
const result = new Array(m);
if (m <= n) {
// Downsampling
result.fill(0);
const count = new Array(m).fill(0);
for (let i = 0; i < n; i++) {
const index = Math.floor(i * (m / n));
if (downsamplePeaks) {
// take highest result in the set
result[index] = Math.max(result[index], Math.abs(data[i]));
} else {
result[index] += Math.abs(data[i]);
}
count[index]++;
}
if (!downsamplePeaks) {
for (let i = 0; i < result.length; i++) {
result[i] = result[i] / count[i];
}
}
} else {
for (let i = 0; i < m; i++) {
const index = (i * (n - 1)) / (m - 1);
const low = Math.floor(index);
const high = Math.ceil(index);
const t = index - low;
if (high >= n) {
result[i] = data[n - 1];
} else {
result[i] = data[low] * (1 - t) + data[high] * t;
}
}
}
if (memoize) {
cache[mKey as string][dKey as string] = result;
}
return result;
};

export const WavRenderer = {
/**
* Renders a point-in-time snapshot of an audio sample, usually frequency values
* @param canvas
* @param ctx
* @param data
* @param color
* @param pointCount number of bars to render
* @param barWidth width of bars in px
* @param barSpacing spacing between bars in px
* @param center vertically center the bars
*/
drawBars: (
canvas: HTMLCanvasElement,
ctx: CanvasRenderingContext2D,
data: Float32Array,
color: string,
pointCount: number = 0,
barWidth: number = 0,
barSpacing: number = 0,
center: boolean = false
) => {
pointCount = Math.floor(
Math.min(
pointCount,
(canvas.width - barSpacing) / (Math.max(barWidth, 1) + barSpacing)
)
);
if (!pointCount) {
pointCount = Math.floor(
(canvas.width - barSpacing) / (Math.max(barWidth, 1) + barSpacing)
);
}
if (!barWidth) {
barWidth = (canvas.width - barSpacing) / pointCount - barSpacing;
}
const points = normalizeArray(data, pointCount, true);
for (let i = 0; i < pointCount; i++) {
const amplitude = Math.abs(points[i]);
const height = Math.max(1, amplitude * canvas.height);
const x = barSpacing + i * (barWidth + barSpacing);
const y = center ? (canvas.height - height) / 2 : canvas.height - height;
ctx.fillStyle = color;
ctx.fillRect(x, y, barWidth, height);
}
},
};
2 changes: 2 additions & 0 deletions src/views/mj/aiFooter.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script setup lang="ts">
import aiGpts from "./aiGpts.vue"
import aiGallery from "./aiGallery.vue"
import realtimeLayout from "@/views/wav/realtimeLayout.vue"
</script>
<template>
<aiGpts/>
<aiGallery/>
<!-- <aiOther/> -->
<realtimeLayout/>
</template>
5 changes: 5 additions & 0 deletions src/views/mj/aiMobileMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ watch(()=>homeStore.myData.act, (n:string)=>{
<div class="text-[13px]">GPTs</div>
</div>

<div v-if="!isDisableMenu ( 'realtime')" class="flex items-center justify-center flex-col " @click="homeStore.setMyData({act:'openRealtime'}) " >
<SvgIcon icon="ri:mic-fill" class="text-3xl"></SvgIcon>
<div class="text-[13px]">{{$t('mj.rttab')}}</div>
</div>


<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>
Expand Down
13 changes: 13 additions & 0 deletions src/views/mj/aiSider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ const chatId= computed(()=>chatStore.active??'1002' );
</n-tooltip>
</a>

<a v-if="!isDisableMenu ( 'realtime')" @click="homeStore.setMyData({act:'openRealtime'}) "
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 =='realtime' ? 'active' : '']">
<SvgIcon icon="ri:mic-fill" class="text-3xl flex-1"></SvgIcon>
<span class="text-[10px]">{{$t('mj.rttab')}}</span>
</div>
</template>
{{ $t('mj.rtinfo') }}
</n-tooltip>
</a>




Expand Down
20 changes: 17 additions & 3 deletions src/views/mj/aiTextSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,29 @@
import { homeStore } from '@/store';
import { computed ,ref } from 'vue'
import aiSetServer from './aiSetServer.vue';
import { NTag,NModal } from 'naive-ui'
import { NTag,NModal,NButton } from 'naive-ui'
const isHideServer= computed( ()=>homeStore.myData.session.isHideServer )
const st= ref({show:false})
const pp = defineProps<{msgInfo?:string}>();
const emit =defineEmits(['close'])
const closeed=()=>{
emit('close')
st.value.show=false
}
</script>
<template>
<div class="whitespace-pre-wrap pb-10" v-if="!isHideServer">
<span class=" text-red-400">{{ $t('mj.setTextInfo') }} </span> <NTag type="primary" effect="dark" @click="st.show=true" size="small" round style="cursor: pointer; ">{{ $t('setting.setting') }}</NTag>
<div v-if="pp.msgInfo">
<div v-html="pp.msgInfo"> </div>
<div class="pt-3 text-center">
<NButton type="primary" @click="st.show=true">{{ $t('setting.setting') }} </NButton>
</div>
</div>
<template v-else>
<span class=" text-red-400">{{ $t('mj.setTextInfo') }} </span> <NTag type="primary" effect="dark" @click="st.show=true" size="small" round style="cursor: pointer; ">{{ $t('setting.setting') }}</NTag>
</template>
</div>
<NModal v-model:show="st.show" :title="$t('mjset.server')" preset="card" style="width: 95%; max-width: 640px">
<aiSetServer v-if="st.show" @close="st.show=false"/>
<aiSetServer v-if="st.show" @close="closeed"/>
</NModal>
</template>
23 changes: 23 additions & 0 deletions src/views/wav/an_main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div class="container">
<div class="in-and-out"><div><div></div><div></div><div></div><div></div><div></div></div><div><div></div><div></div><div></div><div></div><div></div></div></div>
</div>
</template>
<style scoped>
@import './css/in-and-out.css';
.container {
-ms-flex-align: center;
align-items: center;
-ms-flex-pack: center;
justify-content: center;
height: 175px;
overflow: hidden;
width: 100%;
position: relative;
display: flex;
min-width: 200px;
--primary: #fafafa;
--secondary: #f9690e;
}
</style>
Loading

0 comments on commit a979e4b

Please sign in to comment.