ui: added single line reasoning preview (#23601)
* webui: added single line reasoning preview. * patch: reduce width slightly for the previewing section * refactor: move formatter constants to the right file * feat: reimplement reasoning preview with throttled dynamic per-line rendering * chore: fix spacing Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com> * chore: refactor to requested changes * refactor: grouped by capture pattern instead of block-level + inline * ui: fax interrupt state only trigger for 1st reasoning message * chore: make reasoning preview respects showThoughtInProgress setting * chore; newline at EOF Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com> * fix: thread rawContent so collapsible content can handle compute preview * patch: showThoughtInProgress accidentally blocks rawContent being passed * chore: fix lint * chore: change smoke test --------- Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com>
This commit is contained in:
co-authored by
Aleksander Grygier
parent
0dbfa66a1f
commit
526977068f
@@ -6,3 +6,30 @@ export const MEDIUM_DURATION_THRESHOLD = 10;
|
||||
|
||||
/** Default display value when no performance time is available */
|
||||
export const DEFAULT_PERFORMANCE_TIME = '0s';
|
||||
|
||||
/** Max length before reasoning preview is truncated */
|
||||
export const MAX_PREVIEW_LENGTH = 120;
|
||||
|
||||
export const STRIP_MARKDOWN_CAPTURE_PATTERNS: [RegExp, string][] = [
|
||||
[/^```(.*)/gm, '$1'],
|
||||
[/(.*)```$/gm, '$1'],
|
||||
[/`([^`]*)`/g, '$1'],
|
||||
[/\*\*(.*?)\*\*/g, '$1'],
|
||||
[/__(.*?)__/g, '$1'],
|
||||
[/\*(.*?)\*/g, '$1'],
|
||||
[/_(.*?)_/g, '$1']
|
||||
];
|
||||
|
||||
/* eslint-disable no-misleading-character-class */
|
||||
export const STRIP_MARKDOWN_INLINE_REGEX = new RegExp(
|
||||
[
|
||||
'<[^>]*>',
|
||||
'^>\\s*',
|
||||
'^#{1,6}\\s+',
|
||||
'^[\\s]*[-*+]\\s+',
|
||||
'^[\\s]*\\d+[.)]\\s+',
|
||||
'[\\u{1F600}-\\u{1F64F}\\u{1F300}-\\u{1F5FF}\\u{1F680}-\\u{1F6FF}\\u{1F1E0}-\\u{1F1FF}\\u{2600}-\\u{26FF}\\u{2700}-\\u{27BF}\\u{FE00}-\\u{FE0F}\\u{1F900}-\\u{1F9FF}\\u{1FA00}-\\u{1FA6F}\\u{1FA70}-\\u{1FAFF}\\u{200D}\\u{20E3}\\u{231A}-\\u{231B}\\u{23E9}-\\u{23F3}\\u{23F8}-\\u{23FA}\\u{25AA}-\\u{25AB}\\u{25B6}\\u{25C0}\\u{25FB}-\\u{25FE}\\u{2934}-\\u{2935}\\u{2B05}-\\u{2B07}\\u{2B1B}-\\u{2B1C}\\u{2B50}\\u{2B55}\\u{3030}\\u{303D}\\u{3297}\\u{3299}]'
|
||||
].join('|'),
|
||||
'gmu'
|
||||
);
|
||||
/* eslint-enable no-misleading-character-class */
|
||||
|
||||
Reference in New Issue
Block a user