Merge pull request #1300 from escapade-mckv/bug-fixes-1b

ui bug fixes
This commit is contained in:
Bobbie 2025-08-11 18:04:41 +05:30 committed by GitHub
commit 66a5140125
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 60 additions and 46 deletions

View File

@ -6,10 +6,6 @@ Your mission is to transform ideas into powerful, working AI Workers that genuin
## SYSTEM INFORMATION ## SYSTEM INFORMATION
- BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim) - BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim)
- UTC DATE: {{current_date}}
- UTC TIME: {{current_time}}
- CURRENT YEAR: {{current_year}}
## 🎯 What You Can Help Users Build ## 🎯 What You Can Help Users Build
### 🤖 **Smart Assistants** ### 🤖 **Smart Assistants**
@ -459,8 +455,4 @@ I'm here to help you create an agent that will genuinely transform how you work.
def get_agent_builder_prompt(): def get_agent_builder_prompt():
return AGENT_BUILDER_SYSTEM_PROMPT.format( return AGENT_BUILDER_SYSTEM_PROMPT
current_date=datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d'),
current_time=datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S'),
current_year=datetime.datetime.now(datetime.timezone.utc).strftime('%Y')
)

View File

@ -15,10 +15,7 @@ You are a full-spectrum autonomous agent capable of executing complex tasks acro
- All file operations (create, read, write, delete) expect paths relative to "/workspace" - All file operations (create, read, write, delete) expect paths relative to "/workspace"
## 2.2 SYSTEM INFORMATION ## 2.2 SYSTEM INFORMATION
- BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim) - BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim)
- UTC DATE: {{current_date}} - TIME CONTEXT: When searching for latest news or time-sensitive information, ALWAYS use the current date/time values provided at runtime as reference points. Never use outdated information or assume different dates.
- UTC TIME: {{current_time}}
- CURRENT YEAR: {{current_year}}
- TIME CONTEXT: When searching for latest news or time-sensitive information, ALWAYS use these current date/time values as reference points. Never use outdated information or assume different dates.
- INSTALLED TOOLS: - INSTALLED TOOLS:
* PDF Processing: poppler-utils, wkhtmltopdf * PDF Processing: poppler-utils, wkhtmltopdf
* Document Processing: antiword, unrtf, catdoc * Document Processing: antiword, unrtf, catdoc
@ -444,10 +441,7 @@ You have the ability to execute operations using both Python and CLI tools:
5. Try alternative queries if initial search results are inadequate 5. Try alternative queries if initial search results are inadequate
- TIME CONTEXT FOR RESEARCH: - TIME CONTEXT FOR RESEARCH:
* CURRENT YEAR: {datetime.datetime.now(datetime.timezone.utc).strftime('%Y')} * CRITICAL: When searching for latest news or time-sensitive information, ALWAYS use the current date/time values provided at runtime as reference points. Never use outdated information or assume different dates.
* CURRENT UTC DATE: {datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d')}
* CURRENT UTC TIME: {datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S')}
* CRITICAL: When searching for latest news or time-sensitive information, ALWAYS use these current date/time values as reference points. Never use outdated information or assume different dates.
# 5. WORKFLOW MANAGEMENT # 5. WORKFLOW MANAGEMENT
@ -1756,11 +1750,7 @@ Is there anything specific you'd like me to adjust or explain in more detail abo
def get_gemini_system_prompt(): def get_gemini_system_prompt():
return SYSTEM_PROMPT.format( return SYSTEM_PROMPT + EXAMPLE
current_date=datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d'),
current_time=datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S'),
current_year=datetime.datetime.now(datetime.timezone.utc).strftime('%Y')
) + EXAMPLE
# if __name__ == "__main__": # if __name__ == "__main__":

View File

@ -15,10 +15,7 @@ You are a full-spectrum autonomous agent capable of executing complex tasks acro
- All file operations (create, read, write, delete) expect paths relative to "/workspace" - All file operations (create, read, write, delete) expect paths relative to "/workspace"
## 2.2 SYSTEM INFORMATION ## 2.2 SYSTEM INFORMATION
- BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim) - BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim)
- UTC DATE: {{current_date}} - TIME CONTEXT: When searching for latest news or time-sensitive information, ALWAYS use the current date/time values provided at runtime as reference points. Never use outdated information or assume different dates.
- UTC TIME: {{current_time}}
- CURRENT YEAR: {{current_year}}
- TIME CONTEXT: When searching for latest news or time-sensitive information, ALWAYS use these current date/time values as reference points. Never use outdated information or assume different dates.
- INSTALLED TOOLS: - INSTALLED TOOLS:
* PDF Processing: poppler-utils, wkhtmltopdf * PDF Processing: poppler-utils, wkhtmltopdf
* Document Processing: antiword, unrtf, catdoc * Document Processing: antiword, unrtf, catdoc
@ -468,10 +465,7 @@ IMPORTANT: Use the `cat` command to view contents of small files (100 kb or less
5. Try alternative queries if initial search results are inadequate 5. Try alternative queries if initial search results are inadequate
- TIME CONTEXT FOR RESEARCH: - TIME CONTEXT FOR RESEARCH:
* CCURRENT YEAR: {datetime.datetime.now(datetime.timezone.utc).strftime('%Y')} * CRITICAL: When searching for latest news or time-sensitive information, ALWAYS use the current date/time values provided at runtime as reference points. Never use outdated information or assume different dates.
* CURRENT UTC DATE: {datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d')}
* CURRENT UTC TIME: {datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S')}
* CRITICAL: When searching for latest news or time-sensitive information, ALWAYS use these current date/time values as reference points. Never use outdated information or assume different dates.
# 5. WORKFLOW MANAGEMENT # 5. WORKFLOW MANAGEMENT
@ -1120,8 +1114,4 @@ Remember: You maintain all your core Suna capabilities while gaining the power t
def get_system_prompt(): def get_system_prompt():
return SYSTEM_PROMPT.format( return SYSTEM_PROMPT
current_date=datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d'),
current_time=datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S'),
current_year=datetime.datetime.now(datetime.timezone.utc).strftime('%Y')
)

View File

@ -1,6 +1,7 @@
import os import os
import json import json
import asyncio import asyncio
import datetime
from typing import Optional, Dict, List, Any, AsyncGenerator from typing import Optional, Dict, List, Any, AsyncGenerator
from dataclasses import dataclass from dataclasses import dataclass
@ -289,6 +290,17 @@ class PromptManager:
system_content += mcp_info system_content += mcp_info
now = datetime.datetime.now(datetime.timezone.utc)
datetime_info = f"\n\n=== CURRENT DATE/TIME INFORMATION ===\n"
datetime_info += f"Today's date: {now.strftime('%A, %B %d, %Y')}\n"
datetime_info += f"Current UTC time: {now.strftime('%H:%M:%S UTC')}\n"
datetime_info += f"Current year: {now.strftime('%Y')}\n"
datetime_info += f"Current month: {now.strftime('%B')}\n"
datetime_info += f"Current day: {now.strftime('%A')}\n"
datetime_info += "Use this information for any time-sensitive tasks, research, or when current date/time context is needed.\n"
system_content += datetime_info
return {"role": "system", "content": system_content} return {"role": "system", "content": system_content}

View File

@ -34,11 +34,7 @@ class SunaConfig:
@classmethod @classmethod
def get_system_prompt(cls) -> str: def get_system_prompt(cls) -> str:
return cls.SYSTEM_PROMPT.format( return cls.SYSTEM_PROMPT
current_date=datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d'),
current_time=datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S'),
current_year=datetime.datetime.now(datetime.timezone.utc).strftime('%Y')
)
@classmethod @classmethod
def get_full_config(cls) -> Dict[str, Any]: def get_full_config(cls) -> Dict[str, Any]:

View File

@ -688,6 +688,7 @@ export default function ThreadPage({
debugMode={debugMode} debugMode={debugMode}
agentName={agent && agent.name} agentName={agent && agent.name}
agentAvatar={agent && agent.avatar} agentAvatar={agent && agent.avatar}
agentMetadata={agent?.metadata}
scrollContainerRef={scrollContainerRef} scrollContainerRef={scrollContainerRef}
/> />

View File

@ -329,6 +329,7 @@ export const AgentPreview = ({ agent, agentMetadata }: AgentPreviewProps) => {
isPreviewMode={true} isPreviewMode={true}
agentName={agent.name} agentName={agent.name}
agentAvatar={avatar} agentAvatar={avatar}
agentMetadata={agentMetadata}
emptyStateComponent={ emptyStateComponent={
<div className="flex flex-col items-center text-center text-muted-foreground/80"> <div className="flex flex-col items-center text-center text-muted-foreground/80">
<div className="flex w-20 aspect-square items-center justify-center rounded-2xl bg-muted-foreground/10 p-4 mb-4"> <div className="flex w-20 aspect-square items-center justify-center rounded-2xl bg-muted-foreground/10 p-4 mb-4">

View File

@ -16,6 +16,7 @@ import {
import { toast } from 'sonner'; import { toast } from 'sonner';
import { isLocalMode, isYearlyCommitmentDowngrade, isPlanChangeAllowed, getPlanInfo } from '@/lib/config'; import { isLocalMode, isYearlyCommitmentDowngrade, isPlanChangeAllowed, getPlanInfo } from '@/lib/config';
import { useSubscription, useSubscriptionCommitment } from '@/hooks/react-query'; import { useSubscription, useSubscriptionCommitment } from '@/hooks/react-query';
import { useAuth } from '@/components/AuthProvider';
import posthog from 'posthog-js'; import posthog from 'posthog-js';
// Constants // Constants
@ -546,10 +547,19 @@ export function PricingSection({
noPadding = false, noPadding = false,
}: PricingSectionProps) { }: PricingSectionProps) {
const { data: subscriptionData, isLoading: isFetchingPlan, error: subscriptionQueryError, refetch: refetchSubscription } = useSubscription(); const { user, isLoading: authLoading } = useAuth();
const {
data: subscriptionData,
isLoading: isFetchingPlan,
error: subscriptionQueryError,
refetch: refetchSubscription
} = useSubscription({
enabled: !!user && !authLoading,
});
const subCommitmentQuery = useSubscriptionCommitment(subscriptionData?.subscription_id); const subCommitmentQuery = useSubscriptionCommitment(subscriptionData?.subscription_id);
const isAuthenticated = !!subscriptionData && subscriptionQueryError === null; const isAuthenticated = !!user && !!subscriptionData && subscriptionQueryError === null;
const currentSubscription = subscriptionData || null; const currentSubscription = subscriptionData || null;
const getDefaultBillingPeriod = useCallback((): 'monthly' | 'yearly' | 'yearly_commitment' => { const getDefaultBillingPeriod = useCallback((): 'monthly' | 'yearly' | 'yearly_commitment' => {

View File

@ -281,6 +281,7 @@ export interface ThreadContentProps {
emptyStateComponent?: React.ReactNode; // Add custom empty state component prop emptyStateComponent?: React.ReactNode; // Add custom empty state component prop
threadMetadata?: any; // Add thread metadata prop threadMetadata?: any; // Add thread metadata prop
scrollContainerRef?: React.RefObject<HTMLDivElement>; // Add scroll container ref prop scrollContainerRef?: React.RefObject<HTMLDivElement>; // Add scroll container ref prop
agentMetadata?: any; // Add agent metadata prop
} }
export const ThreadContent: React.FC<ThreadContentProps> = ({ export const ThreadContent: React.FC<ThreadContentProps> = ({
@ -305,6 +306,7 @@ export const ThreadContent: React.FC<ThreadContentProps> = ({
emptyStateComponent, emptyStateComponent,
threadMetadata, threadMetadata,
scrollContainerRef, scrollContainerRef,
agentMetadata,
}) => { }) => {
const messagesContainerRef = useRef<HTMLDivElement>(null); const messagesContainerRef = useRef<HTMLDivElement>(null);
const latestMessageRef = useRef<HTMLDivElement>(null); const latestMessageRef = useRef<HTMLDivElement>(null);
@ -336,6 +338,9 @@ export const ThreadContent: React.FC<ThreadContentProps> = ({
}; };
} }
// Check if this is a Suna default agent from metadata
const isSunaDefaultAgent = agentMetadata?.is_suna_default || false;
// Then check recent messages for agent info // Then check recent messages for agent info
const recentAssistantWithAgent = [...displayMessages].reverse().find(msg => const recentAssistantWithAgent = [...displayMessages].reverse().find(msg =>
msg.type === 'assistant' && (msg.agents?.avatar || msg.agents?.avatar_color || msg.agents?.name) msg.type === 'assistant' && (msg.agents?.avatar || msg.agents?.avatar_color || msg.agents?.name)
@ -353,8 +358,8 @@ export const ThreadContent: React.FC<ThreadContentProps> = ({
} }
if (recentAssistantWithAgent?.agents?.name) { if (recentAssistantWithAgent?.agents?.name) {
const isSunaAgent = recentAssistantWithAgent.agents.name === 'Suna'; const isSunaAgent = recentAssistantWithAgent.agents.name === 'Suna' || isSunaDefaultAgent;
const avatar = recentAssistantWithAgent.agents.avatar ? ( const avatar = recentAssistantWithAgent.agents.avatar && !isSunaDefaultAgent ? (
<> <>
{isSunaAgent ? ( {isSunaAgent ? (
<div className="h-5 w-5 flex items-center justify-center rounded text-xs"> <div className="h-5 w-5 flex items-center justify-center rounded text-xs">
@ -376,11 +381,24 @@ export const ThreadContent: React.FC<ThreadContentProps> = ({
avatar avatar
}; };
} }
// Fallback: if this is a Suna default agent, always show KortixLogo
if (isSunaDefaultAgent) {
return {
name: agentName || 'Suna',
avatar: (
<div className="h-5 w-5 flex items-center justify-center rounded text-xs">
<KortixLogo size={16} />
</div>
)
};
}
return { return {
name: agentName || 'Suna', name: agentName || 'Suna',
avatar: agentAvatar avatar: agentAvatar
}; };
}, [threadMetadata, displayMessages, agentName, agentAvatar]); }, [threadMetadata, displayMessages, agentName, agentAvatar, agentMetadata]);
// Simplified scroll handler - flex-column-reverse handles positioning // Simplified scroll handler - flex-column-reverse handles positioning
const handleScroll = useCallback(() => { const handleScroll = useCallback(() => {

View File

@ -4,8 +4,12 @@ import { GetAccountsResponse } from '@usebasejump/shared';
export const useAccounts = (options?: SWRConfiguration) => { export const useAccounts = (options?: SWRConfiguration) => {
const supabaseClient = createClient(); const supabaseClient = createClient();
return useSWR<GetAccountsResponse>( return useSWR<GetAccountsResponse>(
!!supabaseClient && ['accounts'], async () => {
const { data: { user } } = await supabaseClient.auth.getUser();
return user ? ['accounts', user.id] : null;
},
async () => { async () => {
const { data, error } = await supabaseClient.rpc('get_accounts'); const { data, error } = await supabaseClient.rpc('get_accounts');