[Refactor] Change aliases and move test_data.js.
This commit is contained in:
74
src-ui/_test_data.js
Normal file
74
src-ui/_test_data.js
Normal file
@@ -0,0 +1,74 @@
|
||||
export const generateTestConversationData = (num) => {
|
||||
const testDataArray = [];
|
||||
const messagesJa = [
|
||||
"今日はとてもいい天気ですね。",
|
||||
"次の会議は何時に始まりますか?",
|
||||
"新しいプロジェクトについて話しましょう。",
|
||||
"お疲れ様です。今日は早く帰れますか?",
|
||||
"この書類にサインをお願いします。",
|
||||
"次の休暇はどこに行きますか?",
|
||||
"先週のレポートを見ましたか?",
|
||||
"この問題をどうやって解決しますか?",
|
||||
"週末は何をする予定ですか?",
|
||||
"新しいアイデアを聞かせてください。",
|
||||
"こんにちは、調子はどうですか?",
|
||||
"おはようございます、今日の予定は何ですか?",
|
||||
"こんばんは、今日は楽しかったですか?",
|
||||
"ありがとう、助かりました。",
|
||||
"さようなら、また会いましょう。",
|
||||
"はい、分かりました。",
|
||||
"いいえ、ちょっと難しいです。",
|
||||
"すみません、もう一度言ってください。",
|
||||
"お願いします、手伝ってください。",
|
||||
"お疲れ様です、今日も頑張りましょう。",
|
||||
];
|
||||
const messagesEn = [
|
||||
"The weather is very nice today.",
|
||||
"What time does the next meeting start?",
|
||||
"Let's talk about the new project.",
|
||||
"Good job today. Can you leave early today?",
|
||||
"Please sign this document.",
|
||||
"Where are you going for the next vacation?",
|
||||
"Did you see last week's report?",
|
||||
"How do we solve this problem?",
|
||||
"What are your plans for the weekend?",
|
||||
"Tell me about your new idea.",
|
||||
"Hello, how are you?",
|
||||
"Good morning, what are your plans for today?",
|
||||
"Good evening, did you have a good day?",
|
||||
"Thank you, that was helpful.",
|
||||
"Goodbye, see you again.",
|
||||
"Yes, understood.",
|
||||
"No, it's a bit difficult.",
|
||||
"Sorry, could you say that again?",
|
||||
"Please, help me out.",
|
||||
"Good job today, let's do our best again tomorrow.",
|
||||
];
|
||||
const statuses = ["sent", "received"];
|
||||
|
||||
for (let i = 0; i < num; i++) {
|
||||
const uuid = crypto.randomUUID();
|
||||
const date = new Date().toLocaleTimeString(
|
||||
"ja-JP",
|
||||
{ hour12: false, hour: "2-digit", minute: "2-digit" }
|
||||
);
|
||||
const messageIndex = Math.floor(Math.random() * messagesJa.length);
|
||||
const status = statuses[Math.floor(Math.random() * statuses.length)];
|
||||
|
||||
const testData = {
|
||||
id: uuid,
|
||||
category: status,
|
||||
status: status,
|
||||
created_at: date,
|
||||
messages: {
|
||||
original: messagesJa[messageIndex],
|
||||
translated: [
|
||||
messagesEn[messageIndex],
|
||||
],
|
||||
},
|
||||
};
|
||||
testDataArray.push(testData);
|
||||
}
|
||||
|
||||
return testDataArray;
|
||||
};
|
||||
@@ -1,11 +1,16 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { Command } from "@tauri-apps/plugin-shell";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useStartPython } from "@logics/useStartPython";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
import { useStore_SelectableFontFamilyList } from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { useReceiveRoutes } from "@useReceiveRoutes";
|
||||
import { store, useStore_SelectableFontFamilyList } from "@store";
|
||||
import { arrayToObject } from "@utils";
|
||||
|
||||
import {
|
||||
useNotificationStatus,
|
||||
} from "@logics_common";
|
||||
|
||||
export const StartPythonController = () => {
|
||||
const { asyncStartPython } = useStartPython();
|
||||
const hasRunRef = useRef(false);
|
||||
@@ -26,6 +31,34 @@ export const StartPythonController = () => {
|
||||
return null;
|
||||
};
|
||||
|
||||
const useStartPython = () => {
|
||||
const { receiveRoutes } = useReceiveRoutes();
|
||||
const { showNotification_Success, showNotification_Error } = useNotificationStatus();
|
||||
|
||||
const asyncStartPython = async () => {
|
||||
const command = Command.sidecar("bin/VRCT-sidecar");
|
||||
command.on("error", error => console.error(`error: "${error}"`));
|
||||
command.stdout.on("data", (line) => {
|
||||
let parsed_data = "";
|
||||
try {
|
||||
parsed_data = JSON.parse(line);
|
||||
receiveRoutes(parsed_data);
|
||||
} catch (error) {
|
||||
console.log(error, line);
|
||||
}
|
||||
});
|
||||
command.stderr.on("data", line => {
|
||||
showNotification_Error(
|
||||
`An error occurred. Please restart VRCT or contact the developers. The last line:${JSON.stringify(line)}`, { hide_duration: null });
|
||||
console.error("stderr", line);
|
||||
});
|
||||
const backend_subprocess = await command.spawn();
|
||||
store.backend_subprocess = backend_subprocess;
|
||||
};
|
||||
|
||||
return { asyncStartPython };
|
||||
};
|
||||
|
||||
const useAsyncFetchFonts = () => {
|
||||
const { updateSelectableFontFamilyList } = useStore_SelectableFontFamilyList();
|
||||
const asyncFetchFonts = async () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
useStore_MessageInputValue,
|
||||
} from "@store";
|
||||
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMessage = () => {
|
||||
const { currentMessageLogs, addMessageLogs, updateMessageLogs } = useStore_MessageLogs();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useOpenFolder = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import semver from "semver";
|
||||
|
||||
import { useStore_SoftwareVersion, useStore_LatestSoftwareVersionInfo } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSoftwareVersion = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useUpdateSoftware = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
useStore_SpeakerThresholdCheckStatus,
|
||||
} from "@store";
|
||||
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useVolume = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { currentMonitor, availableMonitors, PhysicalPosition, PhysicalSize } from "@tauri-apps/api/window";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { useStore_IsBreakPoint } from "@store";
|
||||
import { useUiScaling } from "@logics_configs";
|
||||
import { store } from "@store";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_OscIpAddress } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useOscIpAddress = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_OscPort } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { useNotificationStatus } from "@logics_common";
|
||||
|
||||
export const useOscPort = () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
useStore_WebsocketHost,
|
||||
useStore_WebsocketPort,
|
||||
} from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useWebsocket = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MessageLogUiScaling } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMessageLogUiScaling = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// import { useStore_RestoreWindowGeometry } from "@store";
|
||||
// import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
// import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
// export const useRestoreWindowGeometry = () => {
|
||||
// const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedFontFamily } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedFontFamily = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SendMessageButtonType } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSendMessageButtonType = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_Transparency } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useTransparency = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_UiLanguage } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useUiLanguage = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_UiScaling } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useUiScaling = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableAutoMicSelect } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableAutoMicSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableAutoSpeakerSelect } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableAutoSpeakerSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MicDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMicDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MicHostList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMicHostList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MicThreshold, useStore_EnableAutomaticMicThreshold } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMicThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedMicDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedMicDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedMicHost } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedMicHost = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedSpeakerDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedSpeakerDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SpeakerDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSpeakerDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SpeakerThreshold, useStore_EnableAutomaticSpeakerThreshold } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSpeakerThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { store, useStore_Hotkeys } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { useNotificationStatus } from "@logics_common";
|
||||
import { useMainFunction } from "@logics_main";
|
||||
import { register, unregisterAll, isRegistered } from "@tauri-apps/plugin-global-shortcut";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableAutoClearMessageInputBox } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableAutoClearMessageInputBox = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableAutoExportMessageLogs } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableAutoExportMessageLogs = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableNotificationVrcSfx } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableNotificationVrcSfx = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableSendMessageToVrc } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableSendMessageToVrc = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableSendOnlyTranslatedMessages } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableSendOnlyTranslatedMessages = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableSendReceivedMessageToVrc } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableSendReceivedMessageToVrc = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_EnableVrcMicMuteSync } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useEnableVrcMicMuteSync = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SendMessageButtonType } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSendMessageButtonType = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
useStore_FetchedPluginsInfo,
|
||||
useStore_LoadedPlugins,
|
||||
} from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
import { transform } from "@babel/standalone";
|
||||
import { writeFile, mkdir, exists, remove, readDir, BaseDirectory, readTextFile } from "@tauri-apps/plugin-fs";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MicMaxWords } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMicMaxWords = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MicPhraseTimeout } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMicPhraseTimeout = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MicRecordTimeout } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMicRecordTimeout = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_MicWordFilterList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMicWordFilterList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectableWhisperComputeDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectableWhisperComputeDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedTranscriptionEngine } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedTranscriptionEngine = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedWhisperComputeDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedWhisperComputeDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedWhisperWeightType } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedWhisperWeightType = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SpeakerMaxWords } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSpeakerMaxWords = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SpeakerPhraseTimeout } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSpeakerPhraseTimeout = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SpeakerRecordTimeout } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSpeakerRecordTimeout = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_WhisperWeightTypeStatus } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useWhisperWeightTypeStatus = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_CTranslate2WeightTypeStatus } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useCTranslate2WeightTypeStatus = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_DeepLAuthKey } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNotificationStatus } from "@logics_common";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectableCTranslate2ComputeDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedCTranslate2ComputeDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedCTranslate2ComputeDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedCTranslate2WeightType } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectedCTranslate2WeightType = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_IsEnabledOverlayLargeLog } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useIsEnabledOverlayLargeLog = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_IsEnabledOverlaySmallLog } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useIsEnabledOverlaySmallLog = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_OverlayLargeLogSettings } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useOverlayLargeLogSettings = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_OverlayShowOnlyTranslatedMessages } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useOverlayShowOnlyTranslatedMessages = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_OverlaySmallLogSettings } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useOverlaySmallLogSettings = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSendTextToOverlay = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_IsMainPageCompactMode } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useIsMainPageCompactMode = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectedPresetTabNumber, useStore_EnableMultiTranslation, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useLanguageSettings = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
useStore_TranscriptionReceiveStatus,
|
||||
useStore_ForegroundStatus,
|
||||
} from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useMainFunction = () => {
|
||||
const appWindow = store.appWindow;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { store } from "@store";
|
||||
import { useStore_MessageInputBoxRatio } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { clampMinMax } from "@utils";
|
||||
export const useMessageInputBoxRatio = () => {
|
||||
const appWindow = store.appWindow;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useStore_SelectableLanguageList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSelectableLanguageList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import { Command } from "@tauri-apps/plugin-shell";
|
||||
import { store } from "@store";
|
||||
import { useReceiveRoutes } from "./useReceiveRoutes";
|
||||
import {
|
||||
useNotificationStatus,
|
||||
} from "@logics_common";
|
||||
|
||||
export const useStartPython = () => {
|
||||
const { receiveRoutes } = useReceiveRoutes();
|
||||
const { showNotification_Success, showNotification_Error } = useNotificationStatus();
|
||||
|
||||
const asyncStartPython = async () => {
|
||||
const command = Command.sidecar("bin/VRCT-sidecar");
|
||||
command.on("error", error => console.error(`error: "${error}"`));
|
||||
command.stdout.on("data", (line) => {
|
||||
let parsed_data = "";
|
||||
try {
|
||||
parsed_data = JSON.parse(line);
|
||||
receiveRoutes(parsed_data);
|
||||
} catch (error) {
|
||||
console.log(error, line);
|
||||
}
|
||||
});
|
||||
command.stderr.on("data", line => {
|
||||
showNotification_Error(
|
||||
`An error occurred. Please restart VRCT or contact the developers. The last line:${JSON.stringify(line)}`, { hide_duration: null });
|
||||
console.error("stderr", line)
|
||||
});
|
||||
const backend_subprocess = await command.spawn();
|
||||
store.backend_subprocess = backend_subprocess;
|
||||
};
|
||||
|
||||
return { asyncStartPython };
|
||||
};
|
||||
@@ -5,8 +5,9 @@ import {
|
||||
} from "jotai";
|
||||
|
||||
import {
|
||||
generateTestData,
|
||||
} from "@test_data";
|
||||
generateTestConversationData,
|
||||
} from "./_test_data.js"
|
||||
|
||||
import {
|
||||
translator_status,
|
||||
ctranslate2_weight_type_status,
|
||||
@@ -169,7 +170,7 @@ export const { atomInstance: Atom_SelectableLanguageList, useHook: useStore_Sele
|
||||
|
||||
// Message Container
|
||||
export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook([], "MessageLogs");
|
||||
// export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestData(20), "MessageLogs"); // For testing
|
||||
// export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestConversationData(20), "MessageLogs"); // For testing
|
||||
export const { atomInstance: Atom_MessageInputBoxRatio, useHook: useStore_MessageInputBoxRatio } = createAtomWithHook(20, "MessageInputBoxRatio");
|
||||
export const { atomInstance: Atom_MessageInputValue, useHook: useStore_MessageInputValue } = createAtomWithHook("", "MessageInputValue");
|
||||
export const { atomInstance: Atom_IsVisibleResendButton, useHook: useStore_IsVisibleResendButton } = createAtomWithHook(false, "IsVisibleResendButton", {is_state_ok: true});
|
||||
|
||||
Reference in New Issue
Block a user