Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ReadmeGenAI eliminates this friction by leveraging advanced AI to automatically
<img src="assets/mainpage.png" alt="Main Page" width="600"/>
<br>
<br>
<img src="assets/fearture-page.png" alt="Feature Page" width="600"/>
<img src="assets/feature-page.png" alt="Feature Page" width="600"/>
</p>

## Technical Architecture
Expand Down
File renamed without changes
17 changes: 7 additions & 10 deletions src/app/api/generate/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextResponse } from "next/server";
import { getGeminiModel } from "@/lib/gemini";
import { getRepoData, getRepoContents } from "@/lib/octokit";
import { SUPPORTED_LANGUAGES } from "@/constants/languages";

Check warning on line 4 in src/app/api/generate/route.ts

View workflow job for this annotation

GitHub Actions / build-and-lint

'SUPPORTED_LANGUAGES' is defined but never used

Check warning on line 4 in src/app/api/generate/route.ts

View workflow job for this annotation

GitHub Actions / autofix

'SUPPORTED_LANGUAGES' is defined but never used

export const dynamic = "force-dynamic";

Expand All @@ -9,7 +9,7 @@
* AI README Generation Endpoint
* Optimized for data accuracy, clean prompt interpolation, and multi-language support.
*
* @param {Request} req - The incoming request object containing the repo URL and optional language.
* @param {Request} req - The incoming Fastify request object containing the repo URL and optional language.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix incorrect framework reference in JSDoc.

Line 11 says “Fastify request object”, but this handler receives a standard/Next.js Request. This can mislead maintainers and tooling.

Suggested doc fix
- * `@param` {Request} req - The incoming Fastify request object containing the repo URL and optional language.
+ * `@param` {Request} req - The incoming Next.js request object containing the repo URL and optional language.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param {Request} req - The incoming Fastify request object containing the repo URL and optional language.
* `@param` {Request} req - The incoming Next.js request object containing the repo URL and optional language.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/api/generate/route.ts` at line 11, The JSDoc for the API handler in
src/app/api/generate/route.ts incorrectly labels the incoming parameter as a
"Fastify request object"; update the comment for the handler (the exported route
handler function) to reference the standard/Next.js Request (or "Web Request")
instead and adjust the `@param` type/description to say it is a standard Request
object carrying the repo URL and optional language so tooling and maintainers
are accurate.

* @returns {Promise<NextResponse>} A JSON response containing the generated Markdown or an error message.
*/
export async function POST(req: Request) {
Expand All @@ -18,13 +18,7 @@
try {
const body = await req.json();
rawUrl = body.url;
const rawLanguage =
typeof body.language === "string" ? body.language.trim() : "";
const normalized =
rawLanguage.charAt(0).toUpperCase() + rawLanguage.slice(1).toLowerCase();
language = (SUPPORTED_LANGUAGES as readonly string[]).includes(normalized)
? normalized
: "English";
language = body.language || "English";
} catch {
return NextResponse.json({ error: "Invalid JSON body" }, { status: 400 });
}
Expand Down Expand Up @@ -157,9 +151,12 @@

const result = await model.generateContent(prompt);
const response = await result.response;
const markdown = response.text();
const markdown = response.text().trim();
const cleanMarkdown = markdown
.replace(/^```(markdown|md)?\n/, "")
.replace(/\n```$/, "");

return NextResponse.json({ markdown });
return NextResponse.json({ markdown: cleanMarkdown });
} catch (error: unknown) {
const message =
error instanceof Error ? error.message : "Internal Server Error";
Expand Down
17 changes: 15 additions & 2 deletions src/components/Generator/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { useState } from "react";
import { Loader2, Github, AlertCircle } from "lucide-react";
import { Button } from "../ui/Button";
import { SUPPORTED_LANGUAGES } from "@/constants/languages";

Check warning on line 5 in src/components/Generator/SearchInput.tsx

View workflow job for this annotation

GitHub Actions / build-and-lint

'SUPPORTED_LANGUAGES' is defined but never used

Check warning on line 5 in src/components/Generator/SearchInput.tsx

View workflow job for this annotation

GitHub Actions / autofix

'SUPPORTED_LANGUAGES' is defined but never used

interface SearchInputProps {
onGenerate: (url: string, language: string) => void;
Expand All @@ -29,6 +29,20 @@
const [language, setLanguage] = useState("English");
const [error, setError] = useState<string | null>(null);

const languages = [
"English",
"Spanish",
"French",
"German",
"Chinese",
"Japanese",
"Korean",
"Portuguese",
"Russian",
"Arabic",
"Turkish",
];

const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
setError(null);
Expand Down Expand Up @@ -72,10 +86,9 @@
<select
value={language}
onChange={(e) => setLanguage(e.target.value)}
aria-label="Select language for README generation"
className="bg-zinc-900/50 border border-white/10 rounded-2xl px-6 py-6 text-white focus:outline-none focus:ring-2 focus:ring-blue-500/50 transition-all backdrop-blur-xl appearance-none cursor-pointer min-w-[140px]"
>
{SUPPORTED_LANGUAGES.map((lang) => (
{languages.map((lang) => (
<option
key={lang}
value={lang}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function getGeminiModel(): GenerativeModel {
const genAI = new GoogleGenerativeAI(apiKey);

_model = genAI.getGenerativeModel({
model: "gemini-2.5-flash",
model: "gemini-1.5-flash",
safetySettings: [
{
category: HarmCategory.HARM_CATEGORY_HARASSMENT,
Expand Down
Loading