fix: complete approved layout and prompt cancellation safeguards
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
min-width: 0;
|
||||
}
|
||||
.mdl-sum {
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
@@ -55,8 +56,10 @@
|
||||
color: var(--tx-2);
|
||||
font-size: 11.5px;
|
||||
margin-top: 2px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.mlist {
|
||||
flex: none;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--bg-1);
|
||||
@@ -189,6 +192,7 @@
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
html[data-motion="calm"] .spill.run i,
|
||||
html[data-motion="off"] .spill.run i {
|
||||
animation: none;
|
||||
}
|
||||
@@ -214,6 +218,7 @@ html[data-motion="off"] .spill.run i {
|
||||
border-color: color-mix(in srgb, var(--sc-image) 40%, transparent);
|
||||
}
|
||||
.role-t {
|
||||
flex: none;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--bg-1);
|
||||
@@ -257,6 +262,7 @@ html[data-motion="off"] .spill.run i {
|
||||
height: 28px;
|
||||
}
|
||||
.soon-row {
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
@@ -399,11 +405,7 @@ html[data-motion="off"] .spill.run i {
|
||||
@media (max-width: 1280px) {
|
||||
.mlist-h,
|
||||
.mrow {
|
||||
grid-template-columns: minmax(0, 1.3fr) 150px 84px;
|
||||
}
|
||||
.mlist-h .c-use,
|
||||
.mrow .use {
|
||||
display: none;
|
||||
grid-template-columns: minmax(0, 1fr) 150px 84px;
|
||||
}
|
||||
.role-g {
|
||||
grid-template-columns: 1fr;
|
||||
@@ -414,6 +416,10 @@ html[data-motion="off"] .spill.run i {
|
||||
.role:nth-last-child(2) {
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.mlist-h .use,
|
||||
.mrow .use {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.mdl-body small,
|
||||
@@ -457,21 +463,8 @@ html[data-motion="off"] .spill.run i {
|
||||
width: 100%;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
@media (max-width: 1280px) {
|
||||
.mlist-h,
|
||||
.mrow {
|
||||
grid-template-columns: minmax(0, 1fr) 150px 84px;
|
||||
}
|
||||
.mlist-h .use,
|
||||
.mrow .use {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.role > span {
|
||||
font-size: 12px;
|
||||
color: var(--tx-2);
|
||||
}
|
||||
.mdl-alert small {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import ToolButtons from "./ToolButtons.svelte";
|
||||
import ResultBand from "./ResultBand.svelte";
|
||||
let {
|
||||
value = $bindable(""),
|
||||
value = $bindable(),
|
||||
identity,
|
||||
label = "提示词",
|
||||
rows = 2,
|
||||
@@ -18,7 +18,7 @@
|
||||
placeholder?: string;
|
||||
} = $props();
|
||||
const tool = promptTool(
|
||||
() => value,
|
||||
() => value ?? "",
|
||||
() => `${page.url.pathname}|${identity}`,
|
||||
(v) => (value = v),
|
||||
untrack(() => label),
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
<svelte:window
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Escape" && tool.state !== "idle") tool.close();
|
||||
if (e.key === "Escape" && tool.state !== "idle") {
|
||||
if (tool.state === "loading") tool.cancel();
|
||||
else tool.close();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{#if tool.state !== "idle"}
|
||||
@@ -36,7 +39,7 @@
|
||||
{#if tool.state === "loading"}<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onclick={tool.close}>取消</Button
|
||||
onclick={tool.cancel}>取消</Button
|
||||
>
|
||||
{:else if tool.state === "result"}
|
||||
{#if tool.confirm}<span class="pt-confirm">替换会覆盖你刚才的修改</span
|
||||
@@ -68,7 +71,8 @@
|
||||
type="button"
|
||||
class="pt-btn"
|
||||
aria-label="关闭提示词结果"
|
||||
onclick={tool.close}>×</button
|
||||
onclick={() =>
|
||||
tool.state === "loading" ? tool.cancel() : tool.close()}>×</button
|
||||
>
|
||||
</div>
|
||||
<div class="pt-b">
|
||||
|
||||
@@ -55,6 +55,10 @@ export function promptTool(
|
||||
state = "idle";
|
||||
confirm = false;
|
||||
}
|
||||
function cancel() {
|
||||
close();
|
||||
toast.info("已取消,原提示词未改动");
|
||||
}
|
||||
function edit() {
|
||||
++textVersion;
|
||||
confirm = false;
|
||||
@@ -63,9 +67,12 @@ export function promptTool(
|
||||
const context = getContext();
|
||||
const text = getText();
|
||||
if (context !== observedContext) {
|
||||
const hadResult = state !== "idle";
|
||||
observedContext = context;
|
||||
++contextVersion;
|
||||
close();
|
||||
if (hadResult)
|
||||
toast.info("已切换工作流或项目,旧结果已作废;提示词未改动");
|
||||
}
|
||||
if (text !== observedText) {
|
||||
observedText = text;
|
||||
@@ -87,8 +94,7 @@ export function promptTool(
|
||||
sync();
|
||||
if (!getText().trim()) return;
|
||||
if (state === "loading" && next === action) {
|
||||
close();
|
||||
toast.info("已取消,原提示词未改动");
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
onOpen?.();
|
||||
@@ -230,6 +236,7 @@ export function promptTool(
|
||||
},
|
||||
run,
|
||||
close,
|
||||
cancel,
|
||||
edit,
|
||||
replace,
|
||||
cancelConfirm() {
|
||||
|
||||
Reference in New Issue
Block a user