- implement disable_email_auth env var

- add sync crowdin translations github action
This commit is contained in:
Amruth Pillai
2023-11-21 09:44:37 +01:00
parent 635f743e56
commit 1825fc3283
84 changed files with 2693 additions and 2341 deletions

View File

@ -18,6 +18,7 @@ import {
import { cn } from "@reactive-resume/utils";
import { useState } from "react";
import { toast } from "../hooks/use-toast";
import { changeTone } from "../services/openai/change-tone";
import { fixGrammar } from "../services/openai/fix-grammar";
import { improveWriting } from "../services/openai/improve-writing";
@ -39,17 +40,25 @@ export const AiActions = ({ value, onChange, className }: Props) => {
if (!aiEnabled) return null;
const onClick = async (action: Action, mood?: Mood) => {
setLoading(action);
try {
setLoading(action);
let result = value;
let result = value;
if (action === "improve") result = await improveWriting(value);
if (action === "fix") result = await fixGrammar(value);
if (action === "tone" && mood) result = await changeTone(value, mood);
if (action === "improve") result = await improveWriting(value);
if (action === "fix") result = await fixGrammar(value);
if (action === "tone" && mood) result = await changeTone(value, mood);
onChange(result);
setLoading(false);
onChange(result);
} catch (error) {
toast({
variant: "error",
title: t`Oops, the server returned an error.`,
description: (error as Error)?.message,
});
} finally {
setLoading(false);
}
};
return (