Revert "Revert "feat: add auto search logic""

This reverts commit 536f046b60.
This commit is contained in:
amhsirak
2026-01-23 17:50:26 +05:30
parent 4e1a3fdc5d
commit 3bf77e4f8c
6 changed files with 610 additions and 41 deletions

View File

@@ -59,7 +59,7 @@ export const createScrapeRobot = async (
};
export const createLLMRobot = async (
url: string,
url: string | undefined,
prompt: string,
llmProvider?: 'anthropic' | 'openai' | 'ollama',
llmModel?: string,
@@ -71,7 +71,7 @@ export const createLLMRobot = async (
const response = await axios.post(
`${apiUrl}/storage/recordings/llm`,
{
url,
url: url || undefined,
prompt,
llmProvider,
llmModel,

View File

@@ -97,7 +97,7 @@ const LoadingRobotRow = memo(({ row, columns }: any) => {
} else if (column.id === 'interpret') {
return (
<MemoizedTableCell key={column.id} align={column.align}>
<CircularProgress size={20} />
<Box sx={{ opacity: 0.3 }}>-</Box>
</MemoizedTableCell>
);
} else {

View File

@@ -65,7 +65,7 @@ const RobotCreate: React.FC = () => {
const [isWarningModalOpen, setWarningModalOpen] = useState(false);
const [activeBrowserId, setActiveBrowserId] = useState('');
const [outputFormats, setOutputFormats] = useState<string[]>([]);
const [generationMode, setGenerationMode] = useState<'agent' | 'recorder' | null>(null);
const [generationMode, setGenerationMode] = useState<'agent' | 'recorder' | null>('recorder');
const [aiPrompt, setAiPrompt] = useState('');
const [llmProvider, setLlmProvider] = useState<'anthropic' | 'openai' | 'ollama'>('ollama');
@@ -323,17 +323,6 @@ const RobotCreate: React.FC = () => {
<Typography variant="body2" color="text.secondary" mb={3}>
Extract structured data from websites using AI or record your own extraction workflow.
</Typography>
<Box sx={{ width: '100%', maxWidth: 700, mb: 3 }}>
<TextField
placeholder="Example: https://www.ycombinator.com/companies/"
variant="outlined"
fullWidth
value={url}
onChange={(e) => setUrl(e.target.value)}
label="Website URL"
/>
</Box>
<Box sx={{ width: '100%', maxWidth: 700, mb: 3 }}>
<Typography variant="subtitle1" gutterBottom sx={{ mb: 2 }} color="text.secondary">
Choose How to Build
@@ -432,6 +421,17 @@ const RobotCreate: React.FC = () => {
/>
</Box>
<Box sx={{ mb: 3 }}>
<TextField
placeholder="Example: https://www.ycombinator.com/companies/"
variant="outlined"
fullWidth
value={url}
onChange={(e) => setUrl(e.target.value)}
label="Website URL (Optional)"
/>
</Box>
<Box sx={{ display: 'flex', gap: 2, mb: 3 }}>
<FormControl sx={{ flex: 1 }}>
<InputLabel>LLM Provider</InputLabel>
@@ -517,10 +517,7 @@ const RobotCreate: React.FC = () => {
variant="contained"
fullWidth
onClick={async () => {
if (!url.trim()) {
notify('error', 'Please enter a valid URL');
return;
}
// URL is optional for AI mode - it will auto-search if not provided
if (!extractRobotName.trim()) {
notify('error', 'Please enter a robot name');
return;
@@ -543,7 +540,7 @@ const RobotCreate: React.FC = () => {
pairs: 0,
params: [],
type: 'extract',
url: url,
url: url || '(auto-detecting...)',
},
recording: { workflow: [] },
isLoading: true,
@@ -552,12 +549,14 @@ const RobotCreate: React.FC = () => {
addOptimisticRobot(optimisticRobot);
notify('info', `Robot ${robotDisplayName} creation started`);
notify('info', url.trim()
? `Robot ${robotDisplayName} creation started`
: `Robot ${robotDisplayName} creation started (searching for website...)`);
navigate('/robots');
try {
const result = await createLLMRobot(
url,
url.trim() || undefined,
aiPrompt,
llmProvider,
llmModel === 'default' ? undefined : llmModel,
@@ -617,7 +616,7 @@ const RobotCreate: React.FC = () => {
notify('error', error?.message || 'Failed to create and run AI robot');
}
}}
disabled={!url.trim() || !extractRobotName.trim() || !aiPrompt.trim() || isLoading}
disabled={!extractRobotName.trim() || !aiPrompt.trim() || isLoading}
sx={{
bgcolor: '#ff00c3',
py: 1.4,
@@ -633,6 +632,17 @@ const RobotCreate: React.FC = () => {
)}
{generationMode === 'recorder' && (
<>
<Box sx={{ width: '100%', maxWidth: 700, mb: 3 }}>
<TextField
placeholder="Example: https://www.ycombinator.com/companies/"
variant="outlined"
fullWidth
value={url}
onChange={(e) => setUrl(e.target.value)}
label="Website URL"
/>
</Box>
<Box sx={{ width: '100%', maxWidth: 700 }}>
<Button
variant="contained"
@@ -651,6 +661,7 @@ const RobotCreate: React.FC = () => {
{isLoading ? 'Starting...' : 'Start Recording'}
</Button>
</Box>
</>
)}
</Box>
</Card>