feat(assistant): add multi-dialog UX, task-aware llm settings, and i18n cleanup
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
import { gitService } from "../../services/gitService";
|
||||
import { addToast as toast } from "../../lib/toasts.js";
|
||||
import { api } from "../../lib/api";
|
||||
import { t } from "../../lib/i18n";
|
||||
// [/SECTION]
|
||||
|
||||
// [SECTION: PROPS]
|
||||
@@ -49,10 +50,10 @@
|
||||
`/git/repositories/${dashboardId}/generate-message`,
|
||||
);
|
||||
message = data.message;
|
||||
toast("Commit message generated", "success");
|
||||
toast($t.git?.commit_message_generated || "Commit message generated", "success");
|
||||
} catch (e) {
|
||||
console.error(`[CommitModal][Coherence:Failed] ${e.message}`);
|
||||
toast(e.message || "Failed to generate message", "error");
|
||||
toast(e.message || ($t.git?.commit_message_failed || "Failed to generate message"), "error");
|
||||
} finally {
|
||||
generatingMessage = false;
|
||||
}
|
||||
@@ -93,7 +94,7 @@
|
||||
if (!diff) diff = "";
|
||||
} catch (e) {
|
||||
console.error(`[CommitModal][Coherence:Failed] ${e.message}`);
|
||||
toast("Failed to load changes", "error");
|
||||
toast($t.git?.load_changes_failed || "Failed to load changes", "error");
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
@@ -114,7 +115,7 @@
|
||||
committing = true;
|
||||
try {
|
||||
await gitService.commit(dashboardId, message, []);
|
||||
toast("Changes committed successfully", "success");
|
||||
toast($t.git?.commit_success || "Changes committed successfully", "success");
|
||||
dispatch("commit");
|
||||
show = false;
|
||||
message = "";
|
||||
@@ -141,7 +142,7 @@
|
||||
<div
|
||||
class="bg-white p-6 rounded-lg shadow-xl w-full max-w-4xl max-h-[90vh] flex flex-col"
|
||||
>
|
||||
<h2 class="text-xl font-bold mb-4">Commit Changes</h2>
|
||||
<h2 class="text-xl font-bold mb-4">{$t.git?.commit || "Commit Changes"}</h2>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-4 flex-1 overflow-hidden">
|
||||
<!-- Left: Message and Files -->
|
||||
@@ -150,7 +151,7 @@
|
||||
<div class="flex justify-between items-center mb-1">
|
||||
<label
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>Commit Message</label
|
||||
>{$t.git?.commit_message || "Commit Message"}</label
|
||||
>
|
||||
<button
|
||||
onclick={handleGenerateMessage}
|
||||
@@ -158,16 +159,16 @@
|
||||
class="text-xs text-blue-600 hover:text-blue-800 disabled:opacity-50 flex items-center"
|
||||
>
|
||||
{#if generatingMessage}
|
||||
<span class="animate-spin mr-1">↻</span> Generating...
|
||||
<span class="animate-spin mr-1">↻</span> {$t.mapper?.generating || "Generating..."}
|
||||
{:else}
|
||||
<span class="mr-1">✨</span> Generate with AI
|
||||
<span class="mr-1">✨</span> {$t.git?.generate_with_ai || "Generate with AI"}
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
<textarea
|
||||
bind:value={message}
|
||||
class="w-full border rounded p-2 h-32 focus:ring-2 focus:ring-blue-500 outline-none resize-none"
|
||||
placeholder="Describe your changes..."
|
||||
placeholder={$t.git?.describe_changes || "Describe your changes..."}
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
@@ -176,7 +177,7 @@
|
||||
<h3
|
||||
class="text-sm font-bold text-gray-500 uppercase mb-2"
|
||||
>
|
||||
Changed Files
|
||||
{$t.git?.changed_files || "Changed Files"}
|
||||
</h3>
|
||||
<ul class="text-xs space-y-1">
|
||||
{#each status.staged_files as file}
|
||||
@@ -218,14 +219,14 @@
|
||||
<div
|
||||
class="bg-gray-200 px-3 py-1 text-xs font-bold text-gray-600 border-b"
|
||||
>
|
||||
Changes Preview
|
||||
{$t.git?.changes_preview || "Changes Preview"}
|
||||
</div>
|
||||
<div class="flex-1 overflow-auto p-2">
|
||||
{#if loading}
|
||||
<div
|
||||
class="flex items-center justify-center h-full text-gray-500"
|
||||
>
|
||||
Loading diff...
|
||||
{$t.git?.loading_diff || "Loading diff..."}
|
||||
</div>
|
||||
{:else if diff}
|
||||
<pre
|
||||
@@ -234,7 +235,7 @@
|
||||
<div
|
||||
class="flex items-center justify-center h-full text-gray-500 italic"
|
||||
>
|
||||
No changes detected
|
||||
{$t.git?.no_changes || "No changes detected"}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -246,7 +247,7 @@
|
||||
onclick={() => (show = false)}
|
||||
class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded"
|
||||
>
|
||||
Cancel
|
||||
{$t.common?.cancel || "Cancel"}
|
||||
</button>
|
||||
<button
|
||||
onclick={handleCommit}
|
||||
@@ -257,7 +258,7 @@
|
||||
status?.staged_files?.length === 0)}
|
||||
class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50"
|
||||
>
|
||||
{committing ? "Committing..." : "Commit"}
|
||||
{committing ? ($t.git?.committing || "Committing...") : ($t.git?.commit || "Commit")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user