nixos/roles/home/aichat.nix

161 lines
5.9 KiB
Nix

{ pkgs, ... }:
let
configDir = "$HOME/.config/aichat";
config = ''
clients:
- type: ollama
api_base: https://ollama.giugl.io
models:
- name: mistral:7b-instruct-v0.3-fp16
max_input_tokens: 32000
max_output_tokens: 8192
- 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: pino-coder
max_input_tokens: 28000
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 https://github.com/user/project/issue/123
```
- name: createpr
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:
```
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:
**Title:** feat(app): add event listeners for submit and reset buttons
**Summary:**
This PR adds event listeners for the submit and reset buttons in the application. It introduces a new function to set up these event listeners and implements a handler for the reset button.
**Details of Changes:**
1. **src/app.js:**
- Added a new function `setupEventListeners` to attach click event listeners to the submit and reset buttons.
- Implemented the `handleReset` function to reset the form and log the reset action.
- Included a TODO comment to add other listeners, referencing issue [#123](https://github.com/user/project/issue/123).
**Impact:**
- **Backward Compatibility:** The changes are backward compatible.
- **Performance Implications:** Minimal performance impact due to the addition of event listeners.
- **New Dependencies:** No new dependencies introduced.
'';
in
{
home = {
sessionVariables = {
AICHAT_CONFIG_DIR = configDir;
};
packages = [ pkgs.unstablePkgs.aichat ];
file.".config/aichat/config.yaml".text = config;
file.".config/aichat/roles.yaml".text = roles;
};
}