lint
This commit is contained in:
parent
c3b5b33f5c
commit
5de27335a3
4 changed files with 30 additions and 67 deletions
|
|
@ -23,7 +23,7 @@ const Command = React.forwardRef<
|
||||||
))
|
))
|
||||||
Command.displayName = CommandPrimitive.displayName
|
Command.displayName = CommandPrimitive.displayName
|
||||||
|
|
||||||
interface CommandDialogProps extends DialogProps {}
|
type CommandDialogProps = DialogProps
|
||||||
|
|
||||||
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
|
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { X, ChevronDown, Check } from "lucide-react"
|
import { ChevronDown, Check } from "lucide-react"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
import { Badge } from "@/components/ui/badge"
|
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import {
|
import {
|
||||||
Command,
|
Command,
|
||||||
|
|
@ -83,14 +82,6 @@ export function MultiSelect({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRemove = (optionValue: string) => {
|
|
||||||
if (optionValue === "*") {
|
|
||||||
onValueChange([])
|
|
||||||
} else {
|
|
||||||
onValueChange(value.filter(v => v !== optionValue))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getDisplayText = () => {
|
const getDisplayText = () => {
|
||||||
if (isAllSelected) {
|
if (isAllSelected) {
|
||||||
return allOptionLabel
|
return allOptionLabel
|
||||||
|
|
@ -105,54 +96,7 @@ export function MultiSelect({
|
||||||
return `${value.length} ${noun}`
|
return `${value.length} ${noun}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSelectedBadges = () => {
|
|
||||||
if (isAllSelected) {
|
|
||||||
return [
|
|
||||||
<Badge
|
|
||||||
key="all"
|
|
||||||
variant="secondary"
|
|
||||||
className="mr-1 mb-1"
|
|
||||||
>
|
|
||||||
{allOptionLabel}
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
className="ml-1 h-auto p-0 text-muted-foreground hover:text-foreground"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
handleRemove("*")
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<X className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
</Badge>
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
return value.map(val => {
|
|
||||||
const option = options.find(opt => opt.value === val)
|
|
||||||
return (
|
|
||||||
<Badge
|
|
||||||
key={val}
|
|
||||||
variant="secondary"
|
|
||||||
className="mr-1 mb-1"
|
|
||||||
>
|
|
||||||
{option?.label || val}
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
className="ml-1 h-auto p-0 text-muted-foreground hover:text-foreground"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
handleRemove(val)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<X className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
</Badge>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useState, useRef, useEffect, useCallback } from "react"
|
import { useState, useRef, useEffect } from "react"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Loader2, User, Bot, Zap, Settings, ChevronDown, ChevronRight, Upload, AtSign, Plus, X } from "lucide-react"
|
import { Loader2, User, Bot, Zap, Settings, ChevronDown, ChevronRight, Upload, AtSign, Plus, X } from "lucide-react"
|
||||||
import { ProtectedRoute } from "@/components/protected-route"
|
import { ProtectedRoute } from "@/components/protected-route"
|
||||||
|
|
@ -8,7 +8,7 @@ import { useTask } from "@/contexts/task-context"
|
||||||
import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context"
|
import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context"
|
||||||
import { useAuth } from "@/contexts/auth-context"
|
import { useAuth } from "@/contexts/auth-context"
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
|
|
||||||
|
|
||||||
interface Message {
|
interface Message {
|
||||||
role: "user" | "assistant"
|
role: "user" | "assistant"
|
||||||
|
|
@ -47,6 +47,16 @@ interface SelectedFilters {
|
||||||
owners: string[]
|
owners: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface KnowledgeFilterData {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
query_data: string
|
||||||
|
owner: string
|
||||||
|
created_at: string
|
||||||
|
updated_at: string
|
||||||
|
}
|
||||||
|
|
||||||
interface RequestBody {
|
interface RequestBody {
|
||||||
prompt: string
|
prompt: string
|
||||||
stream?: boolean
|
stream?: boolean
|
||||||
|
|
@ -83,7 +93,7 @@ function ChatPage() {
|
||||||
const [isUploading, setIsUploading] = useState(false)
|
const [isUploading, setIsUploading] = useState(false)
|
||||||
const [isDragOver, setIsDragOver] = useState(false)
|
const [isDragOver, setIsDragOver] = useState(false)
|
||||||
const [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false)
|
const [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false)
|
||||||
const [availableFilters, setAvailableFilters] = useState<any[]>([])
|
const [availableFilters, setAvailableFilters] = useState<KnowledgeFilterData[]>([])
|
||||||
const [filterSearchTerm, setFilterSearchTerm] = useState("")
|
const [filterSearchTerm, setFilterSearchTerm] = useState("")
|
||||||
const [selectedFilterIndex, setSelectedFilterIndex] = useState(0)
|
const [selectedFilterIndex, setSelectedFilterIndex] = useState(0)
|
||||||
const [isFilterHighlighted, setIsFilterHighlighted] = useState(false)
|
const [isFilterHighlighted, setIsFilterHighlighted] = useState(false)
|
||||||
|
|
@ -292,7 +302,7 @@ function ChatPage() {
|
||||||
setIsFilterDropdownOpen(!isFilterDropdownOpen)
|
setIsFilterDropdownOpen(!isFilterDropdownOpen)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFilterSelect = (filter: any) => {
|
const handleFilterSelect = (filter: KnowledgeFilterData | null) => {
|
||||||
setSelectedFilter(filter)
|
setSelectedFilter(filter)
|
||||||
setIsFilterDropdownOpen(false)
|
setIsFilterDropdownOpen(false)
|
||||||
setFilterSearchTerm("")
|
setFilterSearchTerm("")
|
||||||
|
|
@ -1552,7 +1562,7 @@ function ChatPage() {
|
||||||
filter.name.toLowerCase().includes(filterSearchTerm.toLowerCase())
|
filter.name.toLowerCase().includes(filterSearchTerm.toLowerCase())
|
||||||
).length === 0 && filterSearchTerm && (
|
).length === 0 && filterSearchTerm && (
|
||||||
<div className="px-2 py-3 text-sm text-muted-foreground">
|
<div className="px-2 py-3 text-sm text-muted-foreground">
|
||||||
No filters match "{filterSearchTerm}"
|
No filters match "{filterSearchTerm}"
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ import { useState, useEffect, useCallback, useRef } from "react"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Input } from "@/components/ui/input"
|
import { Input } from "@/components/ui/input"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Search, Loader2, FileText, HardDrive } from "lucide-react"
|
import { Search, Loader2, FileText, HardDrive, Building2, Cloud } from "lucide-react"
|
||||||
import { TbBrandOnedrive } from "react-icons/tb"
|
import { TbBrandOnedrive } from "react-icons/tb"
|
||||||
import { SiGoogledrive, SiSharepoint, SiAmazonaws } from "react-icons/si"
|
import { SiGoogledrive } from "react-icons/si"
|
||||||
import { ProtectedRoute } from "@/components/protected-route"
|
import { ProtectedRoute } from "@/components/protected-route"
|
||||||
import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context"
|
import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context"
|
||||||
import { useTask } from "@/contexts/task-context"
|
import { useTask } from "@/contexts/task-context"
|
||||||
|
|
@ -46,6 +46,13 @@ interface SearchResponse {
|
||||||
results: ChunkResult[]
|
results: ChunkResult[]
|
||||||
files?: FileResult[]
|
files?: FileResult[]
|
||||||
error?: string
|
error?: string
|
||||||
|
total?: number
|
||||||
|
aggregations?: {
|
||||||
|
data_sources?: { buckets?: Array<{ key: string | number; doc_count: number }> }
|
||||||
|
document_types?: { buckets?: Array<{ key: string | number; doc_count: number }> }
|
||||||
|
owners?: { buckets?: Array<{ key: string | number; doc_count: number }> }
|
||||||
|
connector_types?: { buckets?: Array<{ key: string | number; doc_count: number }> }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to get the appropriate icon for a connector type
|
// Function to get the appropriate icon for a connector type
|
||||||
|
|
@ -56,9 +63,9 @@ function getSourceIcon(connectorType?: string) {
|
||||||
case 'onedrive':
|
case 'onedrive':
|
||||||
return <TbBrandOnedrive className="h-4 w-4 text-foreground" />
|
return <TbBrandOnedrive className="h-4 w-4 text-foreground" />
|
||||||
case 'sharepoint':
|
case 'sharepoint':
|
||||||
return <SiSharepoint className="h-4 w-4 text-foreground" />
|
return <Building2 className="h-4 w-4 text-foreground" />
|
||||||
case 's3':
|
case 's3':
|
||||||
return <SiAmazonaws className="h-4 w-4 text-foreground" />
|
return <Cloud className="h-4 w-4 text-foreground" />
|
||||||
case 'local':
|
case 'local':
|
||||||
default:
|
default:
|
||||||
return <HardDrive className="h-4 w-4 text-muted-foreground" />
|
return <HardDrive className="h-4 w-4 text-muted-foreground" />
|
||||||
|
|
@ -100,6 +107,7 @@ function SearchPage() {
|
||||||
data_sources?: string[];
|
data_sources?: string[];
|
||||||
document_types?: string[];
|
document_types?: string[];
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
|
connector_types?: string[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -287,6 +295,7 @@ function SearchPage() {
|
||||||
data_sources?: string[];
|
data_sources?: string[];
|
||||||
document_types?: string[];
|
document_types?: string[];
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
|
connector_types?: string[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue