[Update] UI: Implement LLM connection handling and add connection check UI components.(Test UI)

This commit is contained in:
Sakamoto Shiina
2025-11-19 17:19:39 +09:00
parent e1125ae241
commit ef06cd1c7a
10 changed files with 152 additions and 2 deletions

View File

@@ -14,4 +14,5 @@ export { useHandleNetworkConnection } from "./useHandleNetworkConnection";
export { useHandleOscQuery } from "./useHandleOscQuery";
export { useIsOscAvailable } from "./useIsOscAvailable";
export { useIsVrctAvailable } from "./useIsVrctAvailable";
export { useFetch } from "./useFetch";
export { useFetch } from "./useFetch";
export { useLLMConnection } from "./useLLMConnection";

View File

@@ -0,0 +1,47 @@
import { useStdoutToPython } from "@useStdoutToPython";
import {
useStore_IsLMStudioConnected,
useStore_IsOllamaConnected,
} from "@store";
export const useLLMConnection = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const {
currentIsLMStudioConnected,
updateIsLMStudioConnected,
pendingIsLMStudioConnected,
} = useStore_IsLMStudioConnected();
const {
currentIsOllamaConnected,
updateIsOllamaConnected,
pendingIsOllamaConnected,
} = useStore_IsOllamaConnected();
const checkConnection_LMStudio = () => {
pendingIsLMStudioConnected();
asyncStdoutToPython("/run/lmstudio_connection");
};
const setConnectionStatus_LMStudio = (is_connected) => {
updateIsLMStudioConnected(is_connected);
};
const checkConnection_Ollama = () => {
pendingIsOllamaConnected();
asyncStdoutToPython("/run/ollama_connection");
};
const setConnectionStatus_Ollama = (is_connected) => {
updateIsOllamaConnected(is_connected);
};
return {
currentIsLMStudioConnected,
updateIsLMStudioConnected,
setConnectionStatus_LMStudio,
checkConnection_LMStudio,
currentIsOllamaConnected,
updateIsOllamaConnected,
setConnectionStatus_Ollama,
checkConnection_Ollama,
};
};