Skip to content

Commit 063c31a

Browse files
authored
Merge pull request wishonia#140 from mikepsinn/main
research agent, right to trial act, dfda, and grounded search
2 parents c4d4a5e + 19536ee commit 063c31a

File tree

361 files changed

+33728
-1576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

361 files changed

+33728
-1576
lines changed

.cursorrules

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Project-specific rules for Cursor AI
2+
[project]
3+
name = "wishonia"
4+
framework = "next.js"
5+
version = "15.0"
6+
router = "app"
7+
style = "tailwind"
8+
typescript = true
9+
10+
# Define the project's architecture and conventions
11+
[architecture]
12+
# All page.tsx files are server components by default
13+
server_components = [
14+
"app/**/page.tsx",
15+
"app/**/layout.tsx",
16+
"app/**/template.tsx"
17+
]
18+
client_components = [
19+
"components/**/*.tsx",
20+
"app/**/components/*.tsx"
21+
]
22+
hooks = ["lib/hooks/**/*.ts"]
23+
utils = ["lib/**/*.ts"]
24+
config = ["config/**/*.ts"]
25+
types = ["types/**/*.ts"]
26+
27+
# Authentication patterns
28+
[auth]
29+
server_components = """
30+
Import server-side auth:
31+
import { getServerSession } from "next-auth/next"
32+
33+
Usage:
34+
const session = await getServerSession()
35+
"""
36+
37+
client_components = """
38+
Import client-side auth:
39+
import { useSession } from 'next-auth/react'
40+
41+
Usage:
42+
const { data: session } = useSession()
43+
"""
44+
45+
# Next.js App Router conventions
46+
[next]
47+
routing = """
48+
- Use app directory for all routes
49+
- page.tsx files are automatically server components
50+
- loading.tsx for loading states
51+
- error.tsx for error handling
52+
- layout.tsx for shared layouts
53+
"""
54+
55+
server_components = """
56+
IMPORTANT: Never add 'use client' to page.tsx files
57+
- Pages are server components by default
58+
- Create separate client components for interactive elements
59+
- Import client components into server components as needed
60+
"""
61+
62+
data_fetching = """
63+
- Use server components for data fetching when possible
64+
- Leverage React Server Components for better performance
65+
- Use route handlers (route.ts) for API endpoints
66+
"""
67+
68+
# Database and type safety
69+
[database]
70+
prisma = """
71+
- Import types directly from Prisma client
72+
- Use Prisma-generated types for all database operations
73+
- Always prefer schema.prisma types over creating new ones
74+
Example:
75+
import { Post, User } from '@prisma/client'
76+
"""
77+
78+
# Component structure rules
79+
[components]
80+
organization = """
81+
For interactive features:
82+
1. Create client component in separate file:
83+
components/MyInteractiveComponent.tsx
84+
2. Import into server component page:
85+
app/my-page/page.tsx
86+
"""
87+
88+
client_components = """
89+
Only add 'use client' when component:
90+
- Uses hooks (useState, useEffect, etc.)
91+
- Needs browser APIs
92+
- Has user interactions
93+
- Uses client-side libraries
94+
95+
Example location:
96+
app/my-feature/components/InteractiveComponent.tsx
97+
"""
98+
99+
server_components = """
100+
Keep pages as server components:
101+
- No 'use client' directive
102+
- No hooks or browser APIs
103+
- Import client components as needed
104+
- Fetch data server-side when possible
105+
106+
Example:
107+
app/my-feature/page.tsx
108+
"""
109+
110+
# File patterns to ignore
111+
[ignore]
112+
patterns = [
113+
"node_modules",
114+
".next",
115+
"build",
116+
"dist",
117+
"public/assets",
118+
".git"
119+
]
120+
121+
# Custom rules for the project
122+
[rules]
123+
component_patterns = """
124+
✅ DO:
125+
- Keep pages as server components
126+
- Create separate client components for interactivity
127+
- Use Prisma types for database operations
128+
- Use proper auth imports based on component type
129+
- Use self-documenting names for variables, fields, and models
130+
- Always choose the simplest implementation to minimize complexity
131+
132+
❌ DON'T:
133+
- Add 'use client' to page.tsx
134+
- Mix client and server code in same component
135+
- Use wrong auth import for component type
136+
- Create new types when Prisma schema types are available
137+
- Use cryptic or abbreviated names
138+
"""
139+
140+
auth_patterns = """
141+
Server Components:
142+
import { getServerSession } from "next-auth/next"
143+
const session = await getServerSession()
144+
145+
Client Components:
146+
import { useSession } from 'next-auth/react'
147+
const { data: session } = useSession()
148+
"""
149+
150+
# Type safety rules
151+
types = """
152+
- Use TypeScript strict mode
153+
- Import Prisma types directly from @prisma/client
154+
- Create interfaces for component props
155+
- Avoid 'any' type
156+
"""
157+
158+
# Performance guidelines
159+
performance = """
160+
- Keep pages as server components when possible
161+
- Use client components only when necessary
162+
- Implement proper code splitting
163+
- Use React Suspense boundaries wisely
164+
"""
165+
166+
# Testing guidelines
167+
[testing]
168+
jest = """
169+
- Always set @jest-environment node at the top of test files
170+
- Write tests that can safely run against production (so don't delete data or do cleanup)
171+
- Use real implementations instead of mocks where possible
172+
Example test header:
173+
/**
174+
* @jest-environment node
175+
*/
176+
"""

.env.example

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,103 @@ LANGCHAIN_CALLBACKS_BACKGROUND=true
4646
# Get key from https://www.perplexity.ai/settings/api
4747
PERPLEXITY_API_KEY="KEY_HERE"
4848
# Get key from https://dashboard.exa.ai/api-keys
49-
EXASEARCH_API_KEY="KEY_HERE"
49+
EXASEARCH_API_KEY="KEY_HERE"
50+
51+
KV_URL=
52+
KV_REST_API_URL=
53+
KV_REST_API_TOKEN=
54+
KV_REST_API_READ_ONLY_TOKEN=
55+
56+
# For saving wordpress posts
57+
WORDPRESS_URL=
58+
WORDPRESS_USERNAME=
59+
WORDPRESS_PASSWORD=
60+
61+
GOOGLE_API_KEY=
62+
GOOGLE_CUSTOM_SEARCH_CX=
63+
64+
LANGFUSE_SECRET_KEY="sk-lf-..."
65+
LANGFUSE_PUBLIC_KEY="pk-lf-..."
66+
LANGFUSE_BASEURL="https://cloud.langfuse.com"
67+
68+
AWS_ACCESS_KEY_ID=your-test-access-key
69+
AWS_SECRET_ACCESS_KEY=your-test-secret-key
70+
AWS_REGION=your-test-region
71+
AWS_BUCKET=your-test-bucket
72+
73+
# Tavily API Key retrieved here: https://app.tavily.com/home
74+
TAVILY_API_KEY=[YOUR_TAVILY_API_KEY]
75+
76+
# Redis Configuration
77+
USE_LOCAL_REDIS=false
78+
LOCAL_REDIS_URL=redis://localhost:6379 # or redis://redis:6379 if you're using docker compose
79+
80+
# Upstash Redis URL and Token retrieved here: https://console.upstash.com/redis
81+
UPSTASH_REDIS_REST_URL=[YOUR_UPSTASH_REDIS_REST_URL]
82+
UPSTASH_REDIS_REST_TOKEN=[YOUR_UPSTASH_REDIS_REST_TOKEN]
83+
84+
# SearXNG Configuration
85+
SEARXNG_API_URL=http://localhost:8080 # Replace with your local SearXNG API URL or docker http://searxng:8080
86+
SEARCH_API=tavily # use searxng, tavily or exa
87+
SEARXNG_SECRET="" # generate a secret key e.g. openssl rand -base64 32
88+
SEARXNG_PORT=8080 # default port
89+
SEARXNG_BIND_ADDRESS=0.0.0.0 # default address
90+
SEARXNG_IMAGE_PROXY=true # enable image proxy
91+
SEARXNG_LIMITER=false # can be enabled to limit the number of requests per IP address
92+
SEARXNG_DEFAULT_DEPTH=basic # Set to 'basic' or 'advanced', only affects SearXNG searches
93+
SEARXNG_MAX_RESULTS=50 # Maximum number of results to return from SearXNG
94+
SEARXNG_ENGINES=google,bing,duckduckgo,wikipedia # Search engines to use
95+
SEARXNG_TIME_RANGE=None # Time range for search results: day, week, month, year, or None (for all time)
96+
SEARXNG_SAFESEARCH=0 # Safe search setting: 0 (off), 1 (moderate), 2 (strict)
97+
98+
# Optional
99+
# The settings below can be used optionally as needed.
100+
101+
# Used to set the base URL path for OpenAI API requests.
102+
# If you need to set a BASE URL, uncomment and set the following:
103+
# OPENAI_API_BASE=
104+
105+
# Used to set the model for OpenAI API requests.
106+
# If not set, the default is gpt-4o.
107+
# OPENAI_API_MODEL=gpt-4o-mini
108+
109+
# Azure OpenAI API key retrieved here: https://oai.azure.com/resource/deployments/
110+
# AZURE_API_KEY=
111+
112+
# The resource name is used in the assembled URL: https://{resourceName}.openai.azure.com/openai/deployments/{modelId}{path}.
113+
# AZURE_RESOURCE_NAME=
114+
115+
# Used to set the deployment name for Azure OpenAI API requests.
116+
# If not set, the default is gpt-4o.
117+
# AZURE_DEPLOYMENT_NAME=
118+
119+
# If you want to use Google Generative AI instead of OpenAI, enable the following settings.
120+
# Google Generative AI API key retrieved here: https://aistudio.google.com/app/apikey
121+
# GOOGLE_GENERATIVE_AI_API_KEY=[YOUR_GOOGLE_GENERATIVE_AI_API_KEY]
122+
123+
# If you want to use Anthropic instead of OpenAI, enable the following settings.
124+
# ANTHROPIC_API_KEY=[YOUR_ANTHROPIC_API_KEY]
125+
126+
# If you want to use Groq, enable the following variables. only available for tool use compatible models.
127+
# GROQ_API_KEY=[YOUR_GROQ_API_KEY]
128+
# GROQ_API_MODEL=[YOUR_GROQ_API_MODEL] # e.g. llama3-groq-8b-8192-tool-use-preview
129+
130+
# If you want to use Ollama, enable the following variables.
131+
# OLLAMA_MODEL=[YOUR_OLLAMA_MODEL] # The main model to use. Currently compatible: qwen2.5
132+
# OLLAMA_BASE_URL=[YOUR_OLLAMA_URL] # The base URL to use. e.g. http://localhost:11434
133+
134+
# enable the share feature
135+
# If you enable this feature, separate account management implementation is required.
136+
# ENABLE_SHARE=true
137+
138+
# enable the video search tool
139+
# Serper API Key retrieved here: https://serper.dev/api-key
140+
# SERPER_API_KEY=[YOUR_SERPER_API_KEY]
141+
142+
# If you want to use Jina instead of Tavily for retrieve tool, enable the following variables.
143+
# JINA_API_KEY=[YOUR_JINA_API_KEY]
144+
145+
#NEXT_PUBLIC_BASE_URL=http://localhost:3000
146+
147+
DFDA_CLIENT_ID=
148+
DFDA_CLIENT_SECRET=

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ next-env.d.ts
5656

5757
.trigger
5858
/.vscode
59+
60+
.vercel
61+
/.env.vercel
62+
/run_anthropic_docker.ps1
63+
/logs

app/(auth)/signin/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { Metadata } from "next"
22
import Link from "next/link"
3+
import { siteConfig } from "@/config/site"
34

45
import { cn } from "@/lib/utils"
56
import { buttonVariants } from "@/components/ui/button"
67
import { Icons } from "@/components/icons"
78
import { UserAuthForm } from "@/components/user/user-auth-form"
89

910
export const metadata: Metadata = {
10-
title: "Enter Wishonia",
11-
description: "Become a citizen of Wishonia",
11+
title: `Enter ${siteConfig.name}`,
12+
description: siteConfig.description ,
1213
}
1314

1415
export default function Signin() {
@@ -27,22 +28,21 @@ export default function Signin() {
2728
</>
2829
</Link>
2930
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
30-
<div className="flex flex-col space-y-2 text-center">
31+
{/* <div className="flex flex-col space-y-2 text-center">
3132
<h1 className="text-2xl font-semibold tracking-tight">
32-
Welcome to Wishonia
33+
Welcome to {siteConfig.name}
3334
</h1>
3435
<p className="text-sm text-muted-foreground">
3536
Please verify your identity to enter the magical kingdom!
3637
</p>
37-
</div>
38+
</div> */}
3839
<UserAuthForm />
3940
<p className="px-8 text-center text-sm text-muted-foreground">
40-
Not a citizen yet?{" "}
4141
<Link
4242
href="/signup"
4343
className="hover:text-brand underline underline-offset-4"
4444
>
45-
Become a citizen
45+
Not a member yet?
4646
</Link>
4747
</p>
4848
</div>

app/(auth)/signup/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { cn } from "@/lib/utils"
55
import { buttonVariants } from "@/components/ui/button"
66
import { Icons } from "@/components/icons"
77
import { UserAuthForm } from "@/components/user/user-auth-form"
8+
import { siteConfig } from "@/config/site"
89

910
export const metadata: Metadata = {
1011
title: "Sign up",
@@ -29,7 +30,7 @@ export default function Signup() {
2930
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
3031
<div className="flex flex-col space-y-2 text-center">
3132
<h1 className="text-2xl font-semibold tracking-tight">
32-
Become a Citizen of Wishonia
33+
Join {siteConfig.name}
3334
</h1>
3435
<p className="text-sm text-muted-foreground">
3536
Select a provider to verify your identity

0 commit comments

Comments
 (0)