Adapting the backend to the new structure (#162)

* Adapting the backend to the new structure

Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
WenjiaoYue
2024-05-21 18:46:30 +08:00
committed by GitHub
parent 396e88ca4c
commit 131a112aa9
3 changed files with 11 additions and 8 deletions

View File

@@ -1 +1 @@
BASIC_URL = 'http://x.x.x.x:yyyy' DOC_BASE_URL = 'http://x.x.x.x:yyyy'

View File

@@ -15,7 +15,7 @@
import { SSE } from "sse.js"; import { SSE } from "sse.js";
import { env } from "$env/dynamic/public"; import { env } from "$env/dynamic/public";
const BASIC_URL = env.BASIC_URL; const DOC_BASE_URL = env.DOC_BASE_URL;
async function fetchPostRes(url, init) { async function fetchPostRes(url, init) {
try { try {
@@ -29,7 +29,7 @@ async function fetchPostRes(url, init) {
} }
export async function fetchKnowledgeBaseId(file: Blob, fileName: string) { export async function fetchKnowledgeBaseId(file: Blob, fileName: string) {
const url = `${BASIC_URL}/doc_upload`; const url = `${DOC_BASE_URL}/doc_upload`;
const formData = new FormData(); const formData = new FormData();
formData.append("file", file, fileName); formData.append("file", file, fileName);
@@ -46,10 +46,10 @@ export async function fetchTextStream(query: string, urlSuffix: string, params:
if (params === "doc_id") { if (params === "doc_id") {
payload = { doc_id: query }; payload = { doc_id: query };
} else if (params === "text") { } else if (params === "text") {
payload = { text: query }; payload = { query: query };
} }
let url = `${BASIC_URL}${urlSuffix}`; let url = `${DOC_BASE_URL}`;
console.log("url", url); console.log("url", url);
return new SSE(url, { return new SSE(url, {

View File

@@ -13,8 +13,11 @@
// limitations under the License. // limitations under the License.
import { sveltekit } from "@sveltejs/kit/vite"; import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite"; import type { UserConfig } from "vite";
export default defineConfig({ const config: UserConfig = {
plugins: [sveltekit()], plugins: [sveltekit()],
}); server: {},
};
export default config;