feat: v1.4.0 — review code, web search grounding, responsive preview
New features: - Review Code button sends generated code back to AI for review - Web search grounding via SearXNG (toggle in toolbar, enriches prompts) - Responsive preview with device size selector (Full/Desktop/Tablet/Mobile) - /api/search proxy route Fixes: - Model selector text color now white on dark theme - Post-coding button text overflow (shorter labels + min-w-0) - Duplicate activateArtifact button suppressed when action row shows
This commit is contained in:
27
app/api/search/route.ts
Normal file
27
app/api/search/route.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Next.js API route: Web search proxy.
|
||||
* Calls SearXNG public instances and returns top results.
|
||||
* Endpoint: GET /api/search?q=your+query
|
||||
*/
|
||||
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { searchWeb } from "@/lib/services/search-api";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const query = request.nextUrl.searchParams.get("q");
|
||||
|
||||
if (!query || query.trim().length < 3) {
|
||||
return NextResponse.json({ results: [], error: "Query too short" });
|
||||
}
|
||||
|
||||
try {
|
||||
const results = await searchWeb(query);
|
||||
return NextResponse.json({ results });
|
||||
} catch (error) {
|
||||
console.error("Search API error:", error);
|
||||
return NextResponse.json(
|
||||
{ results: [], error: "Search failed" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user