Compare commits

...

40 Commits

Author SHA1 Message Date
thucpn eaf52fc481 bump: fuma 2024-12-11 15:05:49 +07:00
thucpn dc90c3da32 fix: missing command 2024-12-11 14:52:15 +07:00
thucpn 16d104227b fix: command 2024-12-11 14:51:34 +07:00
thucpn ce5f7ddbad fix: lock 2024-12-11 14:42:32 +07:00
thucpn e593e04770 update lock 2024-12-11 14:40:35 +07:00
thucpn 8f62ff7fed try fixed versions 2024-12-11 14:38:07 +07:00
thucpn c654ef474f fix: config for monorepo 2024-12-11 13:51:26 +07:00
thucpn e08a210b3a fix: missing css 2024-12-11 13:29:33 +07:00
thucpn af650b0826 update lock 2024-12-11 12:27:24 +07:00
thucpn 8e14cff7ec Merge branch 'main' into feat/migrate-legacy-docs 2024-12-11 12:26:41 +07:00
thucpn 2f30d62312 Merge branch 'main' into feat/migrate-legacy-docs 2024-12-11 11:03:05 +07:00
thucpn f95ec1f3e8 fix: overide default css 2024-12-11 11:00:19 +07:00
thucpn 6a9e1d5459 fix: file group 2024-12-09 18:49:41 +07:00
thucpn ab6dd7ea9c fix: slug 2024-12-09 18:43:44 +07:00
thucpn c469d47f11 update generate function 2024-12-09 18:38:22 +07:00
Thuc Pham 915b2144b7 Create sharp-ties-jog.md 2024-12-09 17:07:03 +07:00
thucpn 0dac1730ca remove debugging job 2024-12-09 17:04:16 +07:00
thucpn 4367ce65d6 handle when .mdx not in the end 2024-12-09 16:41:24 +07:00
thucpn 4968155658 remove rewrites 2024-12-09 16:40:54 +07:00
thucpn 480d7c3bd2 remove log 2024-12-09 16:35:37 +07:00
thucpn f4eeb18274 handle path transform 2024-12-09 16:19:48 +07:00
thucpn cc32406879 support absolute link 2024-12-09 15:27:06 +07:00
thucpn 7c0457b540 remove .mdx from link 2024-12-09 14:57:25 +07:00
thucpn f7cd1dffde set memory when building doc 2024-12-09 12:19:26 +07:00
thucpn 07e381f461 remove job 2024-12-09 12:06:56 +07:00
thucpn abab1fc276 add test build new document 2024-12-09 12:04:20 +07:00
thucpn 791c5d26e1 add test document build 2024-12-09 12:00:26 +07:00
thucpn f1ed6dff9e fix: comment should follow mdx 2024-12-09 11:50:57 +07:00
thucpn c3c2ad2d2b temporary fix 2024-12-06 17:15:42 +07:00
thucpn b1ee27f3dd fix: path fail for index url 2024-12-06 16:40:51 +07:00
thucpn 4cf9ad31e2 use nextjs rewrite 2024-12-06 16:28:50 +07:00
thucpn ba3e67e5ed fix: replace all 2024-12-06 16:19:16 +07:00
thucpn a8313db6c7 transform content 2024-12-06 16:14:20 +07:00
thucpn 7317ca9711 append title only 2024-12-06 15:46:30 +07:00
thucpn ea578f0cc4 use index as entry 2024-12-06 15:40:51 +07:00
thucpn 850b375a3f fix: generate doc 2024-12-06 15:34:27 +07:00
thucpn d6e62481b8 run typedoc first 2024-12-06 15:31:06 +07:00
thucpn bbf5e8a629 fix: rename entry page LlamaIndex 2024-12-06 15:30:48 +07:00
thucpn 5f5a773425 transform api pages 2024-12-06 15:21:22 +07:00
thucpn 6896be467a feat: migrate legacy docs 2024-12-06 14:40:43 +07:00
11 changed files with 586 additions and 375 deletions
+7
View File
@@ -0,0 +1,7 @@
---
"@llamaindex/doc": patch
"@llamaindex/core": patch
"@llamaindex/readers": patch
---
feat: build api reference pages for new documentation site
+1
View File
@@ -29,4 +29,5 @@ next-env.d.ts
# build
/src/content/docs/cloud/api
/src/content/docs/api
./types
+10 -6
View File
@@ -8,7 +8,7 @@
"start": "next start",
"postdev": "fumadocs-mdx",
"postbuild": "fumadocs-mdx && tsx scripts/post-build.mts",
"build:docs": "node ./scripts/generate-docs.mjs"
"build:docs": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" typedoc && node ./scripts/generate-docs.mjs"
},
"dependencies": {
"@icons-pack/react-simple-icons": "^10.1.0",
@@ -33,13 +33,13 @@
"clsx": "2.1.1",
"foxact": "^0.2.41",
"framer-motion": "^11.11.17",
"fumadocs-core": "14.4.2",
"fumadocs-core": "^14.6.0",
"fumadocs-docgen": "^1.3.2",
"fumadocs-mdx": "^11.1.1",
"fumadocs-openapi": "^5.7.0",
"fumadocs-twoslash": "^2.0.1",
"fumadocs-mdx": "^11.1.2",
"fumadocs-openapi": "^5.8.2",
"fumadocs-twoslash": "^2.0.2",
"fumadocs-typescript": "^3.0.2",
"fumadocs-ui": "14.4.2",
"fumadocs-ui": "^14.6.0",
"hast-util-to-jsx-runtime": "^2.3.2",
"llamaindex": "workspace:*",
"lucide-react": "^0.460.0",
@@ -72,6 +72,7 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"autoprefixer": "^10.4.20",
"cross-env": "^7.0.3",
"fast-glob": "^3.3.2",
"gray-matter": "^4.0.3",
"monaco-editor-webpack-plugin": "^7.1.0",
@@ -82,6 +83,9 @@
"remark-stringify": "^11.0.0",
"tailwindcss": "^3.4.15",
"tsx": "^4.19.2",
"typedoc": "^0.26.11",
"typedoc-plugin-markdown": "^4.3.1",
"typedoc-plugin-merge-modules": "^6.1.0",
"typescript": "^5.6.3"
}
}
+64
View File
@@ -1,8 +1,12 @@
import * as OpenAPI from "fumadocs-openapi";
import { generateFiles } from "fumadocs-typescript";
import fs from "node:fs";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
import { rimrafSync } from "rimraf";
const out = "./src/content/docs/cloud/api";
const apiRefOut = "./src/content/docs/api";
// clean generated files
rimrafSync(out, {
@@ -20,3 +24,63 @@ void OpenAPI.generateFiles({
output: out,
groupBy: "tag",
});
void generateFiles({
input: ["./src/content/docs/api/**/*.mdx"],
output: (file) => path.resolve(path.dirname(file), path.basename(file)),
transformOutput,
});
function transformOutput(filePath, content) {
const fileName = path.basename(filePath);
let title = fileName.split(".")[0];
let pageContent = content;
if (title === "index") title = "LlamaIndex API Reference";
return `---\ntitle: ${title}\n---\n\n${transformAbsoluteUrl(pageContent, filePath)}`;
}
/**
* Transforms the content by converting relative MDX links to absolute docs API links
* Example: [text](../type-aliases/TaskHandler.mdx) -> [text](/docs/api/type-aliases/TaskHandler)
* [text](BaseChatEngine.mdx) -> [text](/docs/api/classes/BaseChatEngine)
* [text](BaseVectorStore.mdx#constructors) -> [text](/docs/api/classes/BaseVectorStore#constructors)
* [text](TaskStep.mdx) -> [text](/docs/api/type-aliases/TaskStep)
*/
function transformAbsoluteUrl(content, filePath) {
const group = path.dirname(filePath).split(path.sep).pop();
return content.replace(
/\]\(([^)]+)\.mdx([^)]*)\)/g,
(match, slug, anchor) => {
const slugParts = slug.split("/");
const fileName = slugParts[slugParts.length - 1];
const fileGroup = slugParts[slugParts.length - 2] ?? group;
const result = ["/docs/api", fileGroup, fileName, anchor]
.filter(Boolean)
.join("/");
return `](${result})`;
},
);
}
// append meta.json for API page
fs.writeFileSync(
path.resolve(apiRefOut, "meta.json"),
JSON.stringify(
{
title: "API Reference",
description: "LlamaIndex API Reference",
root: true,
pages: [
"index",
"classes",
"enumerations",
"functions",
"interfaces",
"type-aliases",
"variables",
],
},
null,
2,
),
);
+29
View File
@@ -94,4 +94,33 @@
body {
@apply bg-background text-foreground;
}
/*
* Override default styles for Markdown
*/
.prose
:where(blockquote):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
font-style: normal !important;
}
.prose
:where(blockquote p:first-of-type):not(
:where([class~="not-prose"], [class~="not-prose"] *)
):before {
content: none !important;
}
.prose
:where(blockquote p:first-of-type):not(
:where([class~="not-prose"], [class~="not-prose"] *)
):after {
content: none !important;
}
.prose
:where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
@apply text-blue-600 !important;
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
{
"pages": ["llamaindex", "cloud"]
"pages": ["llamaindex", "cloud", "api"]
}
+18
View File
@@ -0,0 +1,18 @@
{
"plugin": ["typedoc-plugin-markdown", "typedoc-plugin-merge-modules"],
"entryPoints": ["../../packages/llamaindex/src/index.ts"],
"tsconfig": "../../tsconfig.json",
"readme": "none",
"sourceLinkTemplate": "https://github.com/run-llama/LlamaIndexTS/blob/{gitRevision}/{path}#L{line}",
"out": "./src/content/docs/api",
"outputFileStrategy": "members",
"categorizeByGroup": true,
"categoryOrder": ["Classes", "Enums", "Functions", "Interfaces", "Types"],
"sort": ["source-order"],
"entryFileName": "index.md",
"fileExtension": ".mdx",
"hidePageTitle": true,
"hidePageHeader": true,
"hideGroupHeadings": true,
"hideBreadcrumbs": true
}
@@ -22,7 +22,8 @@ import type { ContextGenerator } from "./type";
/**
* ContextChatEngine uses the Index to get the appropriate context for each query.
* The context is stored in the system prompt, and the chat history is chunk: ChatResponseChunk, nodes?: NodeWithScore<import("/Users/marcus/code/llamaindex/LlamaIndexTS/packages/core/src/Node").Metadata>[], nodes?: NodeWithScore<import("/Users/marcus/code/llamaindex/LlamaIndexTS/packages/core/src/Node").Metadata>[]lowing the appropriate context to be surfaced for each query.
* The context is stored in the system prompt, and the chat history is chunk,
* allowing the appropriate context to be surfaced for each query.
*/
export class ContextChatEngine extends PromptMixin implements BaseChatEngine {
chatModel: LLM;
+1 -1
View File
@@ -13,7 +13,7 @@ export class HTMLReader extends FileReader<Document> {
* Public method for this reader.
* Required by BaseReader interface.
* @param fileContent - The content of the file.
* @returns Promise<Document[]> A Promise object, eventually yielding zero or one Document parsed from the HTML content of the specified file.
* @returns `Promise<Document[]>` A Promise object, eventually yielding zero or one Document parsed from the HTML content of the specified file.
*/
async loadDataAsContent(fileContent: Uint8Array): Promise<Document[]> {
const decoder = new TextDecoder("utf-8");
+1 -1
View File
@@ -8,7 +8,7 @@ export class ImageReader extends FileReader<ImageDocument> {
* Public method for this reader.
* Required by BaseReader interface.
* @param fileContent - The content of the file.
* @returns Promise<Document[]> A Promise object, eventually yielding zero or one ImageDocument of the specified file.
* @returns `Promise<Document[]>` A Promise object, eventually yielding zero or one ImageDocument of the specified file.
*/
async loadDataAsContent(fileContent: Uint8Array): Promise<ImageDocument[]> {
const blob = new Blob([fileContent]);
+452 -365
View File
File diff suppressed because it is too large Load Diff