Spaces:
Runtime error
Runtime error
Fix index
Browse files
client/src/components/knowledge-base/vector-search.tsx
CHANGED
|
@@ -31,7 +31,7 @@ interface SearchResults {
|
|
| 31 |
|
| 32 |
export default function VectorSearch() {
|
| 33 |
const [query, setQuery] = useState('');
|
| 34 |
-
const [indexName, setIndexName] = useState('
|
| 35 |
const [maxResults, setMaxResults] = useState(10);
|
| 36 |
const [isSearching, setIsSearching] = useState(false);
|
| 37 |
const [searchResults, setSearchResults] = useState<SearchResults | null>(null);
|
|
@@ -164,8 +164,8 @@ export default function VectorSearch() {
|
|
| 164 |
<SelectValue />
|
| 165 |
</SelectTrigger>
|
| 166 |
<SelectContent>
|
| 167 |
-
<SelectItem value="
|
| 168 |
-
<SelectItem value="
|
| 169 |
<SelectItem value="academic_index">Academic Papers</SelectItem>
|
| 170 |
</SelectContent>
|
| 171 |
</Select>
|
|
|
|
| 31 |
|
| 32 |
export default function VectorSearch() {
|
| 33 |
const [query, setQuery] = useState('');
|
| 34 |
+
const [indexName, setIndexName] = useState('research_papers_clean_v2');
|
| 35 |
const [maxResults, setMaxResults] = useState(10);
|
| 36 |
const [isSearching, setIsSearching] = useState(false);
|
| 37 |
const [searchResults, setSearchResults] = useState<SearchResults | null>(null);
|
|
|
|
| 164 |
<SelectValue />
|
| 165 |
</SelectTrigger>
|
| 166 |
<SelectContent>
|
| 167 |
+
<SelectItem value="research_papers_clean_v2">Research Papers (Clean)</SelectItem>
|
| 168 |
+
<SelectItem value="main_index">Main Index (Legacy - has uploaded docs)</SelectItem>
|
| 169 |
<SelectItem value="academic_index">Academic Papers</SelectItem>
|
| 170 |
</SelectContent>
|
| 171 |
</Select>
|
server/document-processor.ts
CHANGED
|
@@ -376,7 +376,7 @@ export class DocumentProcessor {
|
|
| 376 |
*/
|
| 377 |
async buildVectorIndex(
|
| 378 |
documents: Document[],
|
| 379 |
-
indexName = '
|
| 380 |
): Promise<{
|
| 381 |
success: boolean;
|
| 382 |
indexName?: string;
|
|
@@ -424,7 +424,7 @@ export class DocumentProcessor {
|
|
| 424 |
*/
|
| 425 |
async searchVectorIndex(
|
| 426 |
query: string,
|
| 427 |
-
indexName = '
|
| 428 |
maxResults = 10
|
| 429 |
): Promise<{
|
| 430 |
success: boolean;
|
|
|
|
| 376 |
*/
|
| 377 |
async buildVectorIndex(
|
| 378 |
documents: Document[],
|
| 379 |
+
indexName = 'research_papers_clean_v2'
|
| 380 |
): Promise<{
|
| 381 |
success: boolean;
|
| 382 |
indexName?: string;
|
|
|
|
| 424 |
*/
|
| 425 |
async searchVectorIndex(
|
| 426 |
query: string,
|
| 427 |
+
indexName = 'research_papers_clean_v2',
|
| 428 |
maxResults = 10
|
| 429 |
): Promise<{
|
| 430 |
success: boolean;
|
server/document-routes.ts
CHANGED
|
@@ -302,7 +302,7 @@ router.post('/process/batch', async (req, res) => {
|
|
| 302 |
*/
|
| 303 |
router.post('/index/build', async (req, res) => {
|
| 304 |
try {
|
| 305 |
-
const { documentIds, indexName = '
|
| 306 |
|
| 307 |
let documents;
|
| 308 |
if (documentIds && Array.isArray(documentIds)) {
|
|
@@ -356,7 +356,7 @@ router.post('/index/build', async (req, res) => {
|
|
| 356 |
*/
|
| 357 |
router.post('/search/vector', async (req, res) => {
|
| 358 |
try {
|
| 359 |
-
const { query, indexName = '
|
| 360 |
|
| 361 |
if (!query || typeof query !== 'string') {
|
| 362 |
return res.status(400).json({
|
|
|
|
| 302 |
*/
|
| 303 |
router.post('/index/build', async (req, res) => {
|
| 304 |
try {
|
| 305 |
+
const { documentIds, indexName = 'research_papers_clean_v2' } = req.body;
|
| 306 |
|
| 307 |
let documents;
|
| 308 |
if (documentIds && Array.isArray(documentIds)) {
|
|
|
|
| 356 |
*/
|
| 357 |
router.post('/search/vector', async (req, res) => {
|
| 358 |
try {
|
| 359 |
+
const { query, indexName = 'research_papers_clean_v2', maxResults = 10 } = req.body;
|
| 360 |
|
| 361 |
if (!query || typeof query !== 'string') {
|
| 362 |
return res.status(400).json({
|