From ecc98be6694a4f31166a818fa850dd098676f8eb Mon Sep 17 00:00:00 2001 From: Platform Fix Bot Date: Mon, 19 Jan 2026 21:37:17 +0400 Subject: [PATCH] feat(ui): add OSC 8 hyperlink support for model URLs - Added hyperlink and hyperlink_url helper functions in ui::console - Updated grep models info command to use clickable hyperlinks for model downloads - Improves UX in modern terminals supporting OSC 8 --- src/cli/commands.rs | 10 ++++++---- src/ui/console.rs | 11 +++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/cli/commands.rs b/src/cli/commands.rs index f128499..e6916c2 100644 --- a/src/cli/commands.rs +++ b/src/cli/commands.rs @@ -975,8 +975,9 @@ fn run_models(action: ModelsAction, config: &mut Config) -> Result<()> { ); println!(" {} ~600MB", style("Size:").dim()); println!( - " {} https://huggingface.co/Qwen/Qwen3-Embedding-0.6B-GGUF", - style("URL:").dim() + " {} {}", + style("URL:").dim(), + ui::hyperlink("https://huggingface.co/Qwen/Qwen3-Embedding-0.6B-GGUF", "https://huggingface.co/Qwen/Qwen3-Embedding-0.6B-GGUF") ); println!(); println!( @@ -990,8 +991,9 @@ fn run_models(action: ModelsAction, config: &mut Config) -> Result<()> { ); println!(" {} ~400MB", style("Size:").dim()); println!( - " {} https://huggingface.co/sinjab/Qwen3-Reranker-0.6B-Q4_K_M-GGUF", - style("URL:").dim() + " {} {}", + style("URL:").dim(), + ui::hyperlink("https://huggingface.co/sinjab/Qwen3-Reranker-0.6B-Q4_K_M-GGUF", "https://huggingface.co/sinjab/Qwen3-Reranker-0.6B-Q4_K_M-GGUF") ); println!(); println!(" Download with: {}", style("vgrep models download").cyan()); diff --git a/src/ui/console.rs b/src/ui/console.rs index b910218..ce2dab9 100644 --- a/src/ui/console.rs +++ b/src/ui/console.rs @@ -14,6 +14,17 @@ pub static EYE: Emoji<'_, '_> = Emoji("👁️ ", ""); pub static SPARKLES: Emoji<'_, '_> = Emoji("✨ ", ""); pub static BRAIN: Emoji<'_, '_> = Emoji("🧠 ", ""); +/// Create a clickable hyperlink using OSC 8 escape sequence. +/// Falls back to plain text display in unsupporting terminals. +pub fn hyperlink(url: &str, text: &str) -> String { + format!("\x1b]8;;{}\x07{}\x1b]8;;\x07", url, text) +} + +/// Create a hyperlink where the URL is also the display text. +pub fn hyperlink_url(url: &str) -> String { + hyperlink(url, url) +} + pub fn print_banner() { let banner = r#"