Compare commits

1 Commits
Author SHA1 Message Date
arswarog 2690754abd chat: добавление чата
Reviewed-on: #7
Co-authored-by: Arswarog <arswarog@yandex.ru>
2026-08-08 15:59:25 +03:00
2 changed files with 2 additions and 19 deletions
+1 -18
View File
@@ -15,23 +15,6 @@ export interface IChatMessage {
sources?: IChatSource[];
}
function stripNumericPrefixes(p: string): string {
return p
.split('/')
.map((seg) => seg.replace(/^\d+-/, ''))
.join('/');
}
export function sourceToUrl(file: string, anchor: string): string {
let p = file.replace(/^docs\//, '').replace(/\.md$/, '');
p = stripNumericPrefixes(p);
return `/docs/${p}${anchor ? `#${anchor}` : ''}`;
}
export function sourceToPath(file: string): string {
const p = file.replace(/^docs\//, '').replace(/\.md$/, '');
return stripNumericPrefixes(p);
return `/${file}${anchor ? `#${anchor}` : ''}`;
}
+1 -1
View File
@@ -32,7 +32,7 @@ export function Message({ role, content, sources }: MessageProps): ReactNode {
to={sourceToUrl(src.file, src.anchor)}
className={b('sourceLink')}
>
{src.heading || sourceToPath(src.file)}
{src.heading}
</Link>
))}
</div>