mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
Fix submit state for form with buttons sticky to button
This commit is contained in:
@@ -652,6 +652,7 @@ export function AgentModificationForm(props: AgentModificationFormProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = (values: any) => {
|
const handleSubmit = (values: any) => {
|
||||||
|
console.log("Submitting", values);
|
||||||
props.onSubmit(values);
|
props.onSubmit(values);
|
||||||
setIsSaving(true);
|
setIsSaving(true);
|
||||||
};
|
};
|
||||||
@@ -1335,6 +1336,7 @@ export function AgentModificationForm(props: AgentModificationFormProps) {
|
|||||||
type="submit"
|
type="submit"
|
||||||
variant={"outline"}
|
variant={"outline"}
|
||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
|
onClick={props.form.handleSubmit(handleSubmit)}
|
||||||
className={`items-center ${isSaving ? "bg-stone-100 dark:bg-neutral-900" : ""} text-white ${colorOptionClassName}`}
|
className={`items-center ${isSaving ? "bg-stone-100 dark:bg-neutral-900" : ""} text-white ${colorOptionClassName}`}
|
||||||
>
|
>
|
||||||
<FloppyDisk className="h-4 w-4 mr-2" />
|
<FloppyDisk className="h-4 w-4 mr-2" />
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ async def acheck_if_safe_prompt(system_prompt: str, user: KhojUser = None, lax:
|
|||||||
|
|
||||||
response = response.strip()
|
response = response.strip()
|
||||||
try:
|
try:
|
||||||
response = json.loads(response)
|
response = clean_json(response)
|
||||||
is_safe = response.get("safe", "True") == "True"
|
is_safe = response.get("safe", "True") == "True"
|
||||||
if not is_safe:
|
if not is_safe:
|
||||||
reason = response.get("reason", "")
|
reason = response.get("reason", "")
|
||||||
|
|||||||
Reference in New Issue
Block a user