feat: add IP geolocation tracking and include location in prompts
- Add GeoLite2-City.mmdb database for IP lookup - Create geoip.py module for IP location services - Extract client IP from requests and log location info - Pass location context to LLM prompts for enhanced responses
This commit is contained in:
+3
-2
@@ -29,12 +29,13 @@ def prepare_prompt_context(prefix: str, suffix: str) -> Tuple[str, str]:
|
||||
return _prepare_context(prefix, suffix)
|
||||
|
||||
|
||||
def build_prompt(prefix: str, suffix: str, language_id: str = "markdown") -> str:
|
||||
def build_prompt(prefix: str, suffix: str, language_id: str = "markdown", location: str = "") -> str:
|
||||
safe_language_id = _sanitize_language_id(language_id)
|
||||
recent_prefix, recent_suffix = _prepare_context(prefix, suffix)
|
||||
current_time = _get_current_datetime()
|
||||
location_info = f"\nUser location: {location}" if location else ""
|
||||
|
||||
prompt = f"""Current time: {current_time}
|
||||
prompt = f"""Current time: {current_time}{location_info}
|
||||
|
||||
You are an inline completion engine for a {safe_language_id} editor with ghost-text suggestions.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user