2024-05-27 13:38:59 +01:00
|
|
|
{ pkgs, ... }:
|
|
|
|
let
|
2024-06-04 22:52:51 +01:00
|
|
|
configDir = "$HOME/.config/aichat";
|
|
|
|
|
|
|
|
config = ''
|
2024-05-27 13:38:59 +01:00
|
|
|
clients:
|
2024-06-04 22:52:51 +01:00
|
|
|
- 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
|
|
|
|
|
2024-06-07 10:04:16 +01:00
|
|
|
- name: pino-coder
|
2024-07-25 23:26:40 +01:00
|
|
|
max_input_tokens: 8192
|
2024-06-04 22:52:51 +01:00
|
|
|
max_output_tokens: 8192
|
|
|
|
|
|
|
|
- type: openai
|
|
|
|
api_key: null
|
|
|
|
api_base: https://api.openai.com/v1
|
|
|
|
'';
|
|
|
|
|
2024-07-01 18:18:39 +01:00
|
|
|
roles = ''
|
|
|
|
- name: commitmessage
|
|
|
|
prompt: |-
|
|
|
|
Your task is to generate a commit message for a given git diff. The commit message should follow the Conventional Commits specification, which includes a type, optional scope, and a brief description. The message should be concise, unambiguous, and capture the technical details of the changes made.
|
|
|
|
|
|
|
|
Commit Convention Format:
|
|
|
|
<type>(<scope>): <description>
|
|
|
|
|
|
|
|
[optional body]
|
|
|
|
|
|
|
|
[optional footer(s)]
|
|
|
|
|
|
|
|
Common types include:
|
|
|
|
- feat: A new feature
|
|
|
|
- fix: A bug fix
|
|
|
|
- docs: Documentation changes
|
|
|
|
- style: Code style/formatting changes (not affecting code logic)
|
|
|
|
- refactor: Code changes that neither fix a bug nor add a feature
|
|
|
|
- test: Adding or modifying tests
|
|
|
|
- chore: Changes to build process or auxiliary tools
|
|
|
|
- perf: Performance improvements
|
|
|
|
|
|
|
|
Here are some examples of well-formatted commit messages:
|
|
|
|
|
|
|
|
### INPUT :
|
|
|
|
|
|
|
|
diff --git a/src/utils/date-formatter.js b/src/utils/date-formatter.js
|
|
|
|
index 2345678..3456789 100644
|
|
|
|
--- a/src/utils/date-formatter.js
|
|
|
|
+++ b/src/utils/date-formatter.js
|
|
|
|
@@ -5,7 +5,7 @@ export function formatDate(date) {
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
const day = String(date.getDate()).padStart(2, '0');
|
2024-07-01 18:20:31 +01:00
|
|
|
- return `$${year}-$${month}-$${day}`;
|
|
|
|
+ return `$${year}/$${month}/$${day}`;
|
2024-07-01 18:18:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
### OUTPUT:
|
|
|
|
|
2024-07-01 18:34:08 +01:00
|
|
|
fix(date-formatter): modified `formatDate()` to use '/' instead of '-' as the separator
|
2024-07-01 18:18:39 +01:00
|
|
|
|
|
|
|
### 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): implement form event listeners
|
|
|
|
|
|
|
|
- Added `setupEventListeners()` to handle form interactions
|
2024-07-01 18:30:11 +01:00
|
|
|
- Implemented `handleReset()` for form reset functionality
|
2024-07-01 18:18:39 +01:00
|
|
|
- Added event listeners for submit and reset buttons
|
2024-07-01 18:34:08 +01:00
|
|
|
- Track TODO comment for future listener additions (https://github.com/user/project/issue/123)
|
2024-07-01 18:18:39 +01:00
|
|
|
|
|
|
|
### INPUT:
|
|
|
|
|
2024-07-02 15:07:16 +01:00
|
|
|
diff --git a/pkg/database/client.go b/pkg/database/client.go
|
|
|
|
index 003740f..6fc4861 100644
|
|
|
|
--- a/pkg/database/client.go
|
|
|
|
+++ b/pkg/database/client.go
|
|
|
|
@@ -24,9 +24,12 @@ var ErrNilDatabaseClient = errors.New("database client is nil after setup")
|
|
|
|
|
|
|
|
// InitDB initializes the database with the given application name and optional dbpath for SQLite.
|
|
|
|
func InitDB(appName string, dbpath ...string) error {
|
|
|
|
- cfg := config.New()
|
|
|
|
+ var (
|
|
|
|
+ psqlReadReplica string
|
|
|
|
+ err error
|
|
|
|
+ )
|
|
|
|
|
|
|
|
- var err error
|
|
|
|
+ cfg := config.New()
|
|
|
|
|
|
|
|
// Set up a new logger with your required configuration.
|
|
|
|
newLogger := logger.New(
|
|
|
|
@@ -38,9 +41,8 @@ func InitDB(appName string, dbpath ...string) error {
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
- // Load PostgreSQL configurations
|
|
|
|
- var psqlReadReplica string
|
|
|
|
psqlSource, err := cfg.Load(config.PSQL.String())
|
|
|
|
+
|
|
|
|
if err != nil {
|
|
|
|
log.Println("PSQL not set, using SQLite instead.")
|
|
|
|
} else {
|
|
|
|
|
|
|
|
### OUTPUT:
|
|
|
|
|
|
|
|
style(database/client): group together `psqlReadReplica` and `err` in function's prologue
|
|
|
|
|
|
|
|
### INPUT:
|
|
|
|
|
2024-07-02 15:20:14 +01:00
|
|
|
diff --git a/pkg/khttp/client.go b/pkg/khttp/client.go
|
|
|
|
index a53064c..3aff938 100644
|
|
|
|
--- a/pkg/khttp/client.go
|
|
|
|
+++ b/pkg/khttp/client.go
|
|
|
|
@@ -11,14 +11,17 @@ import (
|
2024-07-01 18:40:29 +01:00
|
|
|
"github.pie.apple.com/kerosene/Core/structs"
|
|
|
|
)
|
|
|
|
|
2024-07-02 15:20:14 +01:00
|
|
|
+// TODO: https://github.pie.apple.com/Kerosene/Core/issues/43
|
|
|
|
+// feat: Centralise and remove over use of os.Environment
|
|
|
|
const (
|
|
|
|
- // Environment variables and file names.
|
|
|
|
authFilesDirEnvVar = "WHISPER_AUTH_FILES_DIR"
|
|
|
|
keyName = "decrypted_key.pem"
|
|
|
|
certName = "cert.pem"
|
|
|
|
)
|
2024-07-01 18:40:29 +01:00
|
|
|
|
2024-07-02 15:20:14 +01:00
|
|
|
// Error for missing environment variable.
|
|
|
|
+// TODO: refactor: move errors into centralized errors.go files
|
|
|
|
+// https://github.pie.apple.com/Kerosene/Core/issues/57
|
|
|
|
var errMissingEnvironmentVariable = fmt.Errorf("%s environment variable is not set", authFilesDirEnvVar)
|
2024-07-01 18:40:29 +01:00
|
|
|
|
2024-07-02 15:20:14 +01:00
|
|
|
// AuthConfig holds authentication file paths.
|
|
|
|
@@ -31,9 +34,11 @@ type AuthConfig struct {
|
|
|
|
// NewAuthConfig creates an AuthConfig from environment variables.
|
|
|
|
func NewAuthConfig() (*AuthConfig, error) {
|
|
|
|
dir := os.Getenv(authFilesDirEnvVar)
|
2024-07-01 18:40:29 +01:00
|
|
|
+
|
2024-07-02 15:20:14 +01:00
|
|
|
if dir == "" {
|
|
|
|
return nil, errMissingEnvironmentVariable
|
|
|
|
}
|
|
|
|
+
|
|
|
|
return &AuthConfig{
|
|
|
|
Dir: dir,
|
|
|
|
CertFile: filepath.Join(dir, certName),
|
|
|
|
@@ -211,7 +216,7 @@ func setupMTLSOnlyTransport(certData string, keyData string) (*http.Transport, e
|
2024-07-01 18:40:29 +01:00
|
|
|
|
2024-07-02 15:20:14 +01:00
|
|
|
// Make scheme and Auth Type separate and load from DB.
|
|
|
|
func parseProxyURL(scheme string, routing structs.Routing) (*url.URL, error) {
|
|
|
|
- return url.Parse(fmt.Sprintf("%s://%s:%s", scheme, routing.Proxy, routing.Port))
|
|
|
|
+ return url.Parse(fmt.Sprintf("%s://%s:%d", scheme, routing.Proxy, routing.Port))
|
2024-07-01 18:18:39 +01:00
|
|
|
}
|
2024-07-02 15:20:14 +01:00
|
|
|
|
|
|
|
// loadX509KeyPair loads an X509 key pair from the specified cert and key files.
|
2024-07-01 18:18:39 +01:00
|
|
|
|
|
|
|
### OUTPUT:
|
|
|
|
|
2024-07-02 15:20:14 +01:00
|
|
|
fix/refactor(khttp/client): use correct format specifier for and add TODOs
|
2024-07-01 18:40:29 +01:00
|
|
|
|
2024-07-02 15:20:14 +01:00
|
|
|
- Parsed proxy URL using `fmt.Sprintf()` with correct format specifier for port
|
|
|
|
- Added TODOs to centralize errors and remove overuse of `os.Environment` (#43, #57)
|
2024-07-01 18:40:29 +01:00
|
|
|
|
2024-06-04 22:52:51 +01:00
|
|
|
|
2024-07-01 18:26:31 +01:00
|
|
|
- name: createpr
|
|
|
|
prompt: |-
|
2024-07-03 10:18:00 +01:00
|
|
|
Create a concise and informative PR message for a given code diff using the Conventional Commits format.
|
|
|
|
Include all significant changes, such as new environment variables, refactored functions, and added or removed TODOs.
|
|
|
|
Mention specific issue numbers for better trackability.
|
2024-05-27 13:38:59 +01:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
|
|
|
home = {
|
|
|
|
sessionVariables = {
|
2024-06-04 22:52:51 +01:00
|
|
|
AICHAT_CONFIG_DIR = configDir;
|
2024-05-27 13:38:59 +01:00
|
|
|
};
|
|
|
|
packages = [ pkgs.unstablePkgs.aichat ];
|
2024-06-04 22:52:51 +01:00
|
|
|
file.".config/aichat/config.yaml".text = config;
|
|
|
|
file.".config/aichat/roles.yaml".text = roles;
|
2024-05-27 13:38:59 +01:00
|
|
|
};
|
|
|
|
}
|