diff --git a/frontend/src/components/keys/UseKeyModal.vue b/frontend/src/components/keys/UseKeyModal.vue index dabb60af..3d687b5a 100644 --- a/frontend/src/components/keys/UseKeyModal.vue +++ b/frontend/src/components/keys/UseKeyModal.vue @@ -107,7 +107,10 @@ -
+
+                
+                
+              
@@ -165,6 +168,7 @@ interface FileConfig { path: string content: string hint?: string // Optional hint message for this file + highlighted?: string } const props = defineProps() @@ -310,6 +314,22 @@ const platformNote = computed(() => { } }) +const escapeHtml = (value: string) => value + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, ''') + +const wrapToken = (className: string, value: string) => + `${escapeHtml(value)}` + +const keyword = (value: string) => wrapToken('text-emerald-300', value) +const variable = (value: string) => wrapToken('text-sky-200', value) +const operator = (value: string) => wrapToken('text-slate-400', value) +const string = (value: string) => wrapToken('text-amber-200', value) +const comment = (value: string) => wrapToken('text-slate-500', value) + // Syntax highlighting helpers // Generate file configs based on platform and active tab const currentFiles = computed((): FileConfig[] => { @@ -382,9 +402,9 @@ ${keyword('export')} ${variable('GEMINI_MODEL')}${operator('=')}${string(`"${mod content = `set GOOGLE_GEMINI_BASE_URL=${baseUrl} set GEMINI_API_KEY=${apiKey} set GEMINI_MODEL=${model}` - highlighted = `${keyword('set')} ${variable('GOOGLE_GEMINI_BASE_URL')}${operator('=')}${baseUrl} -${keyword('set')} ${variable('GEMINI_API_KEY')}${operator('=')}${apiKey} -${keyword('set')} ${variable('GEMINI_MODEL')}${operator('=')}${model} + highlighted = `${keyword('set')} ${variable('GOOGLE_GEMINI_BASE_URL')}${operator('=')}${string(baseUrl)} +${keyword('set')} ${variable('GEMINI_API_KEY')}${operator('=')}${string(apiKey)} +${keyword('set')} ${variable('GEMINI_MODEL')}${operator('=')}${string(model)} ${comment(`REM ${modelComment}`)}` break case 'powershell':