Compare commits
3
Commits
d7bec8a5a3
..
status
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8596500665 | ||
|
|
2690754abd | ||
|
|
ec5d2f14f4 |
@@ -8,13 +8,10 @@
|
||||
classDiagram
|
||||
class IApi
|
||||
|
||||
|
||||
|
||||
class ProductService {
|
||||
+IProduct[] getProducts
|
||||
}
|
||||
|
||||
|
||||
ProductService --> IApi
|
||||
|
||||
Animal <|-- Duck
|
||||
|
||||
@@ -20,23 +20,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}` : ''}`;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user