Compare commits

..

2 Commits

Author SHA1 Message Date
hikari d90691d756 feat: generate adjective-noun combo names for threads
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m24s
CI / Lint & Check (pull_request) Successful in 13m18s
CI / Build Windows (pull_request) Successful in 29m11s
2026-04-13 18:31:35 -07:00
hikari 9f45ee329d feat: add user-selectable aspect ratio and resolution per thread (#18)
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 1m14s
CI / Lint & Check (push) Successful in 12m50s
CI / Build Windows (push) Successful in 28m36s
## Summary

- Adds a two-step thread creation modal — step 1 picks the mode, step 2 configures generation options
- Art mode now supports user-selectable aspect ratio (1:1, 4:3, 3:4, 16:9, 9:16, 21:9)
- All three modes (Art, Avatar, Replace) now support user-selectable resolution (1K, 2K, 4K)
- Mode label in the input area reflects the chosen settings (e.g. `🩷 Art Mode (16:9) · 4K`)
- Backend cost calculation now scales with resolution
- Regenerated `icon.ico` with clean BMP-only entries to fix Windows local builds

 This PR was created with help from Hikari~ 🌸

Reviewed-on: #18
Co-authored-by: Hikari <hikari@nhcarrigan.com>
Co-committed-by: Hikari <hikari@nhcarrigan.com>
2026-04-13 18:24:46 -07:00
3 changed files with 142 additions and 29 deletions
+19 -6
View File
@@ -115,18 +115,31 @@ fn build_user_gemini_parts(
} }
} }
pub struct GeminiCallParams {
pub mode: String,
pub aspect_ratio: Option<String>,
pub image_size: String,
pub user_text: Option<String>,
pub user_image_base64: Option<String>,
pub user_image_mime: Option<String>,
}
pub async fn call_gemini( pub async fn call_gemini(
api_key: String, api_key: String,
mode: String,
aspect_ratio: Option<String>,
image_size: String,
history: Vec<ThreadMessage>, history: Vec<ThreadMessage>,
user_text: Option<String>, params: GeminiCallParams,
user_image_base64: Option<String>,
user_image_mime: Option<String>,
) -> Result<(Vec<MessagePart>, f64), String> { ) -> Result<(Vec<MessagePart>, f64), String> {
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let GeminiCallParams {
mode,
aspect_ratio,
image_size,
user_text,
user_image_base64,
user_image_mime,
} = params;
let is_first_message = history.is_empty(); let is_first_message = history.is_empty();
let mut contents: Vec<Value> = history let mut contents: Vec<Value> = history
+5 -2
View File
@@ -1,7 +1,7 @@
mod gemini; mod gemini;
mod storage; mod storage;
use gemini::{call_gemini, read_reference_image_base64}; use gemini::{call_gemini, read_reference_image_base64, GeminiCallParams};
use serde::Serialize; use serde::Serialize;
use storage::{ use storage::{
delete_thread_from_disk, load_config_from_disk, load_threads_from_disk, save_config_to_disk, delete_thread_from_disk, load_config_from_disk, load_threads_from_disk, save_config_to_disk,
@@ -46,6 +46,7 @@ async fn save_config(config: Config) -> Result<(), String> {
} }
#[tauri::command] #[tauri::command]
#[allow(clippy::too_many_arguments)]
async fn send_message( async fn send_message(
api_key: String, api_key: String,
mode: String, mode: String,
@@ -58,13 +59,15 @@ async fn send_message(
) -> Result<SendMessageResult, String> { ) -> Result<SendMessageResult, String> {
let (parts, cost_usd) = call_gemini( let (parts, cost_usd) = call_gemini(
api_key, api_key,
history,
GeminiCallParams {
mode, mode,
aspect_ratio, aspect_ratio,
image_size, image_size,
history,
user_text, user_text,
user_image_base64, user_image_base64,
user_image_mime, user_image_mime,
},
) )
.await?; .await?;
Ok(SendMessageResult { parts, cost_usd }) Ok(SendMessageResult { parts, cost_usd })
+113 -16
View File
@@ -25,15 +25,118 @@ import type {
Thread, Thread,
} from "./types/index.ts"; } from "./types/index.ts";
const generateThreadName = (mode: Mode, text?: string): string => { const adjectives = [
if ( "Amber",
mode === "replace" "Ancient",
|| text === undefined "Arctic",
|| text.trim().length === 0 "Azure",
) { "Blazing",
return `Replace - ${new Date().toLocaleString()}`; "Celestial",
} "Cobalt",
return text.trim().slice(0, 40); "Crimson",
"Crystal",
"Dark",
"Distant",
"Ember",
"Emerald",
"Eternal",
"Ethereal",
"Fleeting",
"Frosted",
"Gilded",
"Golden",
"Hidden",
"Hollow",
"Indigo",
"Ivory",
"Jade",
"Lunar",
"Midnight",
"Mystic",
"Neon",
"Obsidian",
"Onyx",
"Opal",
"Pale",
"Pearl",
"Radiant",
"Rusted",
"Sapphire",
"Scarlet",
"Shattered",
"Silent",
"Silver",
"Spectral",
"Twilight",
"Velvet",
"Verdant",
"Veiled",
"Violet",
"Wandering",
"Wild",
"Woven",
"Arcane",
];
const nouns = [
"Abyss",
"Archive",
"Aria",
"Bloom",
"Cascade",
"Chronicle",
"Cipher",
"Compass",
"Crown",
"Dawn",
"Dream",
"Echo",
"Elegy",
"Ember",
"Equinox",
"Flame",
"Fragment",
"Garden",
"Horizon",
"Labyrinth",
"Lantern",
"Mirage",
"Mist",
"Murmur",
"Nexus",
"Nocturne",
"Oracle",
"Phantom",
"Prism",
"Requiem",
"Reverie",
"Ruin",
"Shadow",
"Shard",
"Silence",
"Solstice",
"Sonata",
"Specter",
"Storm",
"Tempest",
"Throne",
"Tide",
"Veil",
"Vortex",
"Whisper",
"Zenith",
"Sigil",
"Glyph",
"Dusk",
"Omen",
];
const generateThreadName = (): string => {
const adjectiveIndex = Math.floor(Math.random() * adjectives.length);
const nounIndex = Math.floor(Math.random() * nouns.length);
const adjective = adjectives[adjectiveIndex] ?? "Arcane";
const noun = nouns[nounIndex] ?? "Reverie";
return `${adjective} ${noun}`;
}; };
const generateId = (): string => { const generateId = (): string => {
@@ -74,13 +177,7 @@ const resolveUpdatedThread = (updatedThread: Thread): Thread => {
return updatedThread; return updatedThread;
} }
const firstTextPart = firstMessage.parts.find((part) => { const name = generateThreadName();
return part.type === "text";
});
const name = generateThreadName(
updatedThread.mode,
firstTextPart?.text,
);
return { ...updatedThread, name }; return { ...updatedThread, name };
}; };