Browse Source

chore: endpoint naming

Timothy J. Baek 7 tháng trước cách đây
mục cha
commit
9ad5ffb8c1
2 tập tin đã thay đổi với 20 bổ sung20 xóa
  1. 19 19
      src/lib/apis/retrieval/index.ts
  2. 1 1
      src/lib/constants.ts

+ 19 - 19
src/lib/apis/retrieval/index.ts

@@ -1,9 +1,9 @@
-import { RAG_API_BASE_URL } from '$lib/constants';
+import { RETRIEVAL_API_BASE_URL } from '$lib/constants';
 
 export const getRAGConfig = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/config`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/config`, {
 		method: 'GET',
 		headers: {
 			'Content-Type': 'application/json',
@@ -53,7 +53,7 @@ type RAGConfigForm = {
 export const updateRAGConfig = async (token: string, payload: RAGConfigForm) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/config/update`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/config/update`, {
 		method: 'POST',
 		headers: {
 			'Content-Type': 'application/json',
@@ -83,7 +83,7 @@ export const updateRAGConfig = async (token: string, payload: RAGConfigForm) =>
 export const getRAGTemplate = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/template`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/template`, {
 		method: 'GET',
 		headers: {
 			'Content-Type': 'application/json',
@@ -110,7 +110,7 @@ export const getRAGTemplate = async (token: string) => {
 export const getQuerySettings = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/query/settings`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/query/settings`, {
 		method: 'GET',
 		headers: {
 			'Content-Type': 'application/json',
@@ -143,7 +143,7 @@ type QuerySettings = {
 export const updateQuerySettings = async (token: string, settings: QuerySettings) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/query/settings/update`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/query/settings/update`, {
 		method: 'POST',
 		headers: {
 			'Content-Type': 'application/json',
@@ -173,7 +173,7 @@ export const updateQuerySettings = async (token: string, settings: QuerySettings
 export const getEmbeddingConfig = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/embedding`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/embedding`, {
 		method: 'GET',
 		headers: {
 			'Content-Type': 'application/json',
@@ -212,7 +212,7 @@ type EmbeddingModelUpdateForm = {
 export const updateEmbeddingConfig = async (token: string, payload: EmbeddingModelUpdateForm) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/embedding/update`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/embedding/update`, {
 		method: 'POST',
 		headers: {
 			'Content-Type': 'application/json',
@@ -242,7 +242,7 @@ export const updateEmbeddingConfig = async (token: string, payload: EmbeddingMod
 export const getRerankingConfig = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/reranking`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/reranking`, {
 		method: 'GET',
 		headers: {
 			'Content-Type': 'application/json',
@@ -273,7 +273,7 @@ type RerankingModelUpdateForm = {
 export const updateRerankingConfig = async (token: string, payload: RerankingModelUpdateForm) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/reranking/update`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/reranking/update`, {
 		method: 'POST',
 		headers: {
 			'Content-Type': 'application/json',
@@ -313,7 +313,7 @@ export const processFile = async (
 ) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/process/file`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/process/file`, {
 		method: 'POST',
 		headers: {
 			Accept: 'application/json',
@@ -345,7 +345,7 @@ export const processFile = async (
 export const processDocsDir = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/process/dir`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/process/dir`, {
 		method: 'GET',
 		headers: {
 			Accept: 'application/json',
@@ -371,7 +371,7 @@ export const processDocsDir = async (token: string) => {
 export const processYoutubeVideo = async (token: string, url: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/process/youtube`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/process/youtube`, {
 		method: 'POST',
 		headers: {
 			Accept: 'application/json',
@@ -402,7 +402,7 @@ export const processYoutubeVideo = async (token: string, url: string) => {
 export const processWeb = async (token: string, collection_name: string, url: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/process/web`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/process/web`, {
 		method: 'POST',
 		headers: {
 			Accept: 'application/json',
@@ -438,7 +438,7 @@ export const processWebSearch = async (
 ): Promise<SearchDocument | null> => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/process/web/search`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/process/web/search`, {
 		method: 'POST',
 		headers: {
 			'Content-Type': 'application/json',
@@ -474,7 +474,7 @@ export const queryDoc = async (
 ) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/query/doc`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/query/doc`, {
 		method: 'POST',
 		headers: {
 			Accept: 'application/json',
@@ -511,7 +511,7 @@ export const queryCollection = async (
 ) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/query/collection`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/query/collection`, {
 		method: 'POST',
 		headers: {
 			Accept: 'application/json',
@@ -543,7 +543,7 @@ export const queryCollection = async (
 export const resetUploadDir = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/reset/uploads`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/reset/uploads`, {
 		method: 'POST',
 		headers: {
 			Accept: 'application/json',
@@ -569,7 +569,7 @@ export const resetUploadDir = async (token: string) => {
 export const resetVectorDB = async (token: string) => {
 	let error = null;
 
-	const res = await fetch(`${RAG_API_BASE_URL}/reset/db`, {
+	const res = await fetch(`${RETRIEVAL_API_BASE_URL}/reset/db`, {
 		method: 'POST',
 		headers: {
 			Accept: 'application/json',

+ 1 - 1
src/lib/constants.ts

@@ -11,7 +11,7 @@ export const OLLAMA_API_BASE_URL = `${WEBUI_BASE_URL}/ollama`;
 export const OPENAI_API_BASE_URL = `${WEBUI_BASE_URL}/openai`;
 export const AUDIO_API_BASE_URL = `${WEBUI_BASE_URL}/audio/api/v1`;
 export const IMAGES_API_BASE_URL = `${WEBUI_BASE_URL}/images/api/v1`;
-export const RAG_API_BASE_URL = `${WEBUI_BASE_URL}/retrieval/api/v1`;
+export const RETRIEVAL_API_BASE_URL = `${WEBUI_BASE_URL}/retrieval/api/v1`;
 
 export const WEBUI_VERSION = APP_VERSION;
 export const WEBUI_BUILD_HASH = APP_BUILD_HASH;