Skip to content

Commit

Permalink
a bit of refactoring and fix unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwatson committed Nov 26, 2024
1 parent 69be62c commit 6a2eac3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions llm-service/app/ai/vector_stores/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
#

import os
from typing import Optional, List, Tuple, Any
from typing import Optional

import qdrant_client
from llama_index.core.indices import VectorStoreIndex
from llama_index.core.vector_stores.types import BasePydanticVectorStore
from llama_index.vector_stores.qdrant import (
QdrantVectorStore as LlamaIndexQdrantVectorStore,
)
from qdrant_client.http.models import CountResult, ScoredPoint, Record
from qdrant_client.http.models import CountResult, Record

from ...services import models
from .vector_store import VectorStore
Expand Down
11 changes: 6 additions & 5 deletions ui/src/pages/DataSources/VisualizationTab/VectorGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,20 @@ const VectorGraph = ({ rawData }: { rawData: Point2d[] }) => {
hash = (hash << 5) - hash + str.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return Math.abs(hash % 10);
return Math.abs(hash % colors.length);
};

const pickColor = (label: string) => colors[hashStringToIndex(label)];

const vizDatasets: DataSets = Object.entries(points).map(
([label, points]) => {
const userQuery = label === "USER_QUERY";
const color = pickColor(label);
return {
label: userQuery ? "User Query" : label,
data: points,
backgroundColor: userQuery
? "lightgray"
: colors[hashStringToIndex(label)],
borderColor: userQuery ? "black" : colors[hashStringToIndex(label)],
backgroundColor: userQuery ? "lightgray" : color,
borderColor: userQuery ? "black" : color,
borderWidth: 1,
pointStyle: userQuery ? "circle" : "circle",
pointRadius: userQuery ? 15 : 3,
Expand Down

0 comments on commit 6a2eac3

Please sign in to comment.