Spaces:
Build error
Build error
Katsuya Oda
commited on
fix: tiny bug
Browse files- backend/resolver.py +3 -4
- frontend/components/ui/dialog.tsx +1 -1
- frontend/lib/urql.ts +8 -3
backend/resolver.py
CHANGED
@@ -128,7 +128,7 @@ async def resolve_question(
|
|
128 |
questions: list[Question] = data_questions
|
129 |
|
130 |
query = params_parsed.query
|
131 |
-
if query
|
132 |
logger.warning("Query is empty", params=params_parsed)
|
133 |
return {"questions": questions}
|
134 |
query_parsed = (
|
@@ -145,12 +145,11 @@ async def resolve_question(
|
|
145 |
base = "select * from qa where"
|
146 |
anno = "{targetHits:100,approximate:false}"
|
147 |
cond01 = "({targetHits:100}userInput(@condQuery))"
|
148 |
-
cond02 = f
|
149 |
-
cond03 = f"({anno}nearestNeighbor(question_embedding_me5s, q))"
|
150 |
|
151 |
async with clientVespa.asyncio() as sess:
|
152 |
res: VespaQueryResponse = await sess.query(
|
153 |
-
yql=f"{base} {cond01} or {cond02}
|
154 |
lang="ja",
|
155 |
hits=20,
|
156 |
ranking="question_semantic",
|
|
|
128 |
questions: list[Question] = data_questions
|
129 |
|
130 |
query = params_parsed.query
|
131 |
+
if not query:
|
132 |
logger.warning("Query is empty", params=params_parsed)
|
133 |
return {"questions": questions}
|
134 |
query_parsed = (
|
|
|
145 |
base = "select * from qa where"
|
146 |
anno = "{targetHits:100,approximate:false}"
|
147 |
cond01 = "({targetHits:100}userInput(@condQuery))"
|
148 |
+
cond02 = f"({anno}nearestNeighbor(question_embedding_me5s, q))"
|
|
|
149 |
|
150 |
async with clientVespa.asyncio() as sess:
|
151 |
res: VespaQueryResponse = await sess.query(
|
152 |
+
yql=f"{base} {cond01} or {cond02}",
|
153 |
lang="ja",
|
154 |
hits=20,
|
155 |
ranking="question_semantic",
|
frontend/components/ui/dialog.tsx
CHANGED
@@ -36,7 +36,7 @@ const DialogContent = React.forwardRef<
|
|
36 |
<DialogPrimitive.Content
|
37 |
ref={ref}
|
38 |
className={cn(
|
39 |
-
"fixed left-[50%] top-
|
40 |
className,
|
41 |
)}
|
42 |
{...props}
|
|
|
36 |
<DialogPrimitive.Content
|
37 |
ref={ref}
|
38 |
className={cn(
|
39 |
+
"fixed left-[50%] top-[50%] z-50 grid w-11/12 max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
40 |
className,
|
41 |
)}
|
42 |
{...props}
|
frontend/lib/urql.ts
CHANGED
@@ -1,9 +1,14 @@
|
|
1 |
-
import { cacheExchange } from "@urql/exchange-graphcache"
|
2 |
import {
|
3 |
type SubscribePayload,
|
4 |
createClient as createWSClient,
|
5 |
} from "graphql-ws"
|
6 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
const isClientSide = typeof window !== "undefined"
|
9 |
|
@@ -21,7 +26,7 @@ if (isClientSide) {
|
|
21 |
export const client = new Client({
|
22 |
url: "/graphql",
|
23 |
exchanges: [
|
24 |
-
cacheExchange
|
25 |
ssr,
|
26 |
fetchExchange,
|
27 |
...(isClientSide
|
|
|
|
|
1 |
import {
|
2 |
type SubscribePayload,
|
3 |
createClient as createWSClient,
|
4 |
} from "graphql-ws"
|
5 |
+
import {
|
6 |
+
Client,
|
7 |
+
cacheExchange,
|
8 |
+
fetchExchange,
|
9 |
+
ssrExchange,
|
10 |
+
subscriptionExchange,
|
11 |
+
} from "urql"
|
12 |
|
13 |
const isClientSide = typeof window !== "undefined"
|
14 |
|
|
|
26 |
export const client = new Client({
|
27 |
url: "/graphql",
|
28 |
exchanges: [
|
29 |
+
cacheExchange,
|
30 |
ssr,
|
31 |
fetchExchange,
|
32 |
...(isClientSide
|