mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 19:24:00 +01:00
parent
13ac535504
commit
cb930e3e2c
|
@ -23,6 +23,7 @@ const useSubmit = () => {
|
||||||
message: MessageInterface[]
|
message: MessageInterface[]
|
||||||
): Promise<string> => {
|
): Promise<string> => {
|
||||||
let data;
|
let data;
|
||||||
|
try {
|
||||||
if (!apiKey || apiKey.length === 0) {
|
if (!apiKey || apiKey.length === 0) {
|
||||||
// official endpoint
|
// official endpoint
|
||||||
if (apiEndpoint === officialAPIEndpoint) {
|
if (apiEndpoint === officialAPIEndpoint) {
|
||||||
|
@ -44,6 +45,9 @@ const useSubmit = () => {
|
||||||
apiKey
|
apiKey
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (error: unknown) {
|
||||||
|
throw new Error(`Error generating title!\n${(error as Error).message}`);
|
||||||
|
}
|
||||||
return data.choices[0].message.content;
|
return data.choices[0].message.content;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue