[Update] UI: Implement LLM connection handling and add connection check UI components.(Test UI)
This commit is contained in:
@@ -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";
|
||||
47
src-ui/logics/common/useLLMConnection.js
Normal file
47
src-ui/logics/common/useLLMConnection.js
Normal 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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user