From 1a19361854e74b994fc75e08022e40350c92eea2 Mon Sep 17 00:00:00 2001 From: NHPT <42366434+NHPT@users.noreply.github.com> Date: Sat, 31 Aug 2024 16:05:20 +0800 Subject: [PATCH 1/4] Create SECURITY.md --- SECURITY.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..034e848032 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. From d8fb01b6faf11376076c2254b5c004537e410613 Mon Sep 17 00:00:00 2001 From: NHPT <42366434+NHPT@users.noreply.github.com> Date: Sat, 31 Aug 2024 16:05:57 +0800 Subject: [PATCH 2/4] Create codeql.yml --- .github/workflows/codeql.yml | 92 ++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..a343d195fb --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,92 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + schedule: + - cron: '22 16 * * 0' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 9f803f026d611e30c6ed62b754ea8667ed4c7b64 Mon Sep 17 00:00:00 2001 From: NHPT <42366434+NHPT@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:17:48 +0800 Subject: [PATCH 3/4] Create README_CN.md --- README_CN.md | 353 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 353 insertions(+) create mode 100644 README_CN.md diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 0000000000..4d03e48f7a --- /dev/null +++ b/README_CN.md @@ -0,0 +1,353 @@ +# Jan - 把你的电脑变成人工智能电脑 + +![Jan banner](https://github.com/janhq/jan/assets/89722390/35daac7d-b895-487c-a6ac-6663daaad78e) + +

+ + GitHub commit activity + Github Last Commit + Github Contributors + GitHub closed issues + Discord +

+ +

+ 入门 + - 文档 + - 变更日志 + - Bug 报告 + - 讨论 + - English +

+ +>[!Warning] +>**Jan目前正在开发中**: 预计会有破坏性变更和错误! + +Jan 是一个开源的ChatGPT替代品,在您的计算机上100%离线运行。 + +**Jan可以在任何硬件上运行。** 从PC到多GPU集群,Jan支持通用架构: + +- [x] NVIDIA GPUs (fast) +- [x] Apple M-series (fast) +- [x] Apple Intel +- [x] Linux Debian +- [x] Windows x64 + +## 下载 + + + + + + + + + + + + + + + + + + + + + + + + +
版本类型WindowsMacOSLinux
稳定版(推荐) + + + jan.exe + + + + + Intel + + + + + M1/M2/M3/M4 + + + + + jan.deb + + + + + jan.AppImage + +
实验版(每晚构建) + + + jan.exe + + + + + Intel + + + + + M1/M2/M3/M4 + + + + + jan.deb + + + + + jan.AppImage + +
+ +在 https://jan.ai/ 页面下载 Jan 的最新版本或访问 **[GitHub Releases](https://github.com/janhq/jan/releases)** 下载任何以前的版本。 +## 演示 + +![Demo](/demo.gif) + +_实时视频: Jan v0.4.3-nightly on a Mac M1, 16GB Sonoma 14_ + +## 快速链接 + +#### Jan + +- [Jan website](https://jan.ai/) +- [Jan GitHub](https://github.com/janhq/jan) +- [User Guides](https://jan.ai/guides/) +- [Developer docs](https://jan.ai/developer/) +- [API reference](https://jan.ai/api-reference/) +- [Specs](https://jan.ai/docs/) + +#### Nitro + +Nitro 是一个轻量级和可嵌入的用于边缘计算的高效 C++ 推理引擎。它可以在您自己的项目中单独使用。 + +- [Nitro Website](https://nitro.jan.ai) +- [Nitro GitHub](https://github.com/janhq/nitro) +- [Documentation](https://nitro.jan.ai/docs) +- [API Reference](https://nitro.jan.ai/api-reference) + +## 故障排除 + +由于Jan处于开发模式,您可能会被困在一个损坏的构建上。 + +要重置安装,请执行以下操作: + +1. 使用以下命令删除任何挂起的后端进程: + + ```sh + ps aux | grep nitro + ``` + + 查找“nitro”和“nitro_arm_64”等进程,并用以下命令逐一杀死它们: + + ```sh + kill -9 + ``` + +2. **从“应用程序”目录和“缓存”目录中删除 Jan** + + ```bash + make clean + ``` + + 这将删除所有构建工件和缓存文件: + + - 从`~/Jan/dextensions`目录中删除Jan扩展名 + - 在当前目录删除所有 `node_modules` + - 清除应用程序缓存 `~/Library/Caches/jan` + +## 运行 Jan 的要求 + +- MacOS: 13 或更高版本 +- Windows: + - Windows 10 或更高版本 + - To enable GPU support: + - Nvidia GPU with CUDA Toolkit 11.7 或更高版本 + - Nvidia driver 470.63.01 或更高版本 +- Linux: + - glibc 2.27 或更高版本 (使用`ldd --version`命令进行检查) + - gcc 11, g++ 11, cpp 11 或更高版本, 有关更多信息,请参阅此内容 [link](https://jan.ai/guides/troubleshooting/gpu-not-used/#specific-requirements-for-linux) + - 启用 GPU 支持: + - Nvidia GPU with CUDA Toolkit 11.7 或更高版本 + - Nvidia driver 470.63.01 或更高版本 + +## 贡献 + +欢迎贡献!请阅读 [CONTRIBUTING.md](CONTRIBUTING.md) 文件 + +### 先决条件 + +- node >= 20.0.0 +- yarn >= 1.22.0 +- make >= 3.81 + +### 说明 + +1. **克隆存储库并准备:** + + ```bash + git clone https://github.com/janhq/jan + cd jan + git checkout -b DESIRED_BRANCH + ``` + +2. **运行开发服务器并使用 Jan 桌面版** + + ```bash + make dev + ``` + +这将启动开发服务器并打开桌面应用程序。 + +3. (可选) **运行不带前端的 API 服务器** + + ```bash + yarn dev:server + ``` + +### 用于生产建设 + +```bash +# 执行上一节中的步骤 1 和 2 +# 构建应用程序 +make build +``` + +这将构建用于生产的应用程序 MacOS m1/m2(已完成代码签名),并将结果放入`dist`目录中。 + +### Docker 模式 + +- 支持的操作系统: Linux, WSL2 Docker +- 先决条件: + + - 在 Docker 模式下运行 Jan 需要 Docker Engine 和 Docker Compose。 按照以下 [说明](https://docs.docker.com/engine/install/ubuntu/) 在 Ubuntu 上开始使用 Docker Engine。 + + ```bash + curl -fsSL https://get.docker.com -o get-docker.sh + sudo sh ./get-docker.sh --dry-run + ``` + + - 如果你打算在GPU模式下运行Jan,你需要安装 `nvidia-driver` 和 `nvidia-docker2` 驱动程序. Follow the instruction [here](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) for installation. + +- 在 Docker 模式下运行 Jan + > User can choose between `docker-compose.yml` with latest prebuilt docker image or `docker-compose-dev.yml` with local docker build + > 用户可以通过`docker-compose.yml`选择使用最新预构建的docker镜像,或通过`docker-compose-dev.yml`使用本地 docker 构建。 + +| Docker compose 配置文件 | 描述 | +| ---------------------- | -------------------------------------------- | +| `cpu-fs` | 使用默认文件系统在 CPU 模式下运行 Jan | +| `cpu-s3fs` | 使用 S3 文件系统在 CPU 模式下运行 Jan | +| `gpu-fs` | 使用默认文件系统以 GPU 模式运行 Jan | +| `gpu-s3fs` | 使用 S3 文件系统以 GPU 模式运行 Jan | + +| 环境变量 |描述 | +| ----------------------- | ------------------------------------------------------------------------------------------------------- | +| `S3_BUCKET_NAME` | S3 存储桶名称 - 对于默认文件系统留空 | +| `AWS_ACCESS_KEY_ID` | AWS 访问密钥 ID - 对于默认文件系统留空 | +| `AWS_SECRET_ACCESS_KEY` | AWS 秘密访问密钥 - 对于默认文件系统留空 | +| `AWS_ENDPOINT` | AWS 端点 URL - 对于默认文件系统留空 | +| `AWS_REGION` | AWS 区域 - 默认文件系统留空 | +| `API_BASE_URL` | Jan Server URL,请修改为你的公网ip地址或者域名 默认为: http://localhost:1377 | + +- **选项 1**: 在 CPU 模式下运行 Jan + + ```bash + # 默认文件系统的cpu模式 + docker compose --profile cpu-fs up -d + + # S3文件系统的cpu模式 + docker compose --profile cpu-s3fs up -d + ``` + +- **选项 2**: 在 GPU 模式下运行 Jan + + - **步骤 1**: 通过运行 `NVIDIA-smi` 检查 CUDA 与 NVIDIA 驱动程序的兼容性,并在输出中检查 CUDA 版本 + + ```bash + nvidia-smi + + # Output + +---------------------------------------------------------------------------------------+ + | NVIDIA-SMI 531.18 Driver Version: 531.18 CUDA Version: 12.1 | + |-----------------------------------------+----------------------+----------------------+ + | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | + | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | + | | | MIG M. | + |=========================================+======================+======================| + | 0 NVIDIA GeForce RTX 4070 Ti WDDM | 00000000:01:00.0 On | N/A | + | 0% 44C P8 16W / 285W| 1481MiB / 12282MiB | 2% Default | + | | | N/A | + +-----------------------------------------+----------------------+----------------------+ + | 1 NVIDIA GeForce GTX 1660 Ti WDDM | 00000000:02:00.0 Off | N/A | + | 0% 49C P8 14W / 120W| 0MiB / 6144MiB | 0% Default | + | | | N/A | + +-----------------------------------------+----------------------+----------------------+ + | 2 NVIDIA GeForce GTX 1660 Ti WDDM | 00000000:05:00.0 Off | N/A | + | 29% 38C P8 11W / 120W| 0MiB / 6144MiB | 0% Default | + | | | N/A | + +-----------------------------------------+----------------------+----------------------+ + + +---------------------------------------------------------------------------------------+ + | Processes: | + | GPU GI CI PID Type Process name GPU Memory | + | ID ID Usage | + |=======================================================================================| + ``` + + - **步骤 2**: 查看 [NVIDIA NGC Catalog ](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags) 并找到与您的 CUDA 版本匹配的镜像标签的最小次要版本 (例如: 12.1 -> 12.1.0) + + - **步骤 3**: 使用步骤 2 中镜像标签的最新次要版本更新 `Dockerfile.gpu` 第 5 行 (例如: 将 `FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 AS base` 改为 `FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 AS base`) + + - **步骤 4**: 运行命令在 GPU 模式下启动 Jan + + ```bash + # 默认文件系统的 GPU 模式 + docker compose --profile gpu-fs up -d + + # S3文件系统的 GPU 模式 + docker compose --profile gpu-s3fs up -d + ``` + +这将启动web服务器,您可以通过`http://localhost:3000`访问 Jan。 + +> 注意: s3fs 的 Docker 模式尚不支持 RAG 功能。 + +## 致谢 + +Jan 在以下开源项目的基础上进行构建: + +- [llama.cpp](https://github.com/ggerganov/llama.cpp) +- [LangChain](https://github.com/langchain-ai) +- [TensorRT](https://github.com/NVIDIA/TensorRT) +- [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM) + +## 联系我们 + +- Bugs & 请求: 提交GitHub票证 +- 讨论: 点击此处 [加入我们的 Discord](https://discord.gg/FTk2MvZwJH) +- 商业咨询请发邮件至: hello@jan.ai +- 求职请发邮件至: email hr@jan.ai + +## 信任与安全 + +谨防诈骗。 + +- 我们绝不会向您索要个人信息 +- 我们是免费产品;没有付费版本 +- 我们没有代币或 ICO +- 我们没有积极筹款或寻求捐赠 + +## 许可证 + +Jan 是免费且开源的,遵循 AGPLv3 许可。 From c00eb658df19be6feca37006f90ed550c469d4e3 Mon Sep 17 00:00:00 2001 From: NHPT <42366434+NHPT@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:19:33 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e1622b0812..ddeaf52165 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - Changelog - Bug reports - Discord + - 简体中文

>[!Warning]