@assistant-ui/react
Version:
React components for AI chat.
19 lines (18 loc) • 694 B
JavaScript
"use client";
// src/primitive-hooks/thread/useThreadIf.tsx
import { useThread } from "../../context/index.mjs";
var useThreadIf = (props) => {
return useThread((thread) => {
if (props.empty === true && thread.messages.length !== 0) return false;
if (props.empty === false && thread.messages.length === 0) return false;
if (props.running === true && !thread.isRunning) return false;
if (props.running === false && thread.isRunning) return false;
if (props.disabled === true && thread.isDisabled) return false;
if (props.disabled === false && thread.isDisabled) return false;
return true;
});
};
export {
useThreadIf
};
//# sourceMappingURL=useThreadIf.mjs.map