(props: {
data: {
id: string;
is_generating: boolean;
approved: boolean;
generation_failed: boolean;
approval_answer_groups: { name: string }[];
group_id: string;
};
})
| 43 | import { EditQuestionModal } from "./addQuestionModal"; |
| 44 | |
| 45 | export function VerifyQuestionScreen(props: { |
| 46 | data: { |
| 47 | id: string; |
| 48 | is_generating: boolean; |
| 49 | approved: boolean; |
| 50 | generation_failed: boolean; |
| 51 | approval_answer_groups: { name: string }[]; |
| 52 | group_id: string; |
| 53 | }; |
| 54 | }) { |
| 55 | const { profile } = useProfile(); |
| 56 | const router = useRouter(); |
| 57 | const supabase = useSupabaseClient<Database>(); |
| 58 | |
| 59 | const [questionText, setQuestionText] = useState<string>(""); |
| 60 | const [warningModalData, setWarningModalData] = useState<WarningModalData>({ |
| 61 | title: "", |
| 62 | description: "", |
| 63 | actionColour: "red", |
| 64 | open: false, |
| 65 | action: () => {}, |
| 66 | setOpen: () => setWarningModalData((p) => ({ ...p, open: false })), |
| 67 | actionName: "Regenerate Answer", |
| 68 | }); |
| 69 | const [messages, setMessages] = useState<StreamingStepInput[]>([]); |
| 70 | const [allMessageData, setAllMessageData] = useState<UIMessageData[]>([]); |
| 71 | const [followUps, setFollowups] = useState< |
| 72 | (UIMessageData & { suggestions: string[] }) | null |
| 73 | >(null); |
| 74 | const [editFollowUpsModalText, setEditFollowUpsModalText] = useState< |
| 75 | string[] | null |
| 76 | >(null); |
| 77 | const [answer, setAnswer] = useState<UIAnswerType>({ |
| 78 | ...props.data, |
| 79 | approval_questions: [], |
| 80 | }); |
| 81 | const [allVariables, setAllVariables] = useState<ApprovalVariable[]>([]); |
| 82 | const [allActions, setAllActions] = useState<Action[] | null>(null); |
| 83 | const [thoughtsVisible, setThoughtsVisible] = useState<boolean>(false); |
| 84 | const [showModal, setShowModal] = useState< |
| 85 | "code" | "filtering" | "routing" | "user" | "api-key" | "question" | null |
| 86 | >(null); |
| 87 | const [userApiKey, setUserApiKey] = useState(() => { |
| 88 | // Grab API key from localstorage |
| 89 | const userApiKeyFromLocalStorage = localStorage.getItem("userApiKey"); |
| 90 | if (!userApiKeyFromLocalStorage) { |
| 91 | // TODO: Handle this much better |
| 92 | console.error("No userApiKey in localstorage!"); |
| 93 | return; |
| 94 | } |
| 95 | return userApiKeyFromLocalStorage; |
| 96 | }); |
| 97 | const [devMode, setDevMode] = useState<boolean>(false); |
| 98 | const [loading, setLoading] = useState<boolean>(false); |
| 99 | const scrollRef = useRef<HTMLDivElement | null>(null); |
| 100 | |
| 101 | useEffect(() => { |
| 102 | if (!profile) return; |
nothing calls this directly
no test coverage detected