mirror of
https://github.com/github/awesome-copilot.git
synced 2026-03-23 09:35:13 +00:00
Website build error (#1136)
* Fixing model names * handling arrays of models for agent frontmatter * Cleaning up some warnings on website build * adding a workflow to run and perform CI of the website
This commit is contained in:
@@ -115,7 +115,12 @@ export default defineConfig({
|
||||
trailingSlash: "always",
|
||||
vite: {
|
||||
build: {
|
||||
sourcemap: true,
|
||||
// Production sourcemaps trigger a known warning in the expressive-code Vite plugin.
|
||||
// The docs site does not need emitted JS sourcemaps for its validation build.
|
||||
sourcemap: false,
|
||||
// Starlight ships large syntax-highlighting chunks that are expected for this site.
|
||||
// Raise the threshold so Vite only warns on materially larger regressions.
|
||||
chunkSizeWarningLimit: 900,
|
||||
},
|
||||
css: {
|
||||
devSourcemap: true,
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface RenderableAgent {
|
||||
title: string;
|
||||
description?: string;
|
||||
path: string;
|
||||
model?: string;
|
||||
model?: string | string[];
|
||||
tools?: string[];
|
||||
hasHandoffs?: boolean;
|
||||
lastUpdated?: string | null;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { setupModal, openFileModal } from '../modal';
|
||||
import { renderAgentsHtml, sortAgents, type AgentSortOption, type RenderableAgent } from './agents-render';
|
||||
|
||||
interface Agent extends SearchItem, RenderableAgent {
|
||||
model?: string;
|
||||
model?: string | string[];
|
||||
tools?: string[];
|
||||
hasHandoffs?: boolean;
|
||||
lastUpdated?: string | null;
|
||||
@@ -51,7 +51,7 @@ function applyFiltersAndRender(): void {
|
||||
if (currentFilters.models.includes('(none)') && !item.model) {
|
||||
return true;
|
||||
}
|
||||
return item.model && currentFilters.models.includes(item.model);
|
||||
return item.model && (Array.isArray(item.model) ? item.model.some(m => currentFilters.models.includes(m)) : currentFilters.models.includes(item.model));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,11 @@ export function debounce<T extends (...args: unknown[]) => void>(
|
||||
/**
|
||||
* Escape HTML to prevent XSS
|
||||
*/
|
||||
export function escapeHtml(text: string): string {
|
||||
export function escapeHtml(text: string | string[]): string {
|
||||
if (Array.isArray(text)) {
|
||||
return text.map(escapeHtml).join(", ");
|
||||
}
|
||||
|
||||
return text
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
@@ -290,17 +294,17 @@ export function escapeHtml(text: string): string {
|
||||
* Only allows http/https protocols, returns '#' for invalid URLs
|
||||
*/
|
||||
export function sanitizeUrl(url: string | null | undefined): string {
|
||||
if (!url) return '#';
|
||||
if (!url) return "#";
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
// Only allow http and https protocols
|
||||
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
|
||||
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
|
||||
return url;
|
||||
}
|
||||
} catch {
|
||||
// Invalid URL
|
||||
}
|
||||
return '#';
|
||||
return "#";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user