feat: pre-launch vs post-launch analysis modes
- Backend: mode field in request, adapts summary tone and email subject - Pre-launch: "Implementieren Sie X vor Veroeffentlichung" - Post-launch: "ACHTUNG: Maengel sind oeffentlich sichtbar, sofortige Nachbesserung" - Frontend: Mode toggle (internes Dokument vs. Live-Website) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,7 @@ export function useAgentAnalysis() {
|
||||
const [result, setResult] = useState<AnalysisResult | null>(null)
|
||||
const [history, setHistory] = useState<AnalysisResult[]>([])
|
||||
|
||||
async function analyze(url: string) {
|
||||
async function analyze(url: string, mode: string = 'post_launch') {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
setResult(null)
|
||||
@@ -48,7 +48,7 @@ export function useAgentAnalysis() {
|
||||
const fetchRes = await fetch('/api/sdk/v1/agent/analyze', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url }),
|
||||
body: JSON.stringify({ url, mode }),
|
||||
})
|
||||
|
||||
if (!fetchRes.ok) {
|
||||
|
||||
@@ -6,14 +6,32 @@ import { AnalysisResult } from './_components/AnalysisResult'
|
||||
import { AnalysisHistory } from './_components/AnalysisHistory'
|
||||
import { FollowUpQuestions } from './_components/FollowUpQuestions'
|
||||
|
||||
type AnalysisMode = 'pre_launch' | 'post_launch'
|
||||
|
||||
const MODES: { id: AnalysisMode; label: string; desc: string; icon: string }[] = [
|
||||
{
|
||||
id: 'pre_launch',
|
||||
label: 'Internes Dokument pruefen',
|
||||
desc: 'Dokument oder Website VOR Veroeffentlichung pruefen',
|
||||
icon: '📋',
|
||||
},
|
||||
{
|
||||
id: 'post_launch',
|
||||
label: 'Live-Website pruefen',
|
||||
desc: 'Bereits veroeffentlichte Website oder Dokument analysieren',
|
||||
icon: '🌐',
|
||||
},
|
||||
]
|
||||
|
||||
export default function AgentPage() {
|
||||
const [url, setUrl] = useState('')
|
||||
const [mode, setMode] = useState<AnalysisMode>('post_launch')
|
||||
const { analyze, answerFollowUp, loading, error, result, history } = useAgentAnalysis()
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
if (!url.trim()) return
|
||||
analyze(url.trim())
|
||||
analyze(url.trim(), mode)
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -22,18 +40,44 @@ export default function AgentPage() {
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-gray-900">Compliance Agent</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
Analysiere Webseiten auf DSGVO-Konformitaet. Der Agent holt das Dokument,
|
||||
klassifiziert es, bewertet das Risiko und weist die Aufgabe der zustaendigen Rolle zu.
|
||||
Analysiere Dokumente und Webseiten auf DSGVO-Konformitaet.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Mode Selection */}
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
{MODES.map(m => (
|
||||
<button
|
||||
key={m.id}
|
||||
onClick={() => setMode(m.id)}
|
||||
className={`p-4 rounded-xl border-2 text-left transition-all ${
|
||||
mode === m.id
|
||||
? 'border-purple-500 bg-purple-50 shadow-sm'
|
||||
: 'border-gray-200 bg-white hover:border-gray-300'
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-2xl">{m.icon}</span>
|
||||
<div>
|
||||
<p className={`text-sm font-semibold ${mode === m.id ? 'text-purple-900' : 'text-gray-900'}`}>
|
||||
{m.label}
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 mt-0.5">{m.desc}</p>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* URL Input */}
|
||||
<form onSubmit={handleSubmit} className="flex gap-3">
|
||||
<input
|
||||
type="url"
|
||||
value={url}
|
||||
onChange={e => setUrl(e.target.value)}
|
||||
placeholder="https://example.com/datenschutz"
|
||||
placeholder={mode === 'pre_launch'
|
||||
? 'https://staging.example.com/datenschutz'
|
||||
: 'https://www.example.com/datenschutz'}
|
||||
className="flex-1 px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent text-sm"
|
||||
disabled={loading}
|
||||
required
|
||||
@@ -87,7 +131,7 @@ export default function AgentPage() {
|
||||
history={history}
|
||||
onSelect={r => {
|
||||
setUrl(r.url)
|
||||
analyze(r.url)
|
||||
analyze(r.url, mode)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user