Compare commits
6
Commits
next
..
d7bec8a5a3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7bec8a5a3 | ||
|
|
06efc69250 | ||
|
|
d04e3bfb1e | ||
|
|
17b8a8e823 | ||
|
|
1f71a0d815 | ||
|
|
4d862b58be |
@@ -8,10 +8,13 @@
|
||||
classDiagram
|
||||
class IApi
|
||||
|
||||
|
||||
|
||||
class ProductService {
|
||||
+IProduct[] getProducts
|
||||
}
|
||||
|
||||
|
||||
ProductService --> IApi
|
||||
|
||||
Animal <|-- Duck
|
||||
|
||||
@@ -20,6 +20,23 @@ 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 {
|
||||
return `/${file}${anchor ? `#${anchor}` : ''}`;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export function Message({ role, content, sources }: MessageProps): ReactNode {
|
||||
to={sourceToUrl(src.file, src.anchor)}
|
||||
className={b('sourceLink')}
|
||||
>
|
||||
{src.heading}
|
||||
{src.heading || sourceToPath(src.file)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user