mirror of https://github.com/kortix-ai/suna.git
exra
This commit is contained in:
parent
e51b1076a7
commit
f0c3c52cf4
|
@ -153,7 +153,7 @@ async def run_agent(thread_id: str, project_id: str, stream: bool = True, thread
|
||||||
stream=stream,
|
stream=stream,
|
||||||
llm_model=model_name,
|
llm_model=model_name,
|
||||||
llm_temperature=0,
|
llm_temperature=0,
|
||||||
llm_max_tokens=64000,
|
llm_max_tokens=128000,
|
||||||
tool_choice="auto",
|
tool_choice="auto",
|
||||||
max_xml_tool_calls=1,
|
max_xml_tool_calls=1,
|
||||||
temporary_message=temporary_message,
|
temporary_message=temporary_message,
|
||||||
|
|
|
@ -121,11 +121,12 @@ def prepare_params(
|
||||||
logger.debug(f"Added {len(tools)} tools to API parameters")
|
logger.debug(f"Added {len(tools)} tools to API parameters")
|
||||||
|
|
||||||
# # Add Claude-specific headers
|
# # Add Claude-specific headers
|
||||||
# if "claude" in model_name.lower() or "anthropic" in model_name.lower():
|
if "claude" in model_name.lower() or "anthropic" in model_name.lower():
|
||||||
# params["extra_headers"] = {
|
params["extra_headers"] = {
|
||||||
# "anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"
|
# "anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"
|
||||||
# }
|
"anthropic-beta": "output-128k-2025-02-19"
|
||||||
# logger.debug("Added Claude-specific headers")
|
}
|
||||||
|
logger.debug("Added Claude-specific headers")
|
||||||
|
|
||||||
# Add OpenRouter-specific parameters
|
# Add OpenRouter-specific parameters
|
||||||
if model_name.startswith("openrouter/"):
|
if model_name.startswith("openrouter/"):
|
||||||
|
|
|
@ -4,9 +4,9 @@ from services.supabase import DBConnection
|
||||||
|
|
||||||
# Define subscription tiers and their monthly hour limits
|
# Define subscription tiers and their monthly hour limits
|
||||||
SUBSCRIPTION_TIERS = {
|
SUBSCRIPTION_TIERS = {
|
||||||
'price_1RDQbOG6l1KZGqIrgrYzMbnL': {'name': 'free', 'hours': 1},
|
'price_1RDQbOG6l1KZGqIrgrYzMbnL': {'name': 'free', 'hours': 100},
|
||||||
'price_1RC2PYG6l1KZGqIrpbzFB9Lp': {'name': 'base', 'hours': 1},
|
'price_1RC2PYG6l1KZGqIrpbzFB9Lp': {'name': 'base', 'hours': 100},
|
||||||
'price_1RDQWqG6l1KZGqIrChli4Ys4': {'name': 'extra', 'hours': 1}
|
'price_1RDQWqG6l1KZGqIrChli4Ys4': {'name': 'extra', 'hours': 100}
|
||||||
}
|
}
|
||||||
|
|
||||||
async def get_account_subscription(client, account_id: str) -> Optional[Dict]:
|
async def get_account_subscription(client, account_id: str) -> Optional[Dict]:
|
||||||
|
|
|
@ -16,12 +16,12 @@ export const SUBSCRIPTION_PLANS = {
|
||||||
const PLAN_DETAILS = {
|
const PLAN_DETAILS = {
|
||||||
[SUBSCRIPTION_PLANS.FREE]: {
|
[SUBSCRIPTION_PLANS.FREE]: {
|
||||||
name: 'Free',
|
name: 'Free',
|
||||||
limit: 1,
|
limit: 100,
|
||||||
price: 0
|
price: 0
|
||||||
},
|
},
|
||||||
[SUBSCRIPTION_PLANS.BASIC]: {
|
[SUBSCRIPTION_PLANS.BASIC]: {
|
||||||
name: 'Basic',
|
name: 'Basic',
|
||||||
limit: 10,
|
limit: 100,
|
||||||
price: 10
|
price: 10
|
||||||
},
|
},
|
||||||
[SUBSCRIPTION_PLANS.PRO]: {
|
[SUBSCRIPTION_PLANS.PRO]: {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import React from 'react';
|
||||||
import { ParsedTag, ToolComponentProps } from '@/lib/types/tool-calls';
|
import { ParsedTag, ToolComponentProps } from '@/lib/types/tool-calls';
|
||||||
import {
|
import {
|
||||||
File, FileText, Terminal, FolderPlus, Folder, Code, Search as SearchIcon,
|
File, FileText, Terminal, FolderPlus, Folder, Code, Search as SearchIcon,
|
||||||
Bell, Replace, Plus, Minus, Globe
|
Bell, Replace, Plus, Minus, Globe, Search
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { diffLines } from 'diff';
|
import { diffLines } from 'diff';
|
||||||
|
@ -521,6 +521,65 @@ export const BrowserNavigateTool: React.FC<ToolComponentProps> = ({ tag, mode })
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Web Search Tool Component
|
||||||
|
*/
|
||||||
|
export const WebSearchTool: React.FC<ToolComponentProps> = ({ tag, mode }) => {
|
||||||
|
const query = tag.attributes.query || '';
|
||||||
|
const isRunning = tag.status === 'running';
|
||||||
|
|
||||||
|
if (mode === 'compact') {
|
||||||
|
return (
|
||||||
|
<CompactToolDisplay
|
||||||
|
icon={<Search className="h-4 w-4 mr-2" />}
|
||||||
|
name={isRunning ? "Web search in progress..." : "Web search complete"}
|
||||||
|
input={query}
|
||||||
|
isRunning={isRunning}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = tag.result?.output ? JSON.parse(tag.result.output) : [];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="border rounded-lg overflow-hidden border-subtle dark:border-white/10">
|
||||||
|
<div className="flex items-center px-2 py-1 text-xs font-medium border-b border-subtle dark:border-white/10 bg-background-secondary dark:bg-background-secondary text-foreground">
|
||||||
|
<Search className="h-4 w-4 mr-2" />
|
||||||
|
<div className="flex-1">Web Search: {query}</div>
|
||||||
|
{isRunning && (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span className="text-amber-500">Searching</span>
|
||||||
|
<div className="h-2 w-2 rounded-full bg-amber-500 animate-pulse"></div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="p-3 bg-card-bg dark:bg-background-secondary text-foreground">
|
||||||
|
{results.length > 0 ? (
|
||||||
|
<div className="space-y-3">
|
||||||
|
{results.map((result: any, index: number) => (
|
||||||
|
<div key={index} className="text-sm">
|
||||||
|
<a href={result.URL} target="_blank" rel="noopener noreferrer" className="font-medium text-blue-600 hover:underline">
|
||||||
|
{result.Title}
|
||||||
|
</a>
|
||||||
|
<div className="text-xs text-muted-foreground mt-1">
|
||||||
|
{result.URL}
|
||||||
|
{result['Published Date'] && (
|
||||||
|
<span className="ml-2">
|
||||||
|
({new Date(result['Published Date']).toLocaleDateString()})
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="text-sm text-muted-foreground">No results found</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
// Tool component registry
|
// Tool component registry
|
||||||
export const ToolComponentRegistry: Record<string, React.FC<ToolComponentProps>> = {
|
export const ToolComponentRegistry: Record<string, React.FC<ToolComponentProps>> = {
|
||||||
'create-file': CreateFileTool,
|
'create-file': CreateFileTool,
|
||||||
|
@ -547,10 +606,15 @@ export const ToolComponentRegistry: Record<string, React.FC<ToolComponentProps>>
|
||||||
'browser-get-dropdown-options': BrowserNavigateTool,
|
'browser-get-dropdown-options': BrowserNavigateTool,
|
||||||
'browser-select-dropdown-option': BrowserNavigateTool,
|
'browser-select-dropdown-option': BrowserNavigateTool,
|
||||||
'browser-drag-drop': BrowserNavigateTool,
|
'browser-drag-drop': BrowserNavigateTool,
|
||||||
|
'web-search': WebSearchTool,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to get the appropriate component for a tag
|
// Helper function to get the appropriate component for a tag
|
||||||
export function getComponentForTag(tag: ParsedTag): React.FC<ToolComponentProps> {
|
export function getComponentForTag(tag: ParsedTag): React.FC<ToolComponentProps> {
|
||||||
|
console.log("getComponentForTag", tag);
|
||||||
|
if (!tag || !tag?.tagName) {
|
||||||
|
console.warn(`No tag name for tag: ${tag}`);
|
||||||
|
}
|
||||||
if (!ToolComponentRegistry[tag.tagName]) {
|
if (!ToolComponentRegistry[tag.tagName]) {
|
||||||
console.warn(`No component registered for tag type: ${tag.tagName}`);
|
console.warn(`No component registered for tag type: ${tag.tagName}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,8 @@ export const SUPPORTED_XML_TAGS = [
|
||||||
'browser-close-tab',
|
'browser-close-tab',
|
||||||
'browser-get-dropdown-options',
|
'browser-get-dropdown-options',
|
||||||
'browser-select-dropdown-option',
|
'browser-select-dropdown-option',
|
||||||
'browser-drag-drop'
|
'browser-drag-drop',
|
||||||
|
'web-search'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Tool status labels
|
// Tool status labels
|
||||||
|
|
Loading…
Reference in New Issue