feat(aichat): update AIChat configuration and add new roles

- Renamed `aichatConfigDir` to `configDir`
- Updated the content of `config.yaml` with new models and types, increased maximum tokens for some models, and removed unnecessary configurations
- Added `roles.yaml` file with new roles for generating commit messages and pull request descriptions based on git diffs and commit messages
This commit is contained in:
Giulio De Pasquale 2024-06-04 22:52:51 +01:00
parent d76ccbe564
commit e5703ed0c2

View File

@ -1,34 +1,117 @@
{ pkgs, ... }:
let
aichatConfigDir = "$HOME/.config/aichat";
aichatConfig = ''
model: ollama
configDir = "$HOME/.config/aichat";
config = ''
clients:
- type: ollama
api_base: https://ollama.giugl.io
api_key: null
models:
- name: pino
max_input_tokens: null
- name: code-commenter
max_input_tokens: 32000
- name: git-commit-message
- name: mistral:7b-instruct-v0.3-fp16
max_input_tokens: 32000
max_output_tokens: 8192
- type: claude
api_key: null
- name: llama3:8b-instruct-fp16
max_input_tokens: 8192
max_output_tokens: 8192
- name: phi3:14b-medium-4k-instruct-q8_0
max_input_tokens: 128000
max_output_tokens: 8192
- name: codestral:22b-v0.1-q6_K
max_input_tokens: 32000
max_output_tokens: 8192
- type: openai
api_key: null
api_base: https://api.openai.com/v1
'';
roles = ''
- name: commitmessage
prompt: |-
The task is to generate a commit message for a given git diff. The commit message should follow the Commit Convention, which typically includes a type, scope, and a brief description. The types can be `feat` (for new features), `fix` (for bug fixes), `docs` (for documentation changes), `style` (for code formatting changes), `refactor` (for code restructuring), `test` (for adding or updating tests), `chore` (for maintenance tasks), and `perf` (for performance improvements).
**Commit Convention Format:**
```
<type>(<scope>): <description>
- <bullet points details>
```
The description should be concise, unambiguos yet capture the technical details of the changes made. The output should exclusively be the commit message.
### INPUT:
```
diff --git a/src/app.js b/src/app.js
index 83d2e7a..b6a1c3f 100644
--- a/src/app.js
+++ b/src/app.js
@@ -10,6 +10,10 @@ function initialize() {
setupEventListeners();
}
+// TODO: add other listeners
+// https://github.com/user/project/issue/123
+function setupEventListeners() {
+ document.getElementById('submit').addEventListener('click', handleSubmit);
+ document.getElementById('reset').addEventListener('click', handleReset);
+}
+
function handleSubmit(event) {
event.preventDefault();
const data = new FormData(event.target);
@@ -20,6 +24,10 @@ function handleSubmit(event) {
console.log('Form submitted:', data);
}
+function handleReset(event) {
+ event.preventDefault();
+ event.target.form.reset();
+ console.log('Form reset');
}
```
### OUTPUT:
```
feat(app): add event listeners for submit and reset buttons
- Added `setupEventListeners` function to handle submit and reset button click events
- Implemented `handleReset` function to reset the form and log the action
- Added TODO comment for issue #123
```
- name: createpr:diff:messages
prompt: |-
You are an AI language model tasked with generating a comprehensive Pull Request (PR) description. Your goal is to create a clear and informative PR description that summarizes the changes and highlights any important details or considerations.
You are given a git diff and a list of commits - use this context to generate the PR message.
# Requirements for the PR Description:
1. **Title:** Provide a concise and descriptive title for the PR.
2. **Summary:** Summarize the overall purpose and scope of the changes.
3. **Details of Changes:** Describe the key changes made, referencing specific files or functions if necessary.
4. **Impact:** Discuss any potential impact on the system, including backward compatibility, performance implications, and any new dependencies.
### Input: Git diff
__ARG1__
### Input: Commit messages
__ARG2__
'';
in
{
home = {
sessionVariables = {
AICHAT_CONFIG_DIR = aichatConfigDir;
AICHAT_CONFIG_DIR = configDir;
};
packages = [ pkgs.unstablePkgs.aichat ];
file.".config/aichat/config.yaml".text = aichatConfig;
file.".config/aichat/config.yaml".text = config;
file.".config/aichat/roles.yaml".text = roles;
};
}