Merge branch 'bugfix_compute_type' into develop

This commit is contained in:
Sakamoto Shiina
2025-09-28 02:10:23 +09:00
24 changed files with 861 additions and 192 deletions

View File

@@ -8,12 +8,13 @@ import {
useStore_SpeakerPhraseTimeout,
useStore_SpeakerRecordTimeout,
useStore_SelectableWhisperComputeDeviceList,
useStore_SelectableTranscriptionComputeDeviceList,
useStore_SelectedTranscriptionEngine,
useStore_SelectedWhisperComputeDevice,
useStore_SelectedWhisperWeightType,
useStore_SelectedTranscriptionComputeDevice,
useStore_WhisperWeightTypeStatus,
useStore_SelectedWhisperWeightType,
useStore_SelectedTranscriptionComputeType,
useStore_MicAvgLogprob,
useStore_MicNoSpeechProb,
@@ -21,7 +22,7 @@ import {
useStore_SpeakerNoSpeechProb,
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { transformToIndexedArray } from "@utils";
import { transformToIndexedArray, arrayToObject } from "@utils";
import { useNotificationStatus } from "@logics_common";
export const useTranscription = () => {
@@ -41,10 +42,15 @@ export const useTranscription = () => {
// Transcription Engines
const { currentSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, pendingSelectedTranscriptionEngine } = useStore_SelectedTranscriptionEngine();
const { currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, pendingWhisperWeightTypeStatus } = useStore_WhisperWeightTypeStatus();
const { currentSelectedWhisperWeightType, updateSelectedWhisperWeightType, pendingSelectedWhisperWeightType } = useStore_SelectedWhisperWeightType();
const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList();
const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice();
const { currentSelectedTranscriptionComputeType, updateSelectedTranscriptionComputeType, pendingSelectedTranscriptionComputeType } = useStore_SelectedTranscriptionComputeType();
const { currentSelectableTranscriptionComputeDeviceList, updateSelectableTranscriptionComputeDeviceList, pendingSelectableTranscriptionComputeDeviceList } = useStore_SelectableTranscriptionComputeDeviceList();
const { currentSelectedTranscriptionComputeDevice, updateSelectedTranscriptionComputeDevice, pendingSelectedTranscriptionComputeDevice } = useStore_SelectedTranscriptionComputeDevice();
// Advanced Settings
const { currentMicAvgLogprob, updateMicAvgLogprob, pendingMicAvgLogprob } = useStore_MicAvgLogprob();
@@ -246,6 +252,24 @@ export const useTranscription = () => {
asyncStdoutToPython("/run/download_whisper_weight", weight_type);
};
const getSelectedTranscriptionComputeType = () => {
pendingSelectedTranscriptionComputeType();
asyncStdoutToPython("/get/data/selected_transcription_compute_type");
};
const setSelectedTranscriptionComputeType = (selected_transcription_compute_type) => {
pendingSelectedTranscriptionComputeType();
asyncStdoutToPython("/set/data/selected_transcription_compute_type", selected_transcription_compute_type);
};
const setSuccessSelectedTranscriptionComputeType = (selected_transcription_compute_type) => {
updateSelectedTranscriptionComputeType(selected_transcription_compute_type);
showNotification_SaveSuccess();
};
// Transcription Engines (Selected Weight Type)
const getSelectedWhisperWeightType = () => {
pendingSelectedWhisperWeightType();
@@ -263,28 +287,28 @@ export const useTranscription = () => {
};
// Transcription Engines (Compute Device List)
const getSelectableWhisperComputeDeviceList = () => {
pendingSelectableWhisperComputeDeviceList();
const getSelectableTranscriptionComputeDeviceList = () => {
pendingSelectableTranscriptionComputeDeviceList();
asyncStdoutToPython("/get/data/transcription_compute_device_list");
};
const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => {
updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload));
const updateSelectableTranscriptionComputeDeviceList_FromBackend = (payload) => {
updateSelectableTranscriptionComputeDeviceList(transformToIndexedArray(payload));
};
// Transcription Engines (Selected Compute Device)
const getSelectedWhisperComputeDevice = () => {
pendingSelectedWhisperComputeDevice();
const getSelectedTranscriptionComputeDevice = () => {
pendingSelectedTranscriptionComputeDevice();
asyncStdoutToPython("/get/data/selected_transcription_compute_device");
};
const setSelectedWhisperComputeDevice = (selected_transcription_compute_device) => {
pendingSelectedWhisperComputeDevice();
const setSelectedTranscriptionComputeDevice = (selected_transcription_compute_device) => {
pendingSelectedTranscriptionComputeDevice();
asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device);
};
const setSuccessSelectedWhisperComputeDevice = (dev) => {
updateSelectedWhisperComputeDevice(dev);
const setSuccessSelectedTranscriptionComputeDevice = (dev) => {
updateSelectedTranscriptionComputeDevice(dev);
showNotification_SaveSuccess();
};
@@ -416,16 +440,24 @@ export const useTranscription = () => {
setSelectedWhisperWeightType,
setSuccessSelectedWhisperWeightType,
currentSelectableWhisperComputeDeviceList,
getSelectableWhisperComputeDeviceList,
updateSelectableWhisperComputeDeviceList,
updateSelectableWhisperComputeDeviceList_FromBackend,
currentSelectedWhisperComputeDevice,
getSelectedWhisperComputeDevice,
updateSelectedWhisperComputeDevice,
setSelectedWhisperComputeDevice,
setSuccessSelectedWhisperComputeDevice,
currentSelectedTranscriptionComputeType,
getSelectedTranscriptionComputeType,
updateSelectedTranscriptionComputeType,
setSelectedTranscriptionComputeType,
setSuccessSelectedTranscriptionComputeType,
currentSelectableTranscriptionComputeDeviceList,
getSelectableTranscriptionComputeDeviceList,
updateSelectableTranscriptionComputeDeviceList,
updateSelectableTranscriptionComputeDeviceList_FromBackend,
currentSelectedTranscriptionComputeDevice,
getSelectedTranscriptionComputeDevice,
updateSelectedTranscriptionComputeDevice,
setSelectedTranscriptionComputeDevice,
setSuccessSelectedTranscriptionComputeDevice,
// Advanced
// Mic Avg Logprob

View File

@@ -1,13 +1,14 @@
import {
useStore_CTranslate2WeightTypeStatus,
useStore_SelectedCTranslate2WeightType,
useStore_SelectableCTranslate2ComputeDeviceList,
useStore_SelectedCTranslate2ComputeDevice,
useStore_SelectedTranslationComputeType,
useStore_SelectableTranslationComputeDeviceList,
useStore_SelectedTranslationComputeDevice,
useStore_DeepLAuthKey,
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { useI18n } from "@useI18n";
import { transformToIndexedArray } from "@utils";
import { transformToIndexedArray, arrayToObject } from "@utils";
import { useNotificationStatus } from "@logics_common";
export const useTranslation = () => {
@@ -17,8 +18,12 @@ export const useTranslation = () => {
const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus();
const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType();
const { currentSelectableCTranslate2ComputeDeviceList, updateSelectableCTranslate2ComputeDeviceList, pendingSelectableCTranslate2ComputeDeviceList } = useStore_SelectableCTranslate2ComputeDeviceList();
const { currentSelectedCTranslate2ComputeDevice, updateSelectedCTranslate2ComputeDevice, pendingSelectedCTranslate2ComputeDevice } = useStore_SelectedCTranslate2ComputeDevice();
const { currentSelectedTranslationComputeType, updateSelectedTranslationComputeType, pendingSelectedTranslationComputeType } = useStore_SelectedTranslationComputeType();
const { currentSelectableTranslationComputeDeviceList, updateSelectableTranslationComputeDeviceList, pendingSelectableTranslationComputeDeviceList } = useStore_SelectableTranslationComputeDeviceList();
const { currentSelectedTranslationComputeDevice, updateSelectedTranslationComputeDevice, pendingSelectedTranslationComputeDevice } = useStore_SelectedTranslationComputeDevice();
const { currentDeepLAuthKey, updateDeepLAuthKey, pendingDeepLAuthKey } = useStore_DeepLAuthKey();
@@ -80,28 +85,45 @@ export const useTranslation = () => {
};
const getSelectableCTranslate2ComputeDeviceList = () => {
pendingSelectableCTranslate2ComputeDeviceList();
const getSelectedTranslationComputeType = () => {
pendingSelectedTranslationComputeType();
asyncStdoutToPython("/get/data/selected_translation_compute_type");
};
const setSelectedTranslationComputeType = (selected_translation_compute_type) => {
pendingSelectedTranslationComputeType();
asyncStdoutToPython("/set/data/selected_translation_compute_type", selected_translation_compute_type);
};
const setSuccessSelectedTranslationComputeType = (selected_translation_compute_type) => {
updateSelectedTranslationComputeType(selected_translation_compute_type);
showNotification_SaveSuccess();
};
const getSelectableTranslationComputeDeviceList = () => {
pendingSelectableTranslationComputeDeviceList();
asyncStdoutToPython("/get/data/translation_compute_device_list");
};
const updateSelectableCTranslate2ComputeDeviceList_FromBackend = (payload) => {
updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload));
const updateSelectableTranslationComputeDeviceList_FromBackend = (payload) => {
updateSelectableTranslationComputeDeviceList(transformToIndexedArray(payload));
};
const getSelectedCTranslate2ComputeDevice = () => {
pendingSelectedCTranslate2ComputeDevice();
const getSelectedTranslationComputeDevice = () => {
pendingSelectedTranslationComputeDevice();
asyncStdoutToPython("/get/data/selected_translation_compute_device");
};
const setSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => {
pendingSelectedCTranslate2ComputeDevice();
const setSelectedTranslationComputeDevice = (selected_translation_compute_device) => {
pendingSelectedTranslationComputeDevice();
asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device);
};
const setSuccessSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => {
updateSelectedCTranslate2ComputeDevice(selected_translation_compute_device);
const setSuccessSelectedTranslationComputeDevice = (selected_translation_compute_device) => {
updateSelectedTranslationComputeDevice(selected_translation_compute_device);
showNotification_SaveSuccess();
};
@@ -146,16 +168,24 @@ export const useTranslation = () => {
setSelectedCTranslate2WeightType,
setSuccessSelectedCTranslate2WeightType,
currentSelectableCTranslate2ComputeDeviceList,
getSelectableCTranslate2ComputeDeviceList,
updateSelectableCTranslate2ComputeDeviceList,
updateSelectableCTranslate2ComputeDeviceList_FromBackend,
currentSelectedCTranslate2ComputeDevice,
getSelectedCTranslate2ComputeDevice,
updateSelectedCTranslate2ComputeDevice,
setSelectedCTranslate2ComputeDevice,
setSuccessSelectedCTranslate2ComputeDevice,
currentSelectedTranslationComputeType,
getSelectedTranslationComputeType,
updateSelectedTranslationComputeType,
setSelectedTranslationComputeType,
setSuccessSelectedTranslationComputeType,
currentSelectableTranslationComputeDeviceList,
getSelectableTranslationComputeDeviceList,
updateSelectableTranslationComputeDeviceList,
updateSelectableTranslationComputeDeviceList_FromBackend,
currentSelectedTranslationComputeDevice,
getSelectedTranslationComputeDevice,
updateSelectedTranslationComputeDevice,
setSelectedTranslationComputeDevice,
setSuccessSelectedTranslationComputeDevice,
currentDeepLAuthKey,
getDeepLAuthKey,

View File

@@ -168,19 +168,22 @@ export const ROUTE_META_LIST = [
{ endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deleteSuccessDeepLAuthKey" },
// Translation (AI Models)
{ endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" },
{ endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" },
{ endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2WeightType" },
{ endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" },
{ endpoint: "/run/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" },
{ endpoint: "/get/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" },
{ endpoint: "/set/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeType" },
{ endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "downloadedCTranslate2WeightType" },
{ endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null },
{ endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" },
{ endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableTranslationComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" },
{ endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2ComputeDevice" },
{ endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeDevice" },
{ endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeDevice" },
// Transcription
@@ -211,18 +214,22 @@ export const ROUTE_META_LIST = [
{ endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" },
{ endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" },
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" },
{ endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" },
{ endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" },
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" },
{ endpoint: "/run/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" },
{ endpoint: "/get/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" },
{ endpoint: "/set/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeType" },
{ endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "downloadedWhisperWeightType" },
{ endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null },
{ endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadProgressWhisperWeightTypeStatus" },
{ endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" },
{ endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperComputeDevice" },
{ endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableTranscriptionComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeDevice" },
{ endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeDevice" },
// Transcription (Advanced)
{ endpoint: "/get/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateMicAvgLogprob" },