This commit is contained in:
Erick Friis 2024-10-11 12:34:55 -04:00
parent 2a1029c53c
commit e18fc8bc16

View File

@ -8,7 +8,8 @@ const FEATURE_TABLES = {
chat: { chat: {
link: "/docs/integrations/chat", link: "/docs/integrations/chat",
columns: [ columns: [
{title: "Provider", formatter: (item) => <a href={item.link}>{item.name}</a>}, {title: "Provider", mode: "category", formatter: (item) => <a href={item.link}>{item.name}</a>},
{title: "Provider", mode: "item", formatter: (item) => <a href={item.link}>{item.name}</a>},
{title: <a href="/docs/how_to/tool_calling">Tool calling</a>, formatter: (item) => item.tool_calling ? "" : ""}, {title: <a href="/docs/how_to/tool_calling">Tool calling</a>, formatter: (item) => item.tool_calling ? "" : ""},
{title: <a href="/docs/how_to/structured_output/">Structured output</a>, formatter: (item) => item.structured_output ? "" : ""}, {title: <a href="/docs/how_to/structured_output/">Structured output</a>, formatter: (item) => item.structured_output ? "" : ""},
{title: "JSON mode", formatter: (item) => item.json_mode ? "✅" : "❌"}, {title: "JSON mode", formatter: (item) => item.json_mode ? "✅" : "❌"},
@ -221,7 +222,7 @@ const FEATURE_TABLES = {
llms: { llms: {
link: "/docs/integrations/llms", link: "/docs/integrations/llms",
columns: [ columns: [
{title: "Provider", formatter: (item) => <a href={ {title: "Provider", mode: "category", formatter: (item) => <a href={
item.link item.link
}>{item.name}</a>}, }>{item.name}</a>},
{title: "Package", formatter: (item) => <a href={ {title: "Package", formatter: (item) => <a href={
@ -294,7 +295,8 @@ const FEATURE_TABLES = {
text_embedding: { text_embedding: {
link: "/docs/integrations/text_embedding", link: "/docs/integrations/text_embedding",
columns: [ columns: [
{title: "Provider", formatter: (item) => <a href={item.link}>{item.name}</a>}, {title: "Provider", mode: "category", formatter: (item) => <a href={item.link}>{item.name}</a>},
{title: "Provider", mode: "item", formatter: (item) => <a href={`/docs/integrations/${item.top ? "platforms":"providers"}/${item.link}`}>{item.name}</a>},
{title: "Package", formatter: (item) => <a href={item.apiLink}>{item.package}</a>}, {title: "Package", formatter: (item) => <a href={item.apiLink}>{item.package}</a>},
], ],
items:[ items:[
@ -1120,7 +1122,7 @@ const DEPRECATED_DOC_IDS = [
"integrations/text_embedding/ernie", "integrations/text_embedding/ernie",
]; ];
function toTable(columns, items) { function toTable(columns, items, mode) {
const headers = columns.map((col) => col.title); const headers = columns.map((col) => col.title);
return ( return (
<table> <table>
@ -1132,7 +1134,7 @@ function toTable(columns, items) {
<tbody> <tbody>
{items.map((item, i) => ( {items.map((item, i) => (
<tr key={`row-${i}`}> <tr key={`row-${i}`}>
{columns.map((col, j) => <td key={`cell-${i}-${j}`}>{col.formatter(item)}</td>)} {columns.filter(col => !col.mode || col.mode === mode).map((col, j) => <td key={`cell-${i}-${j}`}>{col.formatter(item)}</td>)}
</tr> </tr>
))} ))}
</tbody> </tbody>
@ -1142,7 +1144,7 @@ function toTable(columns, items) {
export function CategoryTable({ category }) { export function CategoryTable({ category }) {
const cat = FEATURE_TABLES[category]; const cat = FEATURE_TABLES[category];
const rtn = toTable(cat.columns, cat.items); const rtn = toTable(cat.columns, cat.items, "category");
return rtn; return rtn;
} }
@ -1152,7 +1154,7 @@ export function ItemTable({ category, item }) {
if (!row) { if (!row) {
throw new Error(`Item ${item} not found in category ${category}`); throw new Error(`Item ${item} not found in category ${category}`);
} }
const rtn = toTable(cat.columns, [row]); const rtn = toTable(cat.columns, [row], "item");
return rtn; return rtn;
} }
@ -1185,6 +1187,7 @@ export function IndexTable() {
}, },
], ],
rows, rows,
"index",
); );
return rtn; return rtn;
} }