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',
|
||||
async (data: any, { rejectWithValue }) => {
|
||||
try {
|
||||
return await axios.post('/openai/create_widget', data);
|
||||
return await axios.post('/api/openai/create_widget', data);
|
||||
} catch (error) {
|
||||
if (!error.response) {
|
||||
throw error;
|
||||
@ -48,9 +48,14 @@ export const aiPrompt = createAsyncThunk(
|
||||
|
||||
export const askGpt = createAsyncThunk(
|
||||
'openai/askGpt',
|
||||
async (prompt: string, { rejectWithValue }) => {
|
||||
async (prompt: string, { rejectWithValue, getState }) => {
|
||||
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;
|
||||
} catch (error) {
|
||||
if (!error.response) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user