Skip to content

Commit

Permalink
Merge pull request #175 from gruz0/refactor/update-swot-analysis-prompt
Browse files Browse the repository at this point in the history
Update SWOT analysis prompt
  • Loading branch information
gruz0 authored Nov 20, 2024
2 parents d3a191c + 480cb7e commit 0782a26
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
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

0 comments on commit 0782a26

Please sign in to comment.