diff --git a/src/handlers/recommend.ts b/src/handlers/recommend.ts index 13a9da3..c4f6efd 100644 --- a/src/handlers/recommend.ts +++ b/src/handlers/recommend.ts @@ -12,7 +12,8 @@ import type { BandwidthEstimate, RecommendationResult, BenchmarkReference, - AIRecommendationResponse + AIRecommendationResponse, + AvailableRegion } from '../types'; import { i18n, LIMITS } from '../config'; import { @@ -1054,6 +1055,20 @@ The option with the LOWEST TOTAL MONTHLY COST (including bandwidth) should have // Calculate bandwidth info for this server const bandwidthInfo = calculateBandwidthInfo(server, bandwidthEstimate); + // Find all available regions for the same server spec + const availableRegions: AvailableRegion[] = candidates + .filter(c => + c.provider_name === server.provider_name && + c.instance_id === server.instance_id && + c.region_code !== server.region_code // Exclude current region + ) + .map(c => ({ + region_name: c.region_name, + region_code: c.region_code, + monthly_price: c.monthly_price + })) + .sort((a, b) => a.monthly_price - b.monthly_price); + results.push({ server: server, score: aiRec.score, @@ -1070,6 +1085,7 @@ The option with the LOWEST TOTAL MONTHLY COST (including bandwidth) should have performance_per_dollar: matchingVPS.performance_per_dollar, } : undefined, + available_regions: availableRegions.length > 0 ? availableRegions : undefined, }); if (results.length >= 3) break; diff --git a/src/types.ts b/src/types.ts index a4a7533..793f202 100644 --- a/src/types.ts +++ b/src/types.ts @@ -59,6 +59,12 @@ export interface BandwidthInfo { warning?: string; // 트래픽 관련 경고 } +export interface AvailableRegion { + region_name: string; + region_code: string; + monthly_price: number; +} + export interface RecommendationResult { server: Server; score: number; @@ -82,6 +88,7 @@ export interface RecommendationResult { monthly_price_usd: number; performance_per_dollar: number; }; + available_regions?: AvailableRegion[]; } export interface BenchmarkReference {