Spaces:
Paused
Paused
CBV01 commited on
Commit ·
7c18e9f
1
Parent(s): 79e85da
Restore original clean tabs bar design and highlight active model under search bar
Browse files
frontend/src/app/scraper/page.tsx
CHANGED
|
@@ -866,81 +866,31 @@ export default function ScraperPage() {
|
|
| 866 |
</button>
|
| 867 |
</div>
|
| 868 |
|
| 869 |
-
<div className="flex items-center gap-2 self-end sm:self-auto
|
| 870 |
-
{isAiConnected && (
|
| 871 |
-
<div className="flex items-center gap-1.5 bg-card/90 border border-emerald-500/30 px-2.5 py-1.5 rounded-xl text-xs shadow-xs hover:border-emerald-500/50 transition-all">
|
| 872 |
-
<Cpu size={13} className="text-emerald-400 shrink-0" />
|
| 873 |
-
<span className="text-[11px] text-foreground/50 font-medium hidden sm:inline">Model:</span>
|
| 874 |
-
<select
|
| 875 |
-
value={aiModel}
|
| 876 |
-
onChange={(e) => {
|
| 877 |
-
const newM = e.target.value;
|
| 878 |
-
setAiModel(newM);
|
| 879 |
-
localStorage.setItem('arkitel_ai_model', newM);
|
| 880 |
-
setSuccessMsg(`Switched AI model to ${getShortModelName(newM)}`);
|
| 881 |
-
setTimeout(() => setSuccessMsg(''), 3000);
|
| 882 |
-
}}
|
| 883 |
-
className="bg-transparent text-xs text-foreground font-semibold focus:outline-none cursor-pointer max-w-[130px] sm:max-w-[200px] truncate"
|
| 884 |
-
title="Active Model for AI Scraping and Keyword Suggestions"
|
| 885 |
-
>
|
| 886 |
-
{aiModel && !availableModels.some(m => m.id === aiModel) && (
|
| 887 |
-
<option value={aiModel} className="bg-card text-foreground">{aiModel}</option>
|
| 888 |
-
)}
|
| 889 |
-
{availableModels.length > 0 ? (
|
| 890 |
-
availableModels.map(m => (
|
| 891 |
-
<option key={m.id} value={m.id} className="bg-card text-foreground">
|
| 892 |
-
{m.name || m.id}
|
| 893 |
-
</option>
|
| 894 |
-
))
|
| 895 |
-
) : (
|
| 896 |
-
TOP_MODELS.map(m => (
|
| 897 |
-
<option key={m.id} value={m.id} className="bg-card text-foreground">
|
| 898 |
-
{m.name}
|
| 899 |
-
</option>
|
| 900 |
-
))
|
| 901 |
-
)}
|
| 902 |
-
</select>
|
| 903 |
-
</div>
|
| 904 |
-
)}
|
| 905 |
-
|
| 906 |
<button
|
| 907 |
type="button"
|
| 908 |
onClick={() => {
|
| 909 |
setIsAiModalOpen(true);
|
| 910 |
if (availableModels.length === 0) fetchOpenRouterModels();
|
| 911 |
}}
|
| 912 |
-
className={`px-3 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-
|
| 913 |
isAiConnected
|
| 914 |
-
? 'border
|
| 915 |
-
: 'border
|
| 916 |
}`}
|
| 917 |
-
title=
|
| 918 |
>
|
|
|
|
|
|
|
| 919 |
{isAiConnected ? (
|
| 920 |
-
<>
|
| 921 |
-
|
| 922 |
-
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
|
| 923 |
-
<span className="relative inline-flex rounded-full h-2 w-2 bg-emerald-500 shadow-[0_0_8px_rgba(52,211,153,0.9)]"></span>
|
| 924 |
-
</span>
|
| 925 |
-
<span className="text-emerald-300 font-bold tracking-tight">OpenRouter</span>
|
| 926 |
-
<span className="text-[10px] px-1.5 py-0.5 rounded-md bg-emerald-500/20 text-emerald-200 border border-emerald-500/30 font-mono max-w-[120px] truncate hidden xs:inline-block">
|
| 927 |
-
{getShortModelName(aiModel)}
|
| 928 |
-
</span>
|
| 929 |
-
<Settings2 size={12} className="text-emerald-400/80 hover:text-emerald-300 transition-colors" />
|
| 930 |
-
</>
|
| 931 |
-
) : (
|
| 932 |
-
<>
|
| 933 |
-
<Settings2 size={13} className="text-indigo-400" />
|
| 934 |
-
<span>Connect OpenRouter</span>
|
| 935 |
-
<span className="text-[10px] px-1.5 py-0.5 rounded-md bg-indigo-500/10 text-indigo-400 font-mono">AI</span>
|
| 936 |
-
</>
|
| 937 |
-
)}
|
| 938 |
</button>
|
| 939 |
</div>
|
| 940 |
</div>
|
| 941 |
|
| 942 |
{/* Search Bar & Filter Toolbar */}
|
| 943 |
-
<div className="flex flex-col md:flex-row gap-3 mb-
|
| 944 |
<form id="scraper-form" onSubmit={handleSearch} className="flex-1 bg-card border border-border/80 rounded-xl p-2.5 shadow-sm flex flex-col sm:flex-row gap-2">
|
| 945 |
<div className="relative flex-1">
|
| 946 |
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-foreground/40">
|
|
@@ -1019,6 +969,29 @@ export default function ScraperPage() {
|
|
| 1019 |
</div>
|
| 1020 |
</div>
|
| 1021 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1022 |
{/* Collapsible / Minimizable AI Suggestions Panel */}
|
| 1023 |
{isSuggestionsPanelOpen && suggestions.length > 0 && (
|
| 1024 |
<div className="mb-5 bg-card border border-indigo-500/30 rounded-2xl p-4 shadow-lg animate-in slide-in-from-top-3 duration-300 relative overflow-hidden">
|
|
@@ -1028,13 +1001,18 @@ export default function ScraperPage() {
|
|
| 1028 |
<Sparkles size={15} />
|
| 1029 |
</div>
|
| 1030 |
<div>
|
| 1031 |
-
<div className="flex items-center gap-2">
|
| 1032 |
<h4 className="text-xs font-bold text-foreground">
|
| 1033 |
AI Suggestions for <span className="text-indigo-400 font-extrabold">"{suggestionSeed}"</span>
|
| 1034 |
</h4>
|
| 1035 |
<span className="text-[10px] px-2 py-0.2 rounded-full bg-indigo-500/15 text-indigo-400 font-bold border border-indigo-500/20">
|
| 1036 |
{suggestions.length} keywords
|
| 1037 |
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1038 |
</div>
|
| 1039 |
<p className="text-[11px] text-foreground/45 font-medium">Click any keyword to search in active {searchMode === 'ai' ? 'AI Scraper' : searchMode === 'fixed' ? 'Fixed (60+ Suffixes)' : 'Free'} mode.</p>
|
| 1040 |
</div>
|
|
|
|
| 866 |
</button>
|
| 867 |
</div>
|
| 868 |
|
| 869 |
+
<div className="flex items-center gap-2 self-end sm:self-auto">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 870 |
<button
|
| 871 |
type="button"
|
| 872 |
onClick={() => {
|
| 873 |
setIsAiModalOpen(true);
|
| 874 |
if (availableModels.length === 0) fetchOpenRouterModels();
|
| 875 |
}}
|
| 876 |
+
className={`px-3 py-1.5 rounded-xl border text-xs font-semibold flex items-center gap-1.5 transition-all shadow-xs cursor-pointer ${
|
| 877 |
isAiConnected
|
| 878 |
+
? 'border-emerald-500/50 bg-card hover:bg-emerald-500/10 text-emerald-400 shadow-[0_0_12px_rgba(16,185,129,0.3)] ring-1 ring-emerald-500/30'
|
| 879 |
+
: 'border-border/80 bg-card hover:bg-foreground/5 text-foreground/70 hover:text-foreground'
|
| 880 |
}`}
|
| 881 |
+
title="Configure OpenRouter AI Key & Models"
|
| 882 |
>
|
| 883 |
+
<Settings2 size={13} className={isAiConnected ? "text-emerald-400" : "text-indigo-400"} />
|
| 884 |
+
<span>AI Provider</span>
|
| 885 |
{isAiConnected ? (
|
| 886 |
+
<span className="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse shadow-[0_0_6px_rgba(52,211,153,0.9)]" />
|
| 887 |
+
) : null}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 888 |
</button>
|
| 889 |
</div>
|
| 890 |
</div>
|
| 891 |
|
| 892 |
{/* Search Bar & Filter Toolbar */}
|
| 893 |
+
<div className="flex flex-col md:flex-row gap-3 mb-2.5 items-stretch md:items-center">
|
| 894 |
<form id="scraper-form" onSubmit={handleSearch} className="flex-1 bg-card border border-border/80 rounded-xl p-2.5 shadow-sm flex flex-col sm:flex-row gap-2">
|
| 895 |
<div className="relative flex-1">
|
| 896 |
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-foreground/40">
|
|
|
|
| 969 |
</div>
|
| 970 |
</div>
|
| 971 |
|
| 972 |
+
{/* Active AI Model Highlight Strip (cleanly shown when AI Scraper mode is selected) */}
|
| 973 |
+
{searchMode === 'ai' && (
|
| 974 |
+
<div className="flex items-center justify-between text-xs px-3 py-1.5 mb-3.5 rounded-xl bg-gradient-to-r from-indigo-500/10 via-purple-500/5 to-transparent border border-indigo-500/20 text-foreground/80 animate-in fade-in duration-200">
|
| 975 |
+
<div className="flex items-center gap-2 min-w-0">
|
| 976 |
+
<span className="w-2 h-2 rounded-full bg-emerald-400 animate-pulse shadow-[0_0_8px_rgba(52,211,153,0.8)] shrink-0" />
|
| 977 |
+
<span className="text-[11px] text-foreground/50 font-medium shrink-0">Current Model in Use:</span>
|
| 978 |
+
<span className="font-mono font-bold text-indigo-400 text-xs truncate">{getShortModelName(aiModel)}</span>
|
| 979 |
+
<span className="text-[10px] text-foreground/40 font-mono hidden md:inline truncate">({aiModel})</span>
|
| 980 |
+
</div>
|
| 981 |
+
<button
|
| 982 |
+
type="button"
|
| 983 |
+
onClick={() => {
|
| 984 |
+
setIsAiModalOpen(true);
|
| 985 |
+
if (availableModels.length === 0) fetchOpenRouterModels();
|
| 986 |
+
}}
|
| 987 |
+
className="text-[11px] text-indigo-400 hover:text-indigo-300 font-semibold underline shrink-0 cursor-pointer flex items-center gap-1"
|
| 988 |
+
>
|
| 989 |
+
<span>Change Model</span>
|
| 990 |
+
<Settings2 size={11} />
|
| 991 |
+
</button>
|
| 992 |
+
</div>
|
| 993 |
+
)}
|
| 994 |
+
|
| 995 |
{/* Collapsible / Minimizable AI Suggestions Panel */}
|
| 996 |
{isSuggestionsPanelOpen && suggestions.length > 0 && (
|
| 997 |
<div className="mb-5 bg-card border border-indigo-500/30 rounded-2xl p-4 shadow-lg animate-in slide-in-from-top-3 duration-300 relative overflow-hidden">
|
|
|
|
| 1001 |
<Sparkles size={15} />
|
| 1002 |
</div>
|
| 1003 |
<div>
|
| 1004 |
+
<div className="flex items-center gap-2 flex-wrap">
|
| 1005 |
<h4 className="text-xs font-bold text-foreground">
|
| 1006 |
AI Suggestions for <span className="text-indigo-400 font-extrabold">"{suggestionSeed}"</span>
|
| 1007 |
</h4>
|
| 1008 |
<span className="text-[10px] px-2 py-0.2 rounded-full bg-indigo-500/15 text-indigo-400 font-bold border border-indigo-500/20">
|
| 1009 |
{suggestions.length} keywords
|
| 1010 |
</span>
|
| 1011 |
+
{aiModel && (
|
| 1012 |
+
<span className="text-[10px] px-2 py-0.5 rounded-md bg-emerald-500/10 text-emerald-400 border border-emerald-500/25 font-mono font-bold shadow-[0_0_8px_rgba(16,185,129,0.2)]">
|
| 1013 |
+
via {getShortModelName(aiModel)}
|
| 1014 |
+
</span>
|
| 1015 |
+
)}
|
| 1016 |
</div>
|
| 1017 |
<p className="text-[11px] text-foreground/45 font-medium">Click any keyword to search in active {searchMode === 'ai' ? 'AI Scraper' : searchMode === 'fixed' ? 'Fixed (60+ Suffixes)' : 'Free'} mode.</p>
|
| 1018 |
</div>
|