-
-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from n4ze3m/next
v1.0.4
- Loading branch information
Showing
18 changed files
with
907 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export type BotSettings = { | ||
id: string; | ||
name: string; | ||
model: string; | ||
public_id: string; | ||
temperature: number; | ||
embedding: string; | ||
qaPrompt: string; | ||
questionGeneratorPrompt: string; | ||
streaming: boolean; | ||
showRef: boolean; | ||
use_hybrid_search: boolean; | ||
bot_protect: boolean; | ||
use_rag: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,53 @@ | ||
import axios from 'axios'; | ||
import { getToken } from './cookie'; | ||
import axios from "axios"; | ||
import { getToken } from "./cookie"; | ||
|
||
export const baseURL = import.meta.env.VITE_API_URL || '/api/v1'; | ||
export const baseURL = import.meta.env.VITE_API_URL || "/api/v1"; | ||
|
||
const instance = axios.create({ | ||
baseURL, | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
baseURL, | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
|
||
instance.interceptors.request.use( | ||
(config) => { | ||
const token = getToken() | ||
if (token) { | ||
config.headers!.Authorization = `Bearer ${token}`; | ||
} | ||
return config; | ||
}, | ||
(error) => { | ||
return Promise.reject(error); | ||
(config) => { | ||
const token = getToken(); | ||
if (token) { | ||
config.headers!.Authorization = `Bearer ${token}`; | ||
} | ||
return config; | ||
}, | ||
(error) => { | ||
return Promise.reject(error); | ||
}, | ||
); | ||
|
||
instance.interceptors.response.use( | ||
(res) => { | ||
return res; | ||
}, | ||
async (err) => { | ||
const originalConfig = err.config; | ||
if (err.response) { | ||
if (err.response.status === 401 && !originalConfig._retry) { | ||
originalConfig._retry = true; | ||
try { | ||
return instance(originalConfig); | ||
} catch (_error) { | ||
|
||
return Promise.reject(_error); | ||
} | ||
} | ||
|
||
if (err.response.status === 403 && err.response.data) { | ||
return Promise.reject(err.response.data); | ||
} | ||
(res) => { | ||
return res; | ||
}, | ||
async (err) => { | ||
const originalConfig = err.config; | ||
if (err.response) { | ||
if (err.response.status === 401 && !originalConfig._retry) { | ||
originalConfig._retry = true; | ||
try { | ||
return instance(originalConfig); | ||
} catch (_error) { | ||
return Promise.reject(_error); | ||
} | ||
} else if (err.response.status === 401 && originalConfig._retry) { | ||
window.location.href = "/#/login"; | ||
} | ||
|
||
return Promise.reject(err); | ||
if (err.response.status === 403 && err.response.data) { | ||
return Promise.reject(err.response.data); | ||
} | ||
} | ||
|
||
return Promise.reject(err); | ||
}, | ||
); | ||
|
||
export default instance; | ||
export default instance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- AlterTable | ||
ALTER TABLE "Bot" ADD COLUMN "options" JSON DEFAULT '{}', | ||
ADD COLUMN "use_rag" BOOLEAN NOT NULL DEFAULT false; | ||
|
||
ALTER TABLE "Bot" ADD COLUMN "bot_protect" BOOLEAN NOT NULL DEFAULT false; | ||
|
||
|
||
ALTER TABLE "Bot" ADD COLUMN "bot_api_key" TEXT NULL DEFAULT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.