Skip to content

Commit e00a5ce

Browse files
committed
fix(agent): Shift+Enter for newline, always show token count
1 parent bb6e4ba commit e00a5ce

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

clif-pad-ide/src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clif-pad-ide/src/components/agent/AgentChatPanel.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,8 @@ const AgentChatPanel: Component = () => {
397397
return;
398398
}
399399
}
400-
// Shift+Enter: force push (cancel current agent, send immediately)
401-
if (e.key === "Enter" && e.shiftKey) {
402-
e.preventDefault();
403-
handleSend(true);
404-
return;
405-
}
406-
// Enter: normal send (queue if agent running)
400+
// Enter: send message (queue if agent running)
401+
// Shift+Enter: newline (default browser behavior - do nothing)
407402
if (e.key === "Enter" && !e.shiftKey) {
408403
e.preventDefault();
409404
handleSend();
@@ -858,6 +853,11 @@ const AgentChatPanel: Component = () => {
858853
</Show>
859854
</div>
860855

856+
{/* Center: keyboard hint */}
857+
<div class="flex items-center" style={{ opacity: 0.6, "font-size": "11px" }}>
858+
<span>Enter to send · Shift+Enter for new line</span>
859+
</div>
860+
861861
{/* Right: web search + tokens */}
862862
<div class="flex items-center gap-4" style={{ "flex-shrink": "0" }}>
863863
<Show when={settings().aiProvider === "openrouter"}>
@@ -885,17 +885,15 @@ const AgentChatPanel: Component = () => {
885885
</button>
886886
</Show>
887887

888-
<Show when={agentTokens().prompt > 0}>
889-
<span style={{ "font-family": "var(--font-mono, monospace)", opacity: 0.8, "font-size": "12px" }}>
890-
{(() => {
891-
const t = agentTokens();
892-
const total = t.prompt + t.completion;
893-
const cost = (t.prompt * 3 + t.completion * 15) / 1_000_000;
894-
const totalStr = total >= 1000 ? `${(total / 1000).toFixed(1)}k` : `${total}`;
895-
return `${totalStr} · $${cost.toFixed(4)}`;
896-
})()}
897-
</span>
898-
</Show>
888+
<span style={{ "font-family": "var(--font-mono, monospace)", opacity: 0.8, "font-size": "12px" }}>
889+
{(() => {
890+
const t = agentTokens();
891+
const total = t.prompt + t.completion;
892+
const cost = (t.prompt * 3 + t.completion * 15) / 1_000_000;
893+
const totalStr = total >= 1000 ? `${(total / 1000).toFixed(1)}k` : `${total}`;
894+
return `${totalStr} · $${cost.toFixed(2)}`;
895+
})()}
896+
</span>
899897
</div>
900898
</div>
901899
</div>

0 commit comments

Comments
 (0)