Skip to content

Commit 9683bb6

Browse files
committed
refactor: improve AuthPage button structure and enhance error handling in MindsDB queries
1 parent bac8040 commit 9683bb6

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

apps/platform/src/app/auth/page.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ export default function AuthPage() {
5555
return (
5656
<div className="flex min-h-screen items-center justify-center bg-background p-6">
5757
<div className="absolute top-6 left-6">
58-
<Button variant="ghost" size="sm" asChild className="paper-effect">
59-
<Link href="/" className="flex items-center gap-1">
60-
<ArrowLeft className="h-4 w-4" />
61-
<span>Back</span>
62-
</Link>
63-
</Button>
58+
<Link href="/" className="flex items-center gap-1">
59+
<Button variant="ghost" size="sm" className="paper-effect">
60+
<>
61+
<ArrowLeft className="h-4 w-4" />
62+
<span>Back</span>
63+
</>
64+
</Button>
65+
</Link>
6466
</div>
6567

6668
<Card className="w-full max-w-md paper-effect">

apps/server/src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ router.post("/assistant", async (c) => {
132132
if (q[0].ok !== 1) {
133133
return c.json(
134134
{ error: "Sorry, We don't have MindsDB up at the moment." },
135-
403
135+
503
136136
);
137137
}
138138
} catch (error) {

apps/server/src/lib/minds.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { MindsDBConfig } from "@kbnet/shared";
22
import { sanitizeSQLValue } from "./util";
33
import { mindsDBUrl } from "..";
4-
54
export async function runMindsDBQuery(query: string) {
65
try {
76
const res = await fetch(`${mindsDBUrl}/api/sql/query`, {
@@ -13,7 +12,7 @@ export async function runMindsDBQuery(query: string) {
1312
});
1413

1514
if (!res.ok) {
16-
throw new Error(`HTTP error! status: ${res.status}`);
15+
throw new Error(`HTTP error! status: ${res.status || "unknown"}`);
1716
}
1817
const rawData: any = await res.json();
1918

@@ -39,11 +38,9 @@ export async function runMindsDBQuery(query: string) {
3938

4039
export async function getKBContext(query: string, enabled = true) {
4140
if (!enabled) {
42-
return {
43-
rows: [
44-
{ chunk_content: `Use your own knowledge base to answer: ${query}` },
45-
],
46-
};
41+
return [
42+
{ chunk_content: `Use your own knowledge base to answer: ${query}` },
43+
];
4744
}
4845

4946
let kbdata;
@@ -59,10 +56,7 @@ export async function getKBContext(query: string, enabled = true) {
5956
error.message
6057
);
6158

62-
console.log(kbdata);
63-
kbdata = {
64-
rows: [],
65-
};
59+
kbdata = [];
6660
}
6761

6862
return kbdata;

0 commit comments

Comments
 (0)