-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add generating llm providers page
- Loading branch information
1 parent
18ae4d6
commit 9d63609
Showing
33 changed files
with
894 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const fs = require('fs').promises; | ||
const path = require('path'); | ||
|
||
async function combineMarkdownFiles(sourceDir, outputFile) { | ||
try { | ||
console.log(`Reading directory: ${sourceDir}`); | ||
const files = await fs.readdir(sourceDir); | ||
console.log(`Found ${files.length} files`); | ||
|
||
const markdownFiles = files | ||
.filter(file => file.endsWith('.md')) | ||
.sort(); | ||
console.log(`Found ${markdownFiles.length} Markdown files`); | ||
|
||
const pageMeta = `--- | ||
id: llm-providers | ||
title: LLM Providers | ||
sidebar_label: 🤖 LLM Providers | ||
toc_max_heading_level: 2 | ||
description: Overview of the various LLM providers supported by Continue | ||
keywords: [LLM, language models, AI, machine learning, natural language processing] | ||
--- | ||
`; | ||
|
||
const autoGeneratedWarning = ` | ||
<!-- | ||
WARNING: This file is auto-generated. Any manual changes to this file will be overwritten. | ||
--> | ||
`; | ||
|
||
let combinedContent = pageMeta + autoGeneratedWarning; | ||
|
||
for (const file of markdownFiles) { | ||
console.log(`Processing file: ${file}`); | ||
const filePath = path.join(sourceDir, file); | ||
let content = await fs.readFile(filePath, 'utf8'); | ||
|
||
// Add one '#' to each heading | ||
content = content.replace(/^(#+)\s/gm, '#$1 '); | ||
|
||
combinedContent += `\n\n${content}`; | ||
} | ||
|
||
console.log(`Writing combined content to: ${outputFile}`); | ||
await fs.writeFile(outputFile, combinedContent.trim()); | ||
console.log(`Combined Markdown file generated: ${outputFile}`); | ||
} catch (error) { | ||
console.error('Error combining Markdown files:', error); | ||
} | ||
} | ||
|
||
const sourceDirectory = './llm-providers'; | ||
const outputFile = './docs/reference/llm-providers.md'; | ||
|
||
combineMarkdownFiles(sourceDirectory, outputFile); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters