Skip to content

Commit

Permalink
feat(cz-git,cli): add aiType option to switch openAI model (#102)
Browse files Browse the repository at this point in the history
Choose the AI model you want to use: `openAI-Turbo` | `openAI-Davinci`

- gpt-3.5-turbo: Lower price consumption (10x) and faster
- text-davinci-003: Get more reliable information

closed #101
  • Loading branch information
Zhengqbbb authored Mar 11, 2023
1 parent 9501d95 commit e956ca0
Show file tree
Hide file tree
Showing 16 changed files with 708 additions and 161 deletions.
12 changes: 12 additions & 0 deletions docs/config/engineer.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ Try running command to **select multiple results returned by OpenAI in the curre
Demo And Usage [⇒ see the recipes](/recipes/openai)
:::

## aiType

- **description** : Choose the AI model you want to use

| aiType                         | Model                         | Description |
| --- | --- | --- |
| openAI-Turbo | gpt-3.5-turbo | faster and optimized for chat at 1/10th the cost of `text-davinci-003` |
| openAI-Davinci | text-davinci-003 | better quality, longer output, and consistent instruction-following |

- **type** : `"openAI-Turbo" | "openAI-Davinci"`
- **default** : `openAI-Turbo`

## aiDiffIgnore

- **description** : To ignore selection diff codes when sending AI API requests
Expand Down
15 changes: 11 additions & 4 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,22 +269,29 @@ module.exports = {
- `commitlint` field in `package.json`
- `config.commitizen` field in `package.json`

<script setup>
import { useData } from 'vitepress'

const { site } = useData()
const v = site.value.themeConfig.nav?.[4]?.text.slice(1)
</script>

::: tip
- JSON $schema URL (Only support .czrc|or specified czConfig JSON configure):

```
https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@main/docs/public/schema/cz-git-1.5.3.json
```-vue
https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@{{ v }}/docs/public/schema/cz-git.json
```

- It is recommended to use JavaScript for configuration files in the **project**. You can combine `fs` and `path` to select [scopes](/recipes/#scopes) for generating dynamic modules.
:::

::: details Click to expand `JSON` default configuration template

```json
```json-vue
// .czrc | package.json | .commitlintrc(need "prompt" key)
{
// (.czrc|specified czConfig JSON configure) "$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@main/docs/public/schema/cz-git-1.5.3.json",
// (.czrc|specified czConfig JSON configure) "$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@{{ v }}/docs/public/schema/cz-git.json",
"alias": { "fd": "docs: fix typos" },
"messages": {
"type": "Select the type of change that you're committing:",
Expand Down
11 changes: 9 additions & 2 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,15 @@ npm install -g cz-git commitizen

#### Step 2: Global configuration adapter type

```sh
echo '{ "path": "cz-git", "$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@main/docs/public/schema/cz-git-1.5.3.json" }' > ~/.czrc
<script setup>
import { useData } from 'vitepress'

const { site } = useData()
const v = site.value.themeConfig.nav?.[4]?.text.slice(1)
</script>

```sh-vue
echo '{ "path": "cz-git", "$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@{{ v }}/docs/public/schema/cz-git.json" }' > ~/.czrc
```

#### Step 3: Add custom configuration (optional, use default configuration)
Expand Down
Loading

0 comments on commit e956ca0

Please sign in to comment.