fixed docker
This commit is contained in:
@@ -90,7 +90,7 @@ export async function POST(request: NextRequest) {
|
||||
status: "failed",
|
||||
error: "OpenAI API key not configured",
|
||||
timeline: timeline.map((item) =>
|
||||
item.status === "running" ? { ...item, status: "failed" } : item
|
||||
item.status === "running" ? { ...item, status: "failed" as const } : item
|
||||
),
|
||||
},
|
||||
{ token }
|
||||
@@ -259,7 +259,7 @@ export async function POST(request: NextRequest) {
|
||||
status: "failed",
|
||||
error: error.message || "Manual analysis failed",
|
||||
timeline: timeline.map((item) =>
|
||||
item.status === "running" ? { ...item, status: "failed" } : item
|
||||
item.status === "running" ? { ...item, status: "failed" as const } : item
|
||||
),
|
||||
},
|
||||
{ token }
|
||||
|
||||
@@ -89,7 +89,7 @@ export async function POST(request: NextRequest) {
|
||||
status: "failed",
|
||||
error: "OpenAI API key not configured",
|
||||
timeline: timeline.map((item) =>
|
||||
item.status === "running" ? { ...item, status: "failed" } : item
|
||||
item.status === "running" ? { ...item, status: "failed" as const } : item
|
||||
),
|
||||
},
|
||||
{ token }
|
||||
@@ -270,7 +270,7 @@ export async function POST(request: NextRequest) {
|
||||
status: "failed",
|
||||
error: error.message || "Analysis failed",
|
||||
timeline: timeline.map((item) =>
|
||||
item.status === "running" ? { ...item, status: "failed" } : item
|
||||
item.status === "running" ? { ...item, status: "failed" as const } : item
|
||||
),
|
||||
},
|
||||
{ token }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Checkout } from "@polar-sh/nextjs";
|
||||
import { NextResponse } from "next/server";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export const GET = async () => {
|
||||
export const GET = async (request: NextRequest) => {
|
||||
if (!process.env.POLAR_ACCESS_TOKEN || !process.env.POLAR_SUCCESS_URL) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
@@ -17,5 +17,5 @@ export const GET = async () => {
|
||||
successUrl: process.env.POLAR_SUCCESS_URL,
|
||||
});
|
||||
|
||||
return handler();
|
||||
return handler(request);
|
||||
};
|
||||
|
||||
@@ -39,6 +39,7 @@ const bodySchema = z.object({
|
||||
})
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
let ageFilters: SerperAgeFilter | undefined
|
||||
try {
|
||||
const requestId = request.headers.get("x-request-id") ?? undefined;
|
||||
if (!(await isAuthenticatedNextjs())) {
|
||||
@@ -51,7 +52,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
const body = await request.json()
|
||||
const { analysis, minAgeDays, maxAgeDays } = bodySchema.parse(body)
|
||||
const ageFilters: SerperAgeFilter = {
|
||||
ageFilters = {
|
||||
minAgeDays,
|
||||
maxAgeDays,
|
||||
}
|
||||
@@ -287,15 +288,15 @@ async function analyzeOpportunities(
|
||||
const relevanceScore = Math.min(keywordScore + problemScore, 1)
|
||||
|
||||
// Determine intent
|
||||
let intent: Opportunity['intent'] = 'looking-for'
|
||||
let intent: Opportunity['intent'] = 'looking'
|
||||
if (content.includes('frustrated') || content.includes('hate') || content.includes('sucks')) {
|
||||
intent = 'frustrated'
|
||||
} else if (content.includes('alternative') || content.includes('switching')) {
|
||||
intent = 'alternative'
|
||||
intent = 'comparing'
|
||||
} else if (content.includes('vs') || content.includes('comparison') || content.includes('better')) {
|
||||
intent = 'comparison'
|
||||
intent = 'comparing'
|
||||
} else if (content.includes('how to') || content.includes('fix') || content.includes('solution')) {
|
||||
intent = 'problem-solving'
|
||||
intent = 'learning'
|
||||
}
|
||||
|
||||
// Find matching persona
|
||||
@@ -305,16 +306,21 @@ async function analyzeOpportunities(
|
||||
|
||||
if (relevanceScore >= 0.3) {
|
||||
opportunities.push({
|
||||
id: result.url,
|
||||
title: result.title,
|
||||
url: result.url,
|
||||
platform: result.source,
|
||||
source: result.source,
|
||||
snippet: result.snippet.slice(0, 300),
|
||||
relevanceScore,
|
||||
painPoints: matchedProblems.slice(0, 3),
|
||||
suggestedApproach: generateApproach(intent, analysis.productName),
|
||||
matchedKeywords: matchedKeywords.slice(0, 5),
|
||||
matchedProblems: matchedProblems.slice(0, 3),
|
||||
matchedPersona,
|
||||
intent
|
||||
intent,
|
||||
emotionalIntensity: intent === 'frustrated' ? 'high' : matchedProblems.length > 0 ? 'medium' : 'low',
|
||||
status: 'new',
|
||||
suggestedApproach: generateApproach(intent, analysis.productName),
|
||||
softPitch: false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user