Skip to content

Commit cbdee6f

Browse files
chore: move cortex.so docs repo into cortex.cpp repo (janhq#1463)
Co-authored-by: Service Account <service@jan.ai>
1 parent 902c6b6 commit cbdee6f

File tree

233 files changed

+35056
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+35056
-1
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Clean old cloudflare pages preview urls and nightly build"
2+
on:
3+
schedule:
4+
- cron: "0 0 * * *" # every day at 00:00
5+
workflow_dispatch:
6+
7+
jobs:
8+
clean-cloudflare-pages-preview-urls:
9+
strategy:
10+
matrix:
11+
project: ["cortex-docs"]
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.x'
17+
- name: install requests
18+
run: |
19+
python3 -m pip install requests pytz tqdm
20+
- name: Python Inline script
21+
uses: jannekem/run-python-script-action@v1
22+
with:
23+
script: |
24+
import requests
25+
from datetime import datetime, UTC
26+
from pytz import timezone
27+
from tqdm import tqdm
28+
29+
# Configuration
30+
endpoint = "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${{ matrix.project }}/deployments"
31+
expiration_days = 3
32+
headers = {
33+
"Content-Type": "application/json;charset=UTF-8",
34+
"Authorization": "Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}"
35+
}
36+
utc_tz = timezone('UTC')
37+
38+
# Fetch the list of deployments
39+
response = requests.get(endpoint, headers=headers)
40+
deployments = response.json()
41+
42+
for deployment in tqdm(deployments['result']):
43+
# Calculate the age of the deployment
44+
created_on = datetime.strptime(deployment['created_on'], "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=utc_tz)
45+
if (datetime.now(UTC) - created_on).days > expiration_days:
46+
# Delete the deployment
47+
delete_response = requests.delete(f"{endpoint}/{deployment['id']}", headers=headers)
48+
if delete_response.status_code == 200:
49+
print(f"Deleted deployment: {deployment['id']}")
50+
else:
51+
print(f"Failed to delete deployment: {deployment['id']}")
52+

.github/workflows/docs.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Cortex Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
# Review gh actions docs if you want to further define triggers, paths, etc
9+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
10+
schedule:
11+
- cron: "0 22 * * 1,2,3,4,5,6"
12+
13+
jobs:
14+
deploy:
15+
name: Deploy to Cloudflare Pages
16+
env:
17+
CLOUDFLARE_PROJECT_NAME: cortex-docs
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
deployments: write
22+
pull-requests: write
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: 18
28+
29+
- name: Install jq
30+
uses: dcarbone/install-jq-action@v2.0.1
31+
32+
- name: Fill env vars
33+
working-directory: docs
34+
continue-on-error: true
35+
run: |
36+
env_example_file=".env.example"
37+
touch .env
38+
while IFS= read -r line || [[ -n "$line" ]]; do
39+
if [[ "$line" == *"="* ]]; then
40+
var_name=$(echo $line | cut -d '=' -f 1)
41+
echo $var_name
42+
var_value="$(jq -r --arg key "$var_name" '.[$key]' <<< "$SECRETS")"
43+
echo "$var_name=$var_value" >> .env
44+
fi
45+
done < "$env_example_file"
46+
env:
47+
SECRETS: "${{ toJson(secrets) }}"
48+
49+
- name: Install dependencies
50+
working-directory: docs
51+
run: yarn install
52+
- name: Build website
53+
working-directory: docs
54+
run: export NODE_ENV=production && yarn build
55+
56+
- name: Copy redirect file
57+
working-directory: docs
58+
continue-on-error: true
59+
run: cp _redirects build/_redirects
60+
61+
- name: Publish to Cloudflare Pages PR Preview and Staging
62+
if: github.event_name == 'pull_request'
63+
uses: cloudflare/pages-action@v1
64+
with:
65+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
66+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
67+
projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }}
68+
directory: ./docs/build
69+
# Optional: Enable this if you want to have GitHub Deployments triggered
70+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
71+
id: deployCloudflarePages
72+
73+
- uses: mshick/add-pr-comment@v2
74+
if: github.event_name == 'pull_request'
75+
with:
76+
message: |
77+
Preview URL: ${{ steps.deployCloudflarePages.outputs.url }}
78+
79+
- name: Publish to Cloudflare Pages Production
80+
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/dev' && github.event.pull_request.head.repo.full_name != github.repository
81+
uses: cloudflare/pages-action@v1
82+
with:
83+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
84+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
85+
projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }}
86+
directory: ./docs/build
87+
branch: dev
88+
# Optional: Enable this if you want to have GitHub Deployments triggered
89+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ platform/package-lock.json
2020
platform/command
2121
platform/src/infrastructure/commanders/test/test_data
2222
**/vcpkg_installed
23-
engine/test.db
23+
engine/test.db
24+
!docs/yarn.lock

docs/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALGOLIA_APP_ID=***
2+
ALGOLIA_API_KEY=***
3+
GTM_ID=***

docs/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
22+
.env

docs/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.mdx
2+
*.hbs

docs/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
42+
43+
## Changelog Generator
44+
45+
To generate a changelog post, run:
46+
47+
```bash
48+
yarn create:changelog
49+
```
50+
51+
- **Title & Slug**: Generate changelog post files with a title and a slug.
52+
- **Description**: Add a description for the changelog post.
53+
- **Version**: Add a version for the changelog post.
54+
55+
The pages will be generated in `changelog/${slug}`. You can start writing your changelog post here.

docs/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
hide:
3+
- title
4+
title: "v0.5.0 cortex-cpp version to log"
5+
version: 0.5.0
6+
date: 2024-06-29
7+
ogImage: "/img/changelog/social-card.jpg"
8+
slug: "cortex-cpp-version-to-log"
9+
description: ''
10+
---
11+
12+
import ChangelogHeader from "@site/src/components/ChangelogHeader"
13+
14+
<ChangelogHeader slug="cortex-cpp-version-to-log" />
15+
16+
### Highlights 🎉
17+
- Add cortex-cpp version to log
18+
- Cortex cli as client - communicate with API server via cortexjs
19+
- Unsupported platform engine status
20+
- Update default api server config
21+
- Transform anthropic response
22+
- Github hotsted to macos selfhosted
23+
- Release and fix winget
24+
- Handle multi download model, uninstall script

0 commit comments

Comments
 (0)