Skip to content

Commit

Permalink
docs: add ai assistant doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinesmilelk committed Nov 1, 2024
1 parent d61bc6b commit b7fb7cc
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 33 deletions.
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ Language: English | [简体中文](./README_zh.md)

## Quick Start

You need to install [libro-server](https://github.com/difizen/libro-server) to fully explore the capabilities of libro.

use pip:

```bash
Expand All @@ -69,28 +67,31 @@ Libro is fully modular, giving you the flexibility to choose from its native cap

You can assemble different modules based on your needs to build your own notebook product. For example, you might integrate only the editor-related modules into an IDE or other development environments, or bring in more modules to create a lab-style solution.

You need to install at least jupyter-server to run libro, which will give you access to the features of Jupyter Notebook. If you want to leverage the additional capabilities defined by libro, you'll need to install libro-server.

For more details, please refer to [quick integration](./apps/docs/docs/integration/index.md)

### Component-Based Consumption
## New Features

```typescript
import { ManaComponents } from '@difizen/mana-app';
import { LibroJupyterModule } from "@difizen/libro-jupyter";
### AI Capability

<ManaComponents.Application
modules={[LibroJupyterModule]}
renderChildren
>
<LibroComponent options={{ id: 'identify' }} />
</ManaComponents.Application>
```
- Error Fixing

- Application: The mana context container, which is recommended to be placed at the outer layer of the application, allowing multiple libro instances to share the context.
- LibroComponent:The libro view component, which allows you to embed the libro view anywhere.
![image](./apps/docs/public/error_debug.gif)

## New Features
- Chat
- Contextual Chat in Cells
![image](./apps/docs/public/cell_ai.gif)

- General AI Chat
![image](./apps/docs/public/ai_chat.gif)

- Code Explanation

![image](./apps/docs/public/code_explain.gif)

- Code Optimization

![image](./apps/docs/public/code_optimize.gif)

### Prompt Cell

Expand Down
35 changes: 19 additions & 16 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@

## 快速开始

您需要安装 [libro-server](https://github.com/difizen/libro-server) 来体验完整的 libro 能力。

使用 pip:

```bash
Expand All @@ -74,24 +72,29 @@ libro 是完全模块化的,您可以自由选择 libro 提供的原生能力

详情请阅读[快速集成](./apps/docs/docs/integration/index.md)

### 组件化消费

```typescript
import { ManaComponents } from '@difizen/mana-app';
import { LibroJupyterModule } from "@difizen/libro-jupyter";
## 新特性

<ManaComponents.Application
modules={[LibroJupyterModule]}
renderChildren
>
<LibroComponent options={{ id: 'identify' }} />
</ManaComponents.Application>
```
### AI 能力

- Application: mana 上下文容器,建议放在应用的外层,多个 libro 示例可以共享上下文。
- LibroComponent:libro 视图组件,可以将 libro 视图嵌入到任意位置。
- 错误修复

## 新特性
![image](./apps/docs/public/error_debug_zh.gif)

- AI 对话
- 基于 Cell 上下文对话
![image](./apps/docs/public/cell_ai_zh.gif)

- 通用对话
![image](./apps/docs/public/ai_chat_zh.gif)

- 代码解释

![image](./apps/docs/public/code_explain_zh.gif)

- 代码优化

![image](./apps/docs/public/code_optimize_zh.gif)

### Prompt Cell

Expand Down
55 changes: 55 additions & 0 deletions apps/docs/docs/manual/ai-assistant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: AI 编程助手指南
order: 3
---

## 准备工作

`~/.libro/libro_config.yaml` 配置大模型相关配置

其中,目前支持的模型有:

- OpenAI 相关:`gpt-4``gpt-3.5-turbo``text-davinci-003`
- 通义千问相关:`qwen-max``qwen-plus``qwen-turbo`

配置默认的模型和 Key:

```yaml
llm:
DASHSCOPE_API_KEY: xxx # Qwen 相关的模型 key
OPENAI_API_KEY: xxx # OpenAI 相关的模型 key
default_model: qwen-max
```
> <span style="font-style: normal;">💡 **Tip**: 如果使用通义千问作为默认模型,请使用`pip install dashscope --upgrade`安装依赖.
> </span>

## 报错修复

当 Cell 执行出现报错时,点击 “Fix with AI” 按钮,助手会自动分析错误并给出修复建议,点击“取消”按钮退出报错修复模式。

<img src="../../public/error_debug_zh.gif" alt="alt text" width="1000" >

## AI 对话

### Cell 上下文对话

从 Cell 右侧工具栏对话按钮唤起,你可以直接与 AI 进行互动,获得与当前代码相关的深入解答和优化建议,提升编程效率。

<img src="../../public/cell_ai_zh.gif" alt="alt text" width="1000" >

### 通用对话

从顶部右侧工具栏唤起,你可以与 AI 进行开放式对话,询问编程相关问题,获取建议和信息,享受智能互动的乐趣。

<img src="../../public/ai_chat_zh.gif" alt="alt text" width="1000" >

### 代码解释

从 Cell 右侧工具栏的魔法符号唤起,帮助理解 Cell 中代码的功能和逻辑。
<img src="../../public/ai_chat_zh.gif" alt="alt text" width="1000" >

### 代码优化

从 Cell 右侧工具栏的魔法符号唤起,分析单元格(cell)中的代码,并提供优化建议。
<img src="../../public/code_optimize_zh.gif" alt="alt text" width="1000" >
Loading

0 comments on commit b7fb7cc

Please sign in to comment.