Skip to content

Commit df9f7d6

Browse files
committed
update: PostHog Analytics secrets
1 parent 67d7739 commit df9f7d6

File tree

7 files changed

+45
-7
lines changed

7 files changed

+45
-7
lines changed

.env.example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
VITE_SUPABASE_URL=your_supabase_url_here
33
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key_here
44

5-
# Analytics
6-
VITE_POSTHOG_API_KEY=your_posthog_api_key_here
7-
VITE_POSTHOG_HOST=https://us.i.posthog.com
8-
95
# Development
106
APP_ENV=development
117

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
# Public environment variables (safe to expose)
3939
VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }}
4040
VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }}
41+
# PostHog analytics
42+
VITE_POSTHOG_API_KEY: ${{ secrets.VITE_POSTHOG_API_KEY }}
43+
VITE_POSTHOG_HOST: ${{ secrets.VITE_POSTHOG_HOST }}
4144
# Disable public registration for production
4245
VITE_ENABLE_PUBLIC_REGISTRATION: "false"
4346
# Set to production to enable console stripping

src/hooks/useRBAC.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function useRBAC() {
1818
max_watchlist_stocks?: number;
1919
max_rebalance_stocks?: number;
2020
max_scheduled_rebalances?: number;
21+
max_debate_rounds?: number;
2122
schedule_resolution?: string;
2223
optimization_mode?: string;
2324
number_of_search_sources?: number;
@@ -97,6 +98,7 @@ export function useRBAC() {
9798
const maxWatchlistStocks = limits?.max_watchlist_stocks !== undefined ? Number(limits.max_watchlist_stocks) : undefined;
9899
const maxRebalanceStocks = limits?.max_rebalance_stocks !== undefined ? Number(limits.max_rebalance_stocks) : undefined;
99100
const maxScheduledRebalances = limits?.max_scheduled_rebalances !== undefined ? Number(limits.max_scheduled_rebalances) : undefined;
101+
const maxDebateRounds = limits?.max_debate_rounds !== undefined ? Number(limits.max_debate_rounds) : undefined;
100102
const scheduleResolution = limits?.schedule_resolution || undefined;
101103
const optimizationMode = limits?.optimization_mode || undefined;
102104
const numberOfSearchSources = limits?.number_of_search_sources !== undefined ? Number(limits.number_of_search_sources) : undefined;
@@ -119,6 +121,7 @@ export function useRBAC() {
119121
max_watchlist_stocks: maxWatchlistStocks,
120122
max_rebalance_stocks: maxRebalanceStocks,
121123
max_scheduled_rebalances: maxScheduledRebalances,
124+
max_debate_rounds: maxDebateRounds,
122125
schedule_resolution: scheduleResolution,
123126
optimization_mode: optimizationMode,
124127
number_of_search_sources: numberOfSearchSources,
@@ -355,6 +358,22 @@ export function useRBAC() {
355358
return foundLimit ? maxLimit : 2; // Default fallback
356359
};
357360

361+
const getMaxDebateRounds = (): number => {
362+
// Get the highest debate rounds limit from all user roles
363+
let maxLimit = 0;
364+
let foundLimit = false;
365+
366+
for (const userRole of userRoles) {
367+
const roleDetail = roleDetails.get(userRole.role_id);
368+
if (roleDetail && typeof roleDetail.max_debate_rounds === 'number') {
369+
maxLimit = Math.max(maxLimit, roleDetail.max_debate_rounds);
370+
foundLimit = true;
371+
}
372+
}
373+
374+
return foundLimit ? maxLimit : 2; // Default to 2 debate rounds
375+
};
376+
358377
const getScheduleResolution = (): string[] => {
359378
// Don't hardcode for admin - use database values
360379
// Collect all available resolutions from all user roles
@@ -516,6 +535,7 @@ export function useRBAC() {
516535
getMaxWatchlistStocks,
517536
getMaxRebalanceStocks,
518537
getMaxScheduledRebalances,
538+
getMaxDebateRounds,
519539
getScheduleResolution,
520540
getMaxSearchSources,
521541
getAvailableOptimizationModes,

src/hooks/useRoleManagement.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface RoleLimit {
99
max_watchlist_stocks: number;
1010
max_rebalance_stocks: number;
1111
max_scheduled_rebalances: number;
12+
max_debate_rounds?: number;
1213
schedule_resolution: string;
1314
optimization_mode?: string;
1415
number_of_search_sources?: number;
@@ -46,6 +47,7 @@ export interface RoleWithLimits {
4647
max_watchlist_stocks: number;
4748
max_rebalance_stocks: number;
4849
max_scheduled_rebalances: number;
50+
max_debate_rounds?: number;
4951
schedule_resolution: string;
5052
optimization_mode?: string;
5153
number_of_search_sources?: number;
@@ -128,6 +130,7 @@ export function useRoleManagement() {
128130
max_watchlist_stocks: limits?.max_watchlist_stocks ?? 10,
129131
max_rebalance_stocks: limits?.max_rebalance_stocks ?? 5,
130132
max_scheduled_rebalances: limits?.max_scheduled_rebalances ?? 2,
133+
max_debate_rounds: limits?.max_debate_rounds ?? 2,
131134
schedule_resolution: limits?.schedule_resolution ?? 'Month',
132135
optimization_mode: limits?.optimization_mode ?? 'speed',
133136
number_of_search_sources: limits?.number_of_search_sources ?? 5,

src/pages/admin-role-manager/dialogs/components/NumericLimitsSection.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ export default function NumericLimitsSection({
2424
className="mt-2"
2525
/>
2626
</div>
27+
<div>
28+
<Label>Max Debate Rounds: {limits.max_debate_rounds || 2}</Label>
29+
<Slider
30+
value={[limits.max_debate_rounds || 2]}
31+
onValueChange={(v) => onUpdate({ ...limits, max_debate_rounds: v[0] })}
32+
min={1}
33+
max={5}
34+
step={1}
35+
className="mt-2"
36+
/>
37+
<p className="text-sm text-muted-foreground mt-1">
38+
Number of debate rounds between bull and bear researchers. More rounds provide deeper analysis.
39+
</p>
40+
</div>
2741
<div>
2842
<Label>Max Watchlist Stocks: {limits.max_watchlist_stocks}</Label>
2943
<Slider

src/pages/admin-role-manager/hooks/useRoleActions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export function useRoleActions({
2929
max_watchlist_stocks: editingLimits.max_watchlist_stocks,
3030
max_rebalance_stocks: editingLimits.max_rebalance_stocks,
3131
max_scheduled_rebalances: editingLimits.max_scheduled_rebalances,
32+
max_debate_rounds: editingLimits.max_debate_rounds,
3233
schedule_resolution: editingLimits.schedule_resolution,
3334
optimization_mode: editingLimits.optimization_mode,
3435
number_of_search_sources: editingLimits.number_of_search_sources,

src/pages/settings/AgentsTab.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ export default function AgentsTab({
8282
getDefaultModelValue,
8383
hasAgentConfigAccess = true,
8484
}: AgentsTabProps) {
85-
const { getMaxSearchSources, getAvailableOptimizationModes } = useRBAC();
85+
const { getMaxSearchSources, getAvailableOptimizationModes, getMaxDebateRounds } = useRBAC();
8686
const defaultProviderId = aiProviders.length > 0 ? aiProviders[0].id : '1';
8787
const maxSearchSources = getMaxSearchSources();
88+
const maxDebateRounds = getMaxDebateRounds();
8889
const availableOptimizationModes = getAvailableOptimizationModes();
8990

9091
// Debug logging
@@ -369,15 +370,15 @@ export default function AgentsTab({
369370
value={[researchDebateRounds]}
370371
onValueChange={(value) => setResearchDebateRounds(value[0])}
371372
min={1}
372-
max={5}
373+
max={maxDebateRounds}
373374
step={1}
374375
className="flex-1"
375376
disabled={!hasAgentConfigAccess}
376377
/>
377378
<span className="w-12 text-center font-medium">{researchDebateRounds}</span>
378379
</div>
379380
<p className="text-xs text-muted-foreground">
380-
How many rounds of bull vs bear debate
381+
How many rounds of bull vs bear debate (1-{maxDebateRounds} based on your subscription)
381382
</p>
382383
</div>
383384
<div className="space-y-2">

0 commit comments

Comments
 (0)