| |
| |
| |
| |
| export const EXCLUDE_PROMPT_PATTERNS_STORAGE_KEY = 'info_radar_attribution_exclude_tokens'; |
| export const EXCLUDE_PROMPT_PATTERNS_ENABLED_STORAGE_KEY = 'info_radar_attribution_exclude_tokens_enabled'; |
|
|
| export const EXCLUDE_GENERATED_PATTERNS_STORAGE_KEY = 'info_radar_attribution_exclude_generated_tokens'; |
| export const EXCLUDE_GENERATED_PATTERNS_ENABLED_STORAGE_KEY = |
| 'info_radar_attribution_exclude_generated_tokens_enabled'; |
|
|
| |
| |
| |
| |
| export const DEFAULT_EXCLUDE_PROMPT_PATTERNS_TEXT = [ |
| "#comment# use '#comment#' to comment lines; support regex", |
| '<\\|im_start\\|>system\\n', |
| '<\\|im_start\\|>user\\n', |
| '<\\|im_start\\|>assistant\\n', |
| '<\\|im_start\\|>assistant\\n\\n', |
| '<\\|im_end\\|>\\n', |
| '<think>\\n\\n', |
| '</think>\\n\\n', |
| '<\\|im_start\\|>system\\n[\\s\\S]*?<\\|im_end\\|>#comment# all system prompt', |
| ].join('\n'); |
|
|
| |
| |
| |
| export const DEFAULT_EXCLUDE_GENERATED_PATTERNS_TEXT = [ |
| '<think>\\n', |
| '</think>\\n\\n', |
| ].join('\n'); |
|
|
| |
| |
| |
| |
| export function readStoredEffectiveExcludePromptPatternsText(): string { |
| try { |
| const enabledRaw = localStorage.getItem(EXCLUDE_PROMPT_PATTERNS_ENABLED_STORAGE_KEY); |
| const enabled = enabledRaw === null ? true : enabledRaw === '1'; |
| if (!enabled) return ''; |
| const raw = localStorage.getItem(EXCLUDE_PROMPT_PATTERNS_STORAGE_KEY); |
| if (raw === null) return DEFAULT_EXCLUDE_PROMPT_PATTERNS_TEXT; |
| return raw; |
| } catch { |
| return ''; |
| } |
| } |
|
|
| |
| |
| |
| |
| export function readStoredEffectiveExcludeGeneratedPatternsText(): string { |
| try { |
| const enabledRaw = localStorage.getItem(EXCLUDE_GENERATED_PATTERNS_ENABLED_STORAGE_KEY); |
| const enabled = enabledRaw === null ? true : enabledRaw === '1'; |
| if (!enabled) return ''; |
| const raw = localStorage.getItem(EXCLUDE_GENERATED_PATTERNS_STORAGE_KEY); |
| if (raw === null) return DEFAULT_EXCLUDE_GENERATED_PATTERNS_TEXT; |
| return raw; |
| } catch { |
| return ''; |
| } |
| } |
|
|