Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SWOT analysis prompt #175

Merged
merged 1 commit into from
Nov 20, 2024
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
12 changes: 8 additions & 4 deletions prompts/00-swot-analysis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Based on the following information, please generate a response that outlines the

### Field guidelines

- **strengths** (array of strings): Strengths.
- **weaknesses** (array of strings): Weaknesses.
- **opportunities** (array of strings): Opportunities.
- **threats** (array of strings): Threats.
- **strengths** (array of strings): List the strengths of the product.
- **weaknesses** (array of objects): For each weakness, provide:
- **description** (string): A brief description of the weakness.
- **action** (string): A suggested action to address or mitigate the weakness.
- **opportunities** (array of strings): List the opportunities available.
- **threats** (array of objects): For each threat, provide:
- **description** (string): A brief description of the threat.
- **action** (string): A suggested action to address or mitigate the threat.
2 changes: 1 addition & 1 deletion src/app/ideas/[id]/components/SectionSWOTAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const SectionSWOTAnalysis: React.FC<SectionSWOTAnalysisProps> = ({
</SectionDescription>

{data ? (
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6">
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-4">
<div className="flex flex-col">
<div className="flex flex-1 flex-col rounded-lg bg-green-50 p-4 shadow transition-shadow duration-200 hover:shadow-lg md:p-6">
<h3 className="mb-4 flex items-center text-xl font-semibold text-green-700 md:text-2xl">
Expand Down
22 changes: 18 additions & 4 deletions src/idea/adapters/OpenAIService/SWOTAnalysisEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,19 @@ interface ValueProposition {
const ResponseSchema = z.object({
swot_analysis: z.object({
strengths: z.array(z.string()),
weaknesses: z.array(z.string()),
weaknesses: z.array(
z.object({
description: z.string(),
action: z.string(),
})
),
opportunities: z.array(z.string()),
threats: z.array(z.string()),
threats: z.array(
z.object({
description: z.string(),
action: z.string(),
})
),
}),
})

Expand Down Expand Up @@ -146,9 +156,13 @@ And here is my value proposition:

return {
strengths: swotAnalysis.strengths,
weaknesses: swotAnalysis.weaknesses,
weaknesses: swotAnalysis.weaknesses.map(
(weakness) => `${weakness.description} Action: ${weakness.action}`
),
opportunities: swotAnalysis.opportunities,
threats: swotAnalysis.threats,
threats: swotAnalysis.threats.map(
(threat) => `${threat.description} Action: ${threat.action}`
),
}
} catch (e) {
Sentry.captureException(e)
Expand Down
Loading