From 0fa4cca75824f116dec3e23d307eca7ed8680896 Mon Sep 17 00:00:00 2001 From: Krishav Raj Singh Date: Sun, 13 Jul 2025 14:56:34 +0530 Subject: [PATCH 1/4] fix: restore build dependencies --- frontend/Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 69cea002..74bf2b3b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -9,6 +9,20 @@ WORKDIR /app # Install dependencies based on the preferred package manager COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ + +RUN apt-get update && apt-get install -y --no-install-recommends \ + python3 \ + make \ + g++ \ + build-essential \ + pkg-config \ + libcairo2-dev \ + libpango1.0-dev \ + libjpeg-dev \ + libgif-dev \ + librsvg2-dev \ + && rm -rf /var/lib/apt/lists/* + RUN \ if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ elif [ -f package-lock.json ]; then npm ci; \ From f94b972992d6669a486b308d2fc04a809693ed06 Mon Sep 17 00:00:00 2001 From: Chaitanya045 Date: Mon, 14 Jul 2025 21:39:12 +0530 Subject: [PATCH 2/4] Enable image paste in chat input --- .../thread/chat-input/message-input.tsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/frontend/src/components/thread/chat-input/message-input.tsx b/frontend/src/components/thread/chat-input/message-input.tsx index 78508bfb..ded27ec4 100644 --- a/frontend/src/components/thread/chat-input/message-input.tsx +++ b/frontend/src/components/thread/chat-input/message-input.tsx @@ -16,6 +16,7 @@ import { Tooltip } from '@/components/ui/tooltip'; import { TooltipProvider, TooltipTrigger } from '@radix-ui/react-tooltip'; import { BillingModal } from '@/components/billing/billing-modal'; import ChatDropdown from './chat-dropdown'; +import { handleFiles } from './file-upload-handler'; interface MessageInputProps { value: string; @@ -129,6 +130,29 @@ export const MessageInput = forwardRef( } }; + const handlePaste = (e: React.ClipboardEvent) => { + if (!e.clipboardData) return; + const items = Array.from(e.clipboardData.items); + const imageFiles: File[] = []; + for (const item of items) { + if (item.kind === 'file' && item.type.startsWith('image/')) { + const file = item.getAsFile(); + if (file) imageFiles.push(file); + } + } + if (imageFiles.length > 0) { + e.preventDefault(); + handleFiles( + imageFiles, + sandboxId, + setPendingFiles, + setUploadedFiles, + setIsUploading, + messages, + ); + } + }; + const renderDropdown = () => { if (isLoggedIn) { const showAdvancedFeatures = enableAdvancedConfig || (customAgentsEnabled && !flagsLoading); @@ -167,6 +191,7 @@ export const MessageInput = forwardRef( value={value} onChange={onChange} onKeyDown={handleKeyDown} + onPaste={handlePaste} placeholder={placeholder} className={cn( 'w-full bg-transparent dark:bg-transparent border-none shadow-none focus-visible:ring-0 px-0.5 pb-6 pt-4 !text-[15px] min-h-[36px] max-h-[200px] overflow-y-auto resize-none', From 13c31d42f6cecc2666119ff53c06f5287bb75e68 Mon Sep 17 00:00:00 2001 From: sharath <29162020+tnfssc@users.noreply.github.com> Date: Tue, 15 Jul 2025 13:12:30 +0000 Subject: [PATCH 3/4] feat(kimi-k2): add support for Kimi-K2 model with updated token limits and parameters --- backend/agent/run.py | 3 +++ backend/services/llm.py | 6 ++++++ backend/utils/constants.py | 8 ++++++++ .../components/thread/chat-input/_use-model-selection.ts | 6 ++++++ 4 files changed, 23 insertions(+) diff --git a/backend/agent/run.py b/backend/agent/run.py index 2d3ba16e..d6967a7e 100644 --- a/backend/agent/run.py +++ b/backend/agent/run.py @@ -492,6 +492,9 @@ async def run_agent( elif "gemini-2.5-pro" in model_name.lower(): # Gemini 2.5 Pro has 64k max output tokens max_tokens = 64000 + elif "kimi-k2" in model_name.lower(): + # Kimi-K2 has 120K context, set reasonable max output tokens + max_tokens = 8192 generation = trace.generation(name="thread_manager.run_thread") if trace else None try: diff --git a/backend/services/llm.py b/backend/services/llm.py index 6187e247..7045294c 100644 --- a/backend/services/llm.py +++ b/backend/services/llm.py @@ -232,6 +232,12 @@ def prepare_params( use_thinking = enable_thinking if enable_thinking is not None else False is_anthropic = "anthropic" in effective_model_name.lower() or "claude" in effective_model_name.lower() is_xai = "xai" in effective_model_name.lower() or model_name.startswith("xai/") + is_kimi_k2 = "kimi-k2" in effective_model_name.lower() or model_name.startswith("moonshotai/kimi-k2") + + if is_kimi_k2: + params["provider"] = { + "order": ["groq", "together/fp8"] + } if is_anthropic and use_thinking: effort_level = reasoning_effort if reasoning_effort else 'low' diff --git a/backend/utils/constants.py b/backend/utils/constants.py index 9d85684f..4a0ac589 100644 --- a/backend/utils/constants.py +++ b/backend/utils/constants.py @@ -53,6 +53,14 @@ MODELS = { }, "tier_availability": ["paid"] }, + "openrouter/moonshotai/kimi-k2": { + "aliases": ["moonshotai/kimi-k2", "kimi-k2"], + "pricing": { + "input_cost_per_million_tokens": 1.00, + "output_cost_per_million_tokens": 3.00 + }, + "tier_availability": ["paid"] + }, "openai/gpt-4o": { "aliases": ["gpt-4o"], "pricing": { diff --git a/frontend/src/components/thread/chat-input/_use-model-selection.ts b/frontend/src/components/thread/chat-input/_use-model-selection.ts index 7687e1ed..d1ac4643 100644 --- a/frontend/src/components/thread/chat-input/_use-model-selection.ts +++ b/frontend/src/components/thread/chat-input/_use-model-selection.ts @@ -70,6 +70,12 @@ export const MODELS = { recommended: false, lowQuality: false }, + 'moonshotai/kimi-k2': { + tier: 'premium', + priority: 96, + recommended: false, + lowQuality: false + }, 'gpt-4.1': { tier: 'premium', priority: 96, From 89fa1afc6e15f34ac38e24a306b15968de727e40 Mon Sep 17 00:00:00 2001 From: sharath <29162020+tnfssc@users.noreply.github.com> Date: Tue, 15 Jul 2025 13:27:22 +0000 Subject: [PATCH 4/4] refactor(healthpage): replace API health check logic with useApiHealth hook in DashboardLayoutContent --- .../components/dashboard/layout-content.tsx | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/frontend/src/components/dashboard/layout-content.tsx b/frontend/src/components/dashboard/layout-content.tsx index 0af30b05..f07c9ad3 100644 --- a/frontend/src/components/dashboard/layout-content.tsx +++ b/frontend/src/components/dashboard/layout-content.tsx @@ -9,7 +9,7 @@ import { useAccounts } from '@/hooks/use-accounts'; import { useAuth } from '@/components/AuthProvider'; import { useRouter } from 'next/navigation'; import { Loader2 } from 'lucide-react'; -import { checkApiHealth } from '@/lib/api'; +import { useApiHealth } from '@/hooks/react-query'; import { MaintenancePage } from '@/components/maintenance/maintenance-page'; import { DeleteOperationProvider } from '@/contexts/DeleteOperationContext'; import { StatusOverlay } from '@/components/ui/status-overlay'; @@ -28,37 +28,19 @@ export default function DashboardLayoutContent({ }: DashboardLayoutContentProps) { // const [showPricingAlert, setShowPricingAlert] = useState(false) const [showMaintenanceAlert, setShowMaintenanceAlert] = useState(false); - const [isApiHealthy, setIsApiHealthy] = useState(true); - const [isCheckingHealth, setIsCheckingHealth] = useState(true); const { data: accounts } = useAccounts(); const personalAccount = accounts?.find((account) => account.personal_account); const { user, isLoading } = useAuth(); const router = useRouter(); + const { data: healthData, isLoading: isCheckingHealth, error: healthError } = useApiHealth(); useEffect(() => { // setShowPricingAlert(false) setShowMaintenanceAlert(false); }, []); - // Check API health - useEffect(() => { - const checkHealth = async () => { - try { - const health = await checkApiHealth(); - setIsApiHealthy(health.status === 'ok'); - } catch (error) { - console.error('API health check failed:', error); - setIsApiHealthy(false); - } finally { - setIsCheckingHealth(false); - } - }; - - checkHealth(); - // Check health every 30 seconds - const interval = setInterval(checkHealth, 30000); - return () => clearInterval(interval); - }, []); + // API health is now managed by useApiHealth hook + const isApiHealthy = healthData?.status === 'ok' && !healthError; // Check authentication status useEffect(() => { @@ -107,8 +89,8 @@ export default function DashboardLayoutContent({ return null; } - // Show maintenance page if API is not healthy - if (!isApiHealthy) { + // Show maintenance page if API is not healthy (but not during initial loading) + if (!isCheckingHealth && !isApiHealthy) { return ; }