chatbottesttwo
This commit is contained in:
parent
3e434c13ff
commit
01a2285d0c
File diff suppressed because one or more lines are too long
@ -36,7 +36,7 @@ export const aiPrompt = createAsyncThunk(
|
|||||||
'openai/aiPrompt',
|
'openai/aiPrompt',
|
||||||
async (data: any, { rejectWithValue }) => {
|
async (data: any, { rejectWithValue }) => {
|
||||||
try {
|
try {
|
||||||
return await axios.post('/openai/create_widget', data);
|
return await axios.post('/api/openai/create_widget', data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!error.response) {
|
if (!error.response) {
|
||||||
throw error;
|
throw error;
|
||||||
@ -48,9 +48,14 @@ export const aiPrompt = createAsyncThunk(
|
|||||||
|
|
||||||
export const askGpt = createAsyncThunk(
|
export const askGpt = createAsyncThunk(
|
||||||
'openai/askGpt',
|
'openai/askGpt',
|
||||||
async (prompt: string, { rejectWithValue }) => {
|
async (prompt: string, { rejectWithValue, getState }) => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.post('/openai/ask-gpt', { prompt });
|
const token = (getState() as any).auth.token;
|
||||||
|
const response = await axios.post(
|
||||||
|
'/api/openai/ask-gpt',
|
||||||
|
{ prompt },
|
||||||
|
{ headers: { Authorization: `Bearer ${token}` } }
|
||||||
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!error.response) {
|
if (!error.response) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user