diff --git a/src/app/api/forum/ai-assist/route.ts b/src/app/api/forum/ai-assist/route.ts index ccf37f6..142c15e 100644 --- a/src/app/api/forum/ai-assist/route.ts +++ b/src/app/api/forum/ai-assist/route.ts @@ -1,66 +1,5 @@ import { NextRequest, NextResponse } from 'next/server'; -import { createClient } from '@/lib/supabase/server'; -import { hybridAI } from '@/lib/ai/hybridRouter'; -export async function POST(req: NextRequest) { - try { - const body = await req.json(); - const { thread_id, question, thread_title, thread_body, replies } = body; - - if (!thread_id || !question) { - return NextResponse.json({ error: 'thread_id and question are required' }, { status: 400 }); - } - - const existingContext = replies?.length - ? replies.map((r: any) => `${r.author_name}: ${r.body}`).join('\n\n') - : ''; - - const result = await hybridAI( - [ - { - role: 'system', - content: `You are the AV Beat AI Assistant — a knowledgeable, helpful assistant for pro AV, live production, and display tech professionals. You have deep expertise in AV technology including AV-over-IP, control systems, projection & display, audio engineering, conferencing, live production, signal flow, and the pro AV industry. - -You are responding in a community forum. Be helpful, technically accurate, and conversational. Acknowledge when a question is complex or when professional consultation is advisable. Keep responses focused and practical — broadcast engineers value concise, actionable information. - -Important: You are an AI assistant. Be transparent about this if asked. Do not pretend to be a human.`, - }, - { - role: 'user', - content: `Forum thread: "${thread_title}" - -Original post: ${thread_body} - -${existingContext ? `Existing discussion:\n${existingContext}\n\n` : ''}New question: ${question} - -Please provide a helpful, technically accurate response for this pro AV / live production forum thread.`, - }, - ], - { maxTokens: 600, isBackground: false, priority: 2 } - ); - - const aiResponseText = result.text; - - if (!aiResponseText) { - return NextResponse.json({ error: 'No response from AI' }, { status: 500 }); - } - - const supabase = await createClient(); - const { data: savedReply, error: saveError } = await supabase - .from('forum_replies') - .insert({ - thread_id, - body: aiResponseText, - author_name: 'AV Beat AI', - is_ai_response: true, - }) - .select() - .single(); - - if (saveError) throw saveError; - - return NextResponse.json({ reply: savedReply }); - } catch (err: any) { - return NextResponse.json({ error: err.message }, { status: 500 }); - } -} +export async function POST(_req: NextRequest) { + return NextResponse.json({ error: 'Feature unavailable' }, { status: 410 }); +} \ No newline at end of file diff --git a/src/app/forum/page.tsx b/src/app/forum/page.tsx index ff88393..9283d2b 100644 --- a/src/app/forum/page.tsx +++ b/src/app/forum/page.tsx @@ -629,7 +629,6 @@ export default function ForumIndexPage() { diff --git a/src/app/forum/thread/[id]/page.tsx b/src/app/forum/thread/[id]/page.tsx index 44c2d4d..64df2cc 100644 --- a/src/app/forum/thread/[id]/page.tsx +++ b/src/app/forum/thread/[id]/page.tsx @@ -64,14 +64,7 @@ function timeAgo(dateStr: string): string { return new Date(dateStr).toLocaleDateString(); } -function Avatar({ name, isAI }: { name: string; isAI: boolean }) { - if (isAI) { - return ( -
- AI -
- ); - } +function Avatar({ name }: { name: string }) { const initials = name.split(' ').map(n => n[0]).join('').toUpperCase().slice(0, 2); const colors = ['#DCE6F2', '#1a3a2a', '#3a1a1a', '#2a1a3a', '#1a2a3a']; const colorIdx = name.charCodeAt(0) % colors.length; @@ -91,11 +84,10 @@ interface VoteButtonsProps { upvotes: number; downvotes: number; voteScore: number; - isAI?: boolean; isAuthenticated: boolean; } -function VoteButtons({ targetType, targetId, upvotes, downvotes, voteScore, isAI, isAuthenticated }: VoteButtonsProps) { +function VoteButtons({ targetType, targetId, upvotes, downvotes, voteScore, isAuthenticated }: VoteButtonsProps) { const [currentVote, setCurrentVote] = useState<1 | -1 | null>(null); const [counts, setCounts] = useState({ upvotes, downvotes, vote_score: voteScore }); const [loading, setLoading] = useState(false); @@ -113,7 +105,7 @@ function VoteButtons({ targetType, targetId, upvotes, downvotes, voteScore, isAI }, [isAuthenticated, targetType, targetId, fetched]); const handleVote = async (value: 1 | -1) => { - if (!isAuthenticated || loading || isAI) return; + if (!isAuthenticated || loading) return; setLoading(true); try { const res = await fetch('/api/forum/votes', { @@ -140,8 +132,8 @@ function VoteButtons({ targetType, targetId, upvotes, downvotes, voteScore, isAI {/* Upvote */} - - {aiError && ( -

{aiError}

- )} - - {/* Reply Form — auth-gated */} {thread.status !== 'closed' && isAuthenticated && (