diff --git a/app/generate/page.tsx b/app/generate/page.tsx new file mode 100644 index 0000000000..03c3e7d098 --- /dev/null +++ b/app/generate/page.tsx @@ -0,0 +1,118 @@ +// app/(chat)/generate/page.tsx +'use client'; +import { useState } from 'react'; + +export default function GenerateJD() { + const [formData, setFormData] = useState({ + title: '', + industry: '', + experience: '', + details: '' + }); + const [result, setResult] = useState(''); + const [loading, setLoading] = useState(false); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setLoading(true); + + try { + const response = await fetch('/api/chat', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + type: 'generate_jd', + content: formData + }) + }); + + const data = await response.json(); + setResult(data.generatedJD); + } catch (error) { + console.error('Error:', error); + } + + setLoading(false); + }; + + return ( +