From 176cc2201871d0f87fab75b023acb2e0df47e8bc Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Sun, 15 Jun 2025 12:44:19 +0300 Subject: [PATCH] Fix JavaDoc. Task priority system. Better precision for computing AI tasks. --- .../eu/svjatoslav/alyverkko_cli/AiTask.java | 13 +- .../eu/svjatoslav/alyverkko_cli/Command.java | 6 +- .../eu/svjatoslav/alyverkko_cli/Utils.java | 6 +- .../commands/JoinFilesCommand.java | 14 - .../commands/ListModelsCommand.java | 6 +- .../alyverkko_cli/commands/WizardCommand.java | 5 +- .../MailCorrespondentCommand.java | 249 ++++++++++++++---- .../mail_correspondant/MailQuery.java | 2 + .../mail_correspondant/package-info.java | 3 +- .../alyverkko_cli/commands/package-info.java | 3 +- .../configuration/Configuration.java | 5 +- .../configuration/ConfigurationHelper.java | 3 +- .../configuration/package-info.java | 3 +- .../svjatoslav/alyverkko_cli/model/Model.java | 6 +- .../alyverkko_cli/model/package-info.java | 3 +- .../alyverkko_cli/package-info.java | 4 +- 16 files changed, 221 insertions(+), 110 deletions(-) diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/AiTask.java b/src/main/java/eu/svjatoslav/alyverkko_cli/AiTask.java index 06bbc74..8df6bd7 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/AiTask.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/AiTask.java @@ -10,7 +10,7 @@ import static java.lang.String.join; /** *

Executes AI inference tasks through llama.cpp CLI. This class handles the complete workflow - * from prompt construction to response formatting, including temporary file management and process execution.

+ * from prompt construction to response formatting, including temporary file management and process execution. *

Key processing steps: *

    *
  1. Build standardized input prompt
  2. @@ -19,9 +19,9 @@ import static java.lang.String.join; *
  3. Capture and filter output
  4. *
  5. Perform cleanup operations
  6. *
- *

+ * *

Temperature settings, context size, and thread counts are all derived from the current configuration. - * The response is formatted to match org-mode conventions while preserving original conversation structure.

+ * The response is formatted to match org-mode conventions while preserving original conversation structure. */ public class AiTask { @@ -246,15 +246,14 @@ public class AiTask { "--dry-multiplier 0.5", "--presence-penalty 0.1", "--mirostat 0", - "--samplers 'top_k;top_p;min_p;temperature;dry;typ_p;xtc'", - "--cache-type-k q8_0", - "--cache-type-v q8_0", + // "--cache-type-k q8_0", + // "--cache-type-v q8_0", "--no-display-prompt", "--no-warmup", "--flash-attn", "--temp 0.6", "--ctx-size " + mailQuery.model.contextSizeTokens, - "--batch-size 8", + "--batch-size 512", "--no-conversation", "-n -1", "--file " + inputFile diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/Command.java b/src/main/java/eu/svjatoslav/alyverkko_cli/Command.java index fca9e37..01b48b3 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/Command.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/Command.java @@ -3,15 +3,15 @@ package eu.svjatoslav.alyverkko_cli; import java.io.IOException; /** - *

Base interface for all subcommands in the Älyverkko CLI. Each command must define its name and execution logic.

+ *

Base interface for all subcommands in the Älyverkko CLI. Each command must define its name and execution logic. *

Commands typically: *

- *

- *

Commands should be stateless and self-contained, using the configuration object for persistent data when needed.

+ * + *

Commands should be stateless and self-contained, using the configuration object for persistent data when needed. */ public interface Command { diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java b/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java index 4e0c94d..87e8531 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java @@ -2,9 +2,9 @@ package eu.svjatoslav.alyverkko_cli; /** *

General utility functions for the Älyverkko CLI application. Currently provides ANSI color output capabilities for - * console messages.

- *

Color formatting follows standard ANSI escape sequences, with specific methods for common message types like errors.

- *

For future extensions, this class could include additional helper functions for file operations or string processing.

+ * console messages. + *

Color formatting follows standard ANSI escape sequences, with specific methods for common message types like errors. + *

For future extensions, this class could include additional helper functions for file operations or string processing. */ public class Utils { diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/JoinFilesCommand.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/JoinFilesCommand.java index e74e5a2..622bdc0 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/JoinFilesCommand.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/JoinFilesCommand.java @@ -30,20 +30,6 @@ import static eu.svjatoslav.alyverkko_cli.configuration.ConfigurationHelper.load * */ -/** - *

Aggregates files from a source directory into a single file for AI processing. - * This is particularly useful for creating comprehensive inputs from multiple files - * matching a specified pattern.

- *

Features include: - *

- *

- *

By default, the output file is saved in the mail directory with a .org extension.

- */ public class JoinFilesCommand implements Command { /** diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/ListModelsCommand.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/ListModelsCommand.java index 177a443..2ad1d7c 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/ListModelsCommand.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/ListModelsCommand.java @@ -11,15 +11,15 @@ import static eu.svjatoslav.alyverkko_cli.configuration.ConfigurationHelper.load /** *

Displays all available AI models in the configured models directory. This command provides a quick overview of - * currently available models and their metadata.

+ * currently available models and their metadata. *

The implementation: *

- *

- *

This command is primarily intended for administrative use to verify model availability before running tasks.

+ * + *

This command is primarily intended for administrative use to verify model availability before running tasks. */ public class ListModelsCommand implements Command { diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/WizardCommand.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/WizardCommand.java index c9df3ca..f68192f 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/WizardCommand.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/WizardCommand.java @@ -21,7 +21,7 @@ import static eu.svjatoslav.commons.cli_helper.CLIHelper.*; /** *

Interactive configuration wizard that helps users validate and fix their configuration files. * It performs system checks and offers to fix any missing or invalid paths, discovers new models, - * and updates the configuration accordingly.

+ * and updates the configuration accordingly. *

Key workflow steps: *

    *
  1. Load or create configuration
  2. @@ -29,9 +29,8 @@ import static eu.svjatoslav.commons.cli_helper.CLIHelper.*; *
  3. Discover and annotate new models
  4. *
  5. Save updated configuration
  6. *
- *

*

When handling split models (.gguf files with part numbering), the wizard automatically - * detects base models and only adds part-1 files to the configuration.

+ * detects base models and only adds part-1 files to the configuration. */ public class WizardCommand implements Command { diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailCorrespondentCommand.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailCorrespondentCommand.java index cb71e41..3956628 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailCorrespondentCommand.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailCorrespondentCommand.java @@ -1,6 +1,7 @@ package eu.svjatoslav.alyverkko_cli.commands.mail_correspondant; import eu.svjatoslav.alyverkko_cli.*; +import eu.svjatoslav.alyverkko_cli.configuration.ConfigurationHelper; import eu.svjatoslav.alyverkko_cli.model.Model; import eu.svjatoslav.alyverkko_cli.model.ModelLibrary; import eu.svjatoslav.commons.cli_helper.parameter_parser.Parser; @@ -11,34 +12,27 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; import java.nio.file.*; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; +import java.util.*; import static eu.svjatoslav.alyverkko_cli.Main.configuration; -import static eu.svjatoslav.alyverkko_cli.configuration.ConfigurationHelper.getConfigurationFile; -import static eu.svjatoslav.alyverkko_cli.configuration.ConfigurationHelper.loadConfiguration; import static eu.svjatoslav.commons.file.IOHelper.getFileContentsAsString; import static eu.svjatoslav.commons.file.IOHelper.saveToFile; import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; + /** - *

Monitors a designated mail directory for text files containing "TOCOMPUTE:" markers. - * When new or modified files are detected, it processes them with appropriate AI models - * and appends the results using a standardized format.

- *

The processing pipeline includes: - *

    - *
  1. Initial scan of existing files
  2. - *
  3. WatchService registration for real-time monitoring
  4. - *
  5. Query construction from file metadata
  6. - *
  7. AI response formatting and appending
  8. - *
- *

- *

This implementation uses a sleep delay (1 second) after detecting file changes to allow complete writes before - * processing. The response format follows org-mode conventions for easy reading and further processing.

+ * The MailCorrespondentCommand continuously monitors a specified mail + * directory for new or modified text files, checks if they have a + * "TOCOMPUTE:" marker, and if so, adds them to a priority queue to be + * processed in priority order. Once processed, results are appended to + * the same file. + *

+ * Usage: + *

+ *   alyverkko-cli mail
+ * 
*/ - public class MailCorrespondentCommand implements Command { /** @@ -69,6 +63,23 @@ public class MailCorrespondentCommand implements Command { */ File mailDir; + /** + * Priority queue of tasks to process, sorted by priority and a + * random tiebreaker. + */ + private final PriorityQueue taskQueue; + + public MailCorrespondentCommand() { + Comparator comparator = (a, b) -> { + int priorityCompare = Integer.compare(b.priority, a.priority); + if (priorityCompare != 0) { + return priorityCompare; + } + return a.tiebreaker.compareTo(b.tiebreaker); + }; + this.taskQueue = new PriorityQueue<>(comparator); + } + /** * @return the name of this command, i.e., "mail". */ @@ -79,8 +90,8 @@ public class MailCorrespondentCommand implements Command { /** * Executes the "mail" command, loading configuration, starting a - * WatchService on the mail directory, and running an infinite loop - * that processes newly discovered tasks. + * WatchService on the mail directory, adding existing files to the + * task queue, and processing tasks in priority order. * * @param cliArguments the command-line arguments following the "mail" subcommand. * @throws IOException if reading/writing tasks fails. @@ -94,7 +105,7 @@ public class MailCorrespondentCommand implements Command { return; } - configuration = loadConfiguration(getConfigurationFile(configFileOption)); + configuration = ConfigurationHelper.loadConfiguration(ConfigurationHelper.getConfigurationFile(configFileOption)); if (configuration == null) { System.out.println("Failed to load configuration file"); return; @@ -106,27 +117,26 @@ public class MailCorrespondentCommand implements Command { // Set up directory watch service initializeFileWatcher(); - // Process any existing files that might already be in the directory + // Add all existing mail files to the queue initialMailScanAndReply(); System.out.println("Mail correspondent running. Press CTRL+c to terminate."); - // Main loop: watch for file events + // Main loop: process tasks from the queue in priority order while (true) { - WatchKey key; - try { - key = directoryWatcher.take(); - } catch (InterruptedException e) { - System.out.println("Interrupted while waiting for file system events. Exiting."); - break; - } + // Process the highest priority task if available + if (!taskQueue.isEmpty()) processTask(taskQueue.poll()); - System.out.println("Detected filesystem event."); + // Check for filesystem events + WatchKey key = directoryWatcher.poll(); // Sleep briefly to allow the file to be fully written Thread.sleep(1000); - processDetectedFilesystemEvents(key); + if (key != null) { + System.out.println("Detected filesystem events in mail directory. Processing ... "); + processDetectedFilesystemEvents(key); + } if (!key.reset()) { break; @@ -138,17 +148,18 @@ public class MailCorrespondentCommand implements Command { /** * Performs an initial scan of existing files in the mail directory, - * processing those that need AI inference (i.e., that start with "TOCOMPUTE:"). + * adding those that need processing to the task queue. * - * @throws IOException if reading files fails. - * @throws InterruptedException if the thread is interrupted. + * @throws IOException if file scanning fails. */ - private void initialMailScanAndReply() throws IOException, InterruptedException { + private void initialMailScanAndReply() throws IOException { File[] files = mailDir.listFiles(); - if (files == null) return; + if (files == null) { + return; + } for (File file : files) { - processMailIfNeeded(file); + considerFileForQueuing(file.toPath()); } } @@ -168,6 +179,11 @@ public class MailCorrespondentCommand implements Command { return false; } + // Ensure the file exists + if (!file.exists()) { + return false; + } + // Check if it's a regular file if (!file.isFile()) { return false; @@ -185,9 +201,13 @@ public class MailCorrespondentCommand implements Command { * @throws IOException if file reading fails. */ private static boolean fileHasToComputeMarker(File file) throws IOException { + String firstLine = getFirstLine(file); + return firstLine != null && firstLine.startsWith("TOCOMPUTE:"); + } + + private static String getFirstLine(File file) throws IOException { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { - String firstLine = reader.readLine(); - return firstLine != null && firstLine.startsWith("TOCOMPUTE:"); + return reader.readLine(); } } @@ -217,7 +237,7 @@ public class MailCorrespondentCommand implements Command { saveAiResponseToFile(file, mailQuery, aiGeneratedResponse); } - private static void saveAiResponseToFile(File file, MailQuery mailQuery, String aiGeneratedResponse) throws IOException { + private static void saveAiResponseToFile(File file, MailQuery mailQuery, String aiResponse) throws IOException { // Build new content StringBuilder resultFileContent = new StringBuilder(); @@ -235,17 +255,53 @@ public class MailCorrespondentCommand implements Command { // Append the AI response block resultFileContent .append("* ASSISTANT:\n") - .append(aiGeneratedResponse) + .append(aiResponse) .append("\n"); // Write the combined result back to the same file saveToFile(file, resultFileContent.toString()); } + + /** + * Processes a task by reading the file, building the MailQuery, + * running the AI query, and saving the response. + * + * @param entry the task entry containing the file path and priority. + */ + private void processTask(TaskQueueEntry entry) throws IOException { + Path filePath = entry.getFilePath(); + File file = filePath.toFile(); + + if (!isMailProcessingNeeded(file)) { + System.out.println("Ignoring file: " + filePath.getFileName() + " (does not need processing now)"); + return; + } + + try { + MailQuery mailQuery = buildMailQueryFromFile(file); + AiTask aiTask = new AiTask(mailQuery); + String aiGeneratedResponse = aiTask.runAiQuery(); + + saveAiResponseToFile(file, mailQuery, aiGeneratedResponse); + } catch (IOException | InterruptedException | RuntimeException e) { + e.printStackTrace(); + } + } + + + /** + * Builds a string for the first line of the output file indicating + * that processing is done. + * + * @param mailQuery the query that was processed. + * @return a string for the first line. + */ private static String getDoneLine(MailQuery mailQuery) { - return "DONE: prompt=" + mailQuery.systemPromptName + " model="+ mailQuery.model.alias + " duration=" + getDuration(mailQuery.startTime, mailQuery.endTime) + "\n"; + return "DONE: prompt=" + mailQuery.systemPromptName + " model=" + mailQuery.model.alias + " duration=" + getDuration(mailQuery.startTime, mailQuery.endTime) + "\n"; } + private static String getDuration(long startTime, long endTime) { long durationMillis = endTime - startTime; @@ -264,19 +320,22 @@ public class MailCorrespondentCommand implements Command { return durationHours + "h"; } + /** + * Builds a MailQuery object from the contents of a file. + * + * @param file the file to read. + * @return the constructed MailQuery. + * @throws IOException if reading the file fails. + */ private MailQuery buildMailQueryFromFile(File file) throws IOException { MailQuery result = new MailQuery(); - // Read the mail content String inputFileContent = getFileContentsAsString(file); - - // Split into first line and user prompt int firstNewLineIndex = inputFileContent.indexOf('\n'); if (firstNewLineIndex == -1) { - throw new IllegalArgumentException("Input file is only one line long. Content: " + inputFileContent); + throw new IllegalArgumentException("Input file is only one line long."); } - // The First line should start with "TOCOMPUTE:" and contain settings String firstLine = inputFileContent.substring(0, firstNewLineIndex); Map fileProcessingSettings = parseSettings(firstLine); @@ -295,9 +354,21 @@ public class MailCorrespondentCommand implements Command { } result.model = modelOptional.get(); + // Set priority + String priorityStr = fileProcessingSettings.get("priority"); + result.priority = 0; + if (priorityStr != null) { + try { + result.priority = Integer.parseInt(priorityStr); + } catch (NumberFormatException e) { + System.err.println("Invalid priority in file: " + priorityStr); + } + } + return result; } + /** * Parses the "TOCOMPUTE:" line, which should look like: *
TOCOMPUTE: key1=value1 key2=value2 ...
@@ -329,18 +400,18 @@ public class MailCorrespondentCommand implements Command { } /** - * Handles the filesystem events from the WatchService (e.g. file creation - * or modification), then processes those files if necessary. + * Handles the filesystem events from the WatchService (e.g., file + * creation or modification), then adds the file to the task queue + * if it needs processing. * * @param key the watch key containing the events. - * @throws IOException if file reading/writing fails. - * @throws InterruptedException if the AI process is interrupted. + * @throws IOException if file processing fails. */ - private void processDetectedFilesystemEvents(WatchKey key) throws IOException, InterruptedException { + private void processDetectedFilesystemEvents(WatchKey key) throws IOException { for (WatchEvent event : key.pollEvents()) { WatchEvent.Kind kind = event.kind(); - // Skip OVERFLOW event + // Skip OVERFLOW events if (kind == StandardWatchEventKinds.OVERFLOW) { continue; } @@ -349,10 +420,10 @@ public class MailCorrespondentCommand implements Command { Path filename = ((WatchEvent) event).context(); System.out.println("Event: " + kind + " for file: " + filename); - // Process the file + // Add to task queue if needed if (kind == ENTRY_CREATE || kind == ENTRY_MODIFY) { - File file = mailDir.toPath().resolve(filename).toFile(); - processMailIfNeeded(file); + Path filePath = mailDir.toPath().resolve(filename); + considerFileForQueuing(filePath); } } } @@ -367,4 +438,66 @@ public class MailCorrespondentCommand implements Command { this.directoryWatcher = FileSystems.getDefault().newWatchService(); Paths.get(mailDir.getAbsolutePath()).register(directoryWatcher, ENTRY_CREATE, ENTRY_MODIFY); } + + /** + * Adds a file to the task queue if it needs processing. + * + * @param filePath the path to the file to check. + * @throws IOException if reading the first line fails. + */ + private void considerFileForQueuing(Path filePath) throws IOException { + File file = filePath.toFile(); + if (!isMailProcessingNeeded(file)) return; + + String firstLine = getFirstLine(file); + Map settings = parseSettings(firstLine); + int priority = 0; + String priorityStr = settings.get("priority"); + if (priorityStr != null) { + try { + priority = Integer.parseInt(priorityStr); + } catch (NumberFormatException e) { + System.err.println("Invalid priority in file " + filePath.getFileName() + ": " + priorityStr); + } + } + taskQueue.offer(new TaskQueueEntry(filePath, priority)); + } + + /** + * A static nested class representing a task in the queue, with a + * priority and a tiebreaker for sorting. + */ + private static class TaskQueueEntry implements Comparable { + private final Path filePath; + private final int priority; + private final String tiebreaker; + + public TaskQueueEntry(Path filePath, int priority) { + this.filePath = filePath; + this.priority = priority; + this.tiebreaker = UUID.randomUUID().toString(); + } + + public Path getFilePath() { + return filePath; + } + + public int getPriority() { + return priority; + } + + public String getTiebreaker() { + return tiebreaker; + } + + @Override + public int compareTo(TaskQueueEntry other) { + int priorityCompare = Integer.compare(this.priority, other.priority); + if (priorityCompare != 0) { + return -priorityCompare; // higher priority first + } + return this.tiebreaker.compareTo(other.tiebreaker); + } + } + } diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailQuery.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailQuery.java index 51a3e0b..e17e73d 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailQuery.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/MailQuery.java @@ -41,6 +41,8 @@ public class MailQuery { */ public long endTime; + public int priority; + /** * Returns a string containing a summary of the {@link MailQuery} object. * diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/package-info.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/package-info.java index 3bf376d..7aa5003 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/package-info.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/mail_correspondant/package-info.java @@ -1,13 +1,12 @@ /** *

This subpackage implements the mail-based AI task processing functionality. It watches mail directories for - * new/modified files with specific markers and processes them using AI models.

+ * new/modified files with specific markers and processes them using AI models. *

Key components: *

    *
  • File monitoring with WatchService
  • *
  • Prompt parsing and execution logic
  • *
  • Query object for storing processing parameters
  • *
- *

*/ package eu.svjatoslav.alyverkko_cli.commands.mail_correspondant; \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/package-info.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/package-info.java index 33f0c48..871a60b 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/package-info.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/package-info.java @@ -1,6 +1,6 @@ /** *

This package implements all subcommands available in the Älyverkko CLI application. Each command class provides a - * specific functionality through the Command interface.

+ * specific functionality through the Command interface. *

Available commands include: *

    *
  • Wizard-style configuration builder
  • @@ -8,7 +8,6 @@ *
  • File joining for multi-file processing
  • *
  • Mail-based AI task processing
  • *
- *

*/ package eu.svjatoslav.alyverkko_cli.commands; \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/Configuration.java b/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/Configuration.java index d25d723..01ed019 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/Configuration.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/Configuration.java @@ -10,16 +10,15 @@ import static eu.svjatoslav.commons.file.IOHelper.getFileContentsAsString; /** *

Central configuration class storing all application parameters. - * This class is serialized to YAML format for user editing and persistence.

+ * This class is serialized to YAML format for user editing and persistence. *

Configuration parameters include: *

    *
  • Model and prompt directories
  • *
  • Performance tuning parameters
  • *
  • Model-specific configurations
  • *
- *

*

All paths are resolved relative to the user's home directory by default, but can be customized. The class provides - * direct access to prompt content for AI query construction.

+ * direct access to prompt content for AI query construction. */ @Data public class Configuration { diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/ConfigurationHelper.java b/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/ConfigurationHelper.java index 7a4a36b..6c39b8a 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/ConfigurationHelper.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/ConfigurationHelper.java @@ -9,14 +9,13 @@ import java.io.IOException; /** *

Helper class for configuration file operations. Provides methods for loading configurations - * and determining the default configuration file path in the user's home directory.

+ * and determining the default configuration file path in the user's home directory. *

Key functionality includes: *

    *
  • Configuration file path resolution
  • *
  • YAML deserialization
  • *
  • Error handling for missing configurations
  • *
- *

*/ public class ConfigurationHelper { diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/package-info.java b/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/package-info.java index 3fb3ba6..fd21d0b 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/package-info.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/package-info.java @@ -1,14 +1,13 @@ /** *

This package handles the configuration system for the Älyverkko CLI application. * It provides classes for storing and retrieving application-wide settings, including - * model configurations, directory paths, and performance parameters.

+ * model configurations, directory paths, and performance parameters. *

Configuration is stored in YAML format and includes: *

    *
  • Model directory paths
  • *
  • Mail task directories
  • *
  • Performance settings (thread counts, temperature)
  • *
- *

*/ package eu.svjatoslav.alyverkko_cli.configuration; \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/model/Model.java b/src/main/java/eu/svjatoslav/alyverkko_cli/model/Model.java index 8cf7bfd..b5fcf1a 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/model/Model.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/model/Model.java @@ -4,7 +4,7 @@ import java.io.File; /** *

Represents an AI model stored on the filesystem with metadata about its capabilities and identification. - * This class serves as a lightweight container for model information, enabling quick lookup and validation.

+ * This class serves as a lightweight container for model information, enabling quick lookup and validation. *

Models are typically discovered through configuration files and stored in the ModelLibrary for easy access. *

Key fields include: *

    @@ -13,7 +13,6 @@ import java.io.File; *
  • alias - User-friendly identifier for the model
  • *
  • endOfTextMarker - Optional response completion marker
  • *
- *

*/ public class Model { @@ -57,14 +56,13 @@ public class Model { /** *

Prints the model's metadata to standard output in a consistent format. This includes the model's alias, * filesystem path, and context token capacity. The output format is designed to be both human-readable and - * machine-parsable when needed.

+ * machine-parsable when needed. *

Typical output: *

      * Model: default
      *   Path: /path/to/model.gguf
      *   Context size: 32768
      * 
- *

*/ public void printModelDetails() { System.out.println("Model: " + alias); diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/model/package-info.java b/src/main/java/eu/svjatoslav/alyverkko_cli/model/package-info.java index 717d44e..5d8b074 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/model/package-info.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/model/package-info.java @@ -1,13 +1,12 @@ /** *

This package defines the model management system for the Älyverkko CLI. - * It includes classes for representing AI models and maintaining a library of available models.

+ * It includes classes for representing AI models and maintaining a library of available models. *

Key features: *

    *
  • Model metadata storage and validation
  • *
  • Default model selection and management
  • *
  • File system integration for model discovery
  • *
- *

*/ package eu.svjatoslav.alyverkko_cli.model; \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/package-info.java b/src/main/java/eu/svjatoslav/alyverkko_cli/package-info.java index 491400e..a3057d0 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/package-info.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/package-info.java @@ -1,14 +1,14 @@ /** *

This package contains the core components of the Älyverkko CLI application, including the main entry point, * command interfaces, and utility classes. It serves as the central hub for orchestrating subcommands and core - * application behavior.

+ * application behavior. *

Key responsibilities include: *

    *
  • Command registration and execution
  • *
  • Configuration loading and management
  • *
  • Basic utility functions for colored console output
  • *
- *

+ * */ package eu.svjatoslav.alyverkko_cli; \ No newline at end of file -- 2.20.1