Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
fix: Openai models list and response
Khuram Niazc586563a27a3
diff --git a/src/app/api/ai/openai/models/route.ts b/src/app/api/ai/openai/models/route.tsnew file mode 100644index 0000000..5d79f1c--- /dev/null+++ b/src/app/api/ai/openai/models/route.ts@@ -0,0 +1,41 @@+import { auth } from "@/auth";+import { NextResponse } from "next/server";+import { resolveApiKey } from "@/lib/api-key-resolver";++export async function GET() {+ try {+ const session = await auth();+ const userId = session?.user?.id;++ const apiKey = await resolveApiKey(userId, "openai");++ if (!apiKey) {+ return NextResponse.json(+ { error: "OpenAI API key not configured" },+ { status: 500 }+ );+ }++ const response = await fetch("https://api.openai.com/v1/models", {+ headers: {+ Authorization: `Bearer ${apiKey}`,+ },+ });++ if (!response.ok) {+ return NextResponse.json(+ { error: "Failed to fetch OpenAI models" },+ { status: response.status }+ );+ }++ const data = await response.json();+ return NextResponse.json(data);+ } catch (error) {+ console.error("Error fetching OpenAI models:", error);+ return NextResponse.json(+ { error: "Failed to fetch OpenAI models" },+ { status: 500 }+ );+ }+}diff --git a/src/components/profile/AiResumeReviewResponseContent.tsx b/src/components/profile/AiResumeReviewResponseContent.tsxindex 7b21602..ef3827e 100644--- a/src/components/profile/AiResumeReviewResponseContent.tsx+++ b/src/components/profile/AiResumeReviewResponseContent.tsx@@ -283,7 +283,7 @@ const SectionFeedbackSection = ({}: {sectionFeedback?: DeepPartial<ResumeReviewResponse["sectionFeedback"]>;}) => {- if (!sectionFeedback || Object.keys(sectionFeedback).length === 0)+ if (!sectionFeedback || sectionFeedback.length === 0)return null;const getStatusIcon = (status?: string) => {@@ -306,17 +306,17 @@ const SectionFeedbackSection = ({</AccordionTrigger><AccordionContent><div className="space-y-2">- {Object.entries(sectionFeedback).map(- ([section, feedback]) =>- feedback && (- <div key={section} className="border-b pb-2 last:border-0">+ {sectionFeedback.map(+ (item, i) =>+ item && (+ <div key={item.section ?? i} className="border-b pb-2 last:border-0"><div className="flex items-center gap-1 font-medium text-sm">- {getStatusIcon(feedback.status)}- {section}+ {getStatusIcon(item.status)}+ {item.section}</div>- {feedback.feedback && (+ {item.feedback && (<p className="text-xs text-muted-foreground mt-1">- {feedback.feedback}+ {item.feedback}</p>)}</div>diff --git a/src/lib/ai/provider-registry.ts b/src/lib/ai/provider-registry.tsindex deafd37..cd08f76 100644--- a/src/lib/ai/provider-registry.ts+++ b/src/lib/ai/provider-registry.ts@@ -46,6 +46,11 @@ export const PROVIDER_REGISTRY: Record<string, ProviderRegistryEntry> = {credentialType: "api-key",category: "cloud",envVar: "OPENAI_API_KEY",+ modelsEndpoint: "openai/models",+ parseModelsResponse: (data) =>+ (data.data?.map((m: any) => m.id) ?? [])+ .filter((id: string) => id.startsWith("gpt-") || id.startsWith("o"))+ .sort(),requiresRunningCheck: false,supportsKeepAlive: false,keyConfig: {diff --git a/src/models/ai.schemas.ts b/src/models/ai.schemas.tsindex 33ac9f4..4469e42 100644--- a/src/models/ai.schemas.ts+++ b/src/models/ai.schemas.ts@@ -68,6 +68,7 @@ const ActionVerbsSchema = z.object({});const SectionFeedbackItemSchema = z.object({+ section: z.string().describe("Section name (e.g., 'Summary', 'Experience', 'Skills', 'Education')"),status: z.enum(["good", "needsWork", "missing"]).describe("Section status assessment"),feedback: z.string().describe("Specific actionable advice for this section"),});@@ -106,8 +107,8 @@ export const ResumeReviewSchema = z.object({keywords: KeywordsSchema.describe("Keyword relevance analysis"),actionVerbs: ActionVerbsSchema.describe("Action verb strength analysis with suggestions"),sectionFeedback: z- .record(z.string(), SectionFeedbackItemSchema)- .describe("Section-by-section feedback keyed by section name (e.g., 'Summary', 'Experience', 'Skills', 'Education')"),+ .array(SectionFeedbackItemSchema)+ .describe("Section-by-section feedback for each resume section"),atsIssues: z.array(z.string()).describe("Formatting or content issues that may cause ATS rejection (tables, graphics, unusual fonts, missing sections)"),