diff --git a/frontend/crawlab-ui/src/assets/svg/icons/openrouter.svg b/frontend/crawlab-ui/src/assets/svg/icons/openrouter.svg new file mode 100644 index 00000000..e6cca2a8 --- /dev/null +++ b/frontend/crawlab-ui/src/assets/svg/icons/openrouter.svg @@ -0,0 +1 @@ +OpenRouter \ No newline at end of file diff --git a/frontend/crawlab-ui/src/components/core/ai/LlmProviderForm.vue b/frontend/crawlab-ui/src/components/core/ai/LlmProviderForm.vue index c9b9de5a..1ff3299c 100644 --- a/frontend/crawlab-ui/src/components/core/ai/LlmProviderForm.vue +++ b/frontend/crawlab-ui/src/components/core/ai/LlmProviderForm.vue @@ -2,7 +2,7 @@ import { computed, onBeforeMount, ref, watch } from 'vue'; import { translate } from '@/utils'; import { ElMessage } from 'element-plus'; -import { getLLMProviderItems } from '@/utils/ai'; +import { getLLMProviderItems } from '@/utils/llm'; const props = defineProps<{ loading?: boolean; diff --git a/frontend/crawlab-ui/src/components/ui/chat/ChatInput.vue b/frontend/crawlab-ui/src/components/ui/chat/ChatInput.vue index 9ba691e5..d31c4814 100644 --- a/frontend/crawlab-ui/src/components/ui/chat/ChatInput.vue +++ b/frontend/crawlab-ui/src/components/ui/chat/ChatInput.vue @@ -10,7 +10,7 @@ import { import { useI18n } from 'vue-i18n'; import { getLLMProviderItems, -} from '@/utils/ai'; +} from '@/utils/llm'; // Add TypeScript interface for tree node interface TreeNode { diff --git a/frontend/crawlab-ui/src/interfaces/models/autoprobe.d.ts b/frontend/crawlab-ui/src/interfaces/models/autoprobe.d.ts index b9966626..3d421286 100644 --- a/frontend/crawlab-ui/src/interfaces/models/autoprobe.d.ts +++ b/frontend/crawlab-ui/src/interfaces/models/autoprobe.d.ts @@ -13,6 +13,25 @@ export declare global { viewport?: PageViewPort; } + // Hierarchical pattern structure for V2 + interface PatternV2 { + name: string; + type: PatternTypeV2; + selector_type?: SelectorType; + selector?: string; + is_absolute_selector?: boolean; + extraction_type?: ExtractType; + attribute_name?: string; + children?: PatternV2[]; + } + + interface PagePatternV2 { + name: string; + children?: PatternV2[]; + } + + type PatternTypeV2 = 'field' | 'list' | 'list-item' | 'action' | 'content'; + type AutoProbeTaskStatus = | 'pending' | 'running' @@ -67,7 +86,8 @@ export declare global { status: AutoProbeTaskStatus; error?: string; html?: string; - page_pattern?: PagePattern; + // page_pattern?: PagePattern; + page_pattern?: PagePatternV2; page_data?: PageData; page_elements?: PageElement[]; provider_id?: string; @@ -75,14 +95,6 @@ export declare global { usage?: LLMResponseUsage; } - interface AutoProbeTaskResult { - html?: string; - screenshot_base64?: string; - page_pattern?: PagePattern; - page_data?: PageData; - page_elements?: PageElement[]; - } - type AutoProbeItemType = 'page_pattern' | 'list' | 'field' | 'pagination'; interface AutoProbeNavItem extends NavItem { diff --git a/frontend/crawlab-ui/src/interfaces/models/llm.d.ts b/frontend/crawlab-ui/src/interfaces/models/llm.d.ts index f73c9a41..a0ffa5d2 100644 --- a/frontend/crawlab-ui/src/interfaces/models/llm.d.ts +++ b/frontend/crawlab-ui/src/interfaces/models/llm.d.ts @@ -14,6 +14,7 @@ export declare global { | 'qwen' | 'deepseek' | 'mistral' + | 'openrouter' | 'openai-compatible'; interface LLMProvider extends BaseModel { diff --git a/frontend/crawlab-ui/src/utils/ai.ts b/frontend/crawlab-ui/src/utils/llm.ts similarity index 86% rename from frontend/crawlab-ui/src/utils/ai.ts rename to frontend/crawlab-ui/src/utils/llm.ts index 88d22c30..2e04d066 100644 --- a/frontend/crawlab-ui/src/utils/ai.ts +++ b/frontend/crawlab-ui/src/utils/llm.ts @@ -92,6 +92,19 @@ export const getLLMProviderItems = (): LLMProviderItem[] => { icon: ['svg', 'deepseek'], defaultModels: ['deepseek-chat', 'deepseek-reasoner'], }, + { + type: 'openrouter', + name: 'OpenRouter', + icon: ['svg', 'openrouter'], + defaultModels: [ + 'anthropic/claude-sonnet-4', + 'anthropic/claude-3.7-sonnet', + 'google/gemini-2.5-pro-preview', + 'google/gemini-2.5-flash-preview', + 'openai/gpt-4.1', + 'openai/gpt-4o-mini', + ], + }, { type: 'openai-compatible', name: 'OpenAI Compatible', diff --git a/frontend/crawlab-ui/src/views/autoprobe/list/useAutoProbeList.tsx b/frontend/crawlab-ui/src/views/autoprobe/list/useAutoProbeList.tsx index 45b77337..dd5f45ee 100644 --- a/frontend/crawlab-ui/src/views/autoprobe/list/useAutoProbeList.tsx +++ b/frontend/crawlab-ui/src/views/autoprobe/list/useAutoProbeList.tsx @@ -128,23 +128,23 @@ const useAutoProbeList = () => { hasFilter: true, allowFilterSearch: true, }, - { - key: 'patterns', - label: t('views.autoprobe.table.columns.patterns'), - icon: ['fa', 'network-wired'], - width: '200', - value: (row: AutoProbe) => { - return ( - router.push(`/autoprobes/${row._id}/patterns`)} - /> - ); - }, - hasFilter: true, - allowFilterSearch: true, - }, + // { + // key: 'patterns', + // label: t('views.autoprobe.table.columns.patterns'), + // icon: ['fa', 'network-wired'], + // width: '200', + // value: (row: AutoProbe) => { + // return ( + // router.push(`/autoprobes/${row._id}/patterns`)} + // /> + // ); + // }, + // hasFilter: true, + // allowFilterSearch: true, + // }, { key: TABLE_COLUMN_NAME_ACTIONS, label: t('components.table.columns.actions'), diff --git a/frontend/crawlab-ui/src/views/system/detail/tabs/SystemDetailTabModels.vue b/frontend/crawlab-ui/src/views/system/detail/tabs/SystemDetailTabModels.vue index a4b507cd..365809d4 100644 --- a/frontend/crawlab-ui/src/views/system/detail/tabs/SystemDetailTabModels.vue +++ b/frontend/crawlab-ui/src/views/system/detail/tabs/SystemDetailTabModels.vue @@ -14,7 +14,7 @@ import { ACTION_EDIT, TABLE_COLUMN_NAME_ACTIONS, } from '@/constants'; -import { getLLMProviderItems } from '@/utils/ai'; +import { getLLMProviderItems } from '@/utils/llm'; const t = translate;