feat: /feedback improvements (#371)
This commit is contained in:
@@ -96,6 +96,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
buildMessageContentFromDisplay,
|
buildMessageContentFromDisplay,
|
||||||
clearPlaceholdersInText,
|
clearPlaceholdersInText,
|
||||||
|
resolvePlaceholders,
|
||||||
} from "./helpers/pasteRegistry";
|
} from "./helpers/pasteRegistry";
|
||||||
import { generatePlanFilePath } from "./helpers/planName";
|
import { generatePlanFilePath } from "./helpers/planName";
|
||||||
import { safeJsonParseOr } from "./helpers/safeJsonParse";
|
import { safeJsonParseOr } from "./helpers/safeJsonParse";
|
||||||
@@ -440,7 +441,11 @@ export default function App({
|
|||||||
| "oauth"
|
| "oauth"
|
||||||
| null;
|
| null;
|
||||||
const [activeOverlay, setActiveOverlay] = useState<ActiveOverlay>(null);
|
const [activeOverlay, setActiveOverlay] = useState<ActiveOverlay>(null);
|
||||||
const closeOverlay = useCallback(() => setActiveOverlay(null), []);
|
const [feedbackPrefill, setFeedbackPrefill] = useState("");
|
||||||
|
const closeOverlay = useCallback(() => {
|
||||||
|
setActiveOverlay(null);
|
||||||
|
setFeedbackPrefill("");
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Pin dialog state
|
// Pin dialog state
|
||||||
const [pinDialogLocal, setPinDialogLocal] = useState(false);
|
const [pinDialogLocal, setPinDialogLocal] = useState(false);
|
||||||
@@ -3161,8 +3166,9 @@ ${gitContext}
|
|||||||
return { submitted: true };
|
return { submitted: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special handling for /feedback command - open feedback dialog
|
if (trimmed.startsWith("/feedback")) {
|
||||||
if (trimmed === "/feedback") {
|
const maybeMsg = msg.slice("/feedback".length).trim();
|
||||||
|
setFeedbackPrefill(maybeMsg);
|
||||||
setActiveOverlay("feedback");
|
setActiveOverlay("feedback");
|
||||||
return { submitted: true };
|
return { submitted: true };
|
||||||
}
|
}
|
||||||
@@ -4269,6 +4275,8 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|||||||
const cmdId = uid("cmd");
|
const cmdId = uid("cmd");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const resolvedMessage = resolvePlaceholders(message);
|
||||||
|
|
||||||
// Immediately add command to transcript with "running" phase
|
// Immediately add command to transcript with "running" phase
|
||||||
buffersRef.current.byId.set(cmdId, {
|
buffersRef.current.byId.set(cmdId, {
|
||||||
kind: "command",
|
kind: "command",
|
||||||
@@ -4298,11 +4306,12 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: `Bearer ${apiKey}`,
|
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
|
||||||
"X-Letta-Source": "letta-code",
|
"X-Letta-Source": "letta-code",
|
||||||
|
"X-Letta-Code-Device-ID": settingsManager.getOrCreateDeviceId(),
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
message: message,
|
message: resolvedMessage,
|
||||||
feature: "letta-code",
|
feature: "letta-code",
|
||||||
agent_id: agentId,
|
agent_id: agentId,
|
||||||
session_id: telemetry.getSessionId(),
|
session_id: telemetry.getSessionId(),
|
||||||
@@ -4938,6 +4947,7 @@ Plan file path: ${planFilePath}`;
|
|||||||
<FeedbackDialog
|
<FeedbackDialog
|
||||||
onSubmit={handleFeedbackSubmit}
|
onSubmit={handleFeedbackSubmit}
|
||||||
onCancel={closeOverlay}
|
onCancel={closeOverlay}
|
||||||
|
initialValue={feedbackPrefill}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,15 @@ import { PasteAwareTextInput } from "./PasteAwareTextInput";
|
|||||||
interface FeedbackDialogProps {
|
interface FeedbackDialogProps {
|
||||||
onSubmit: (message: string) => void;
|
onSubmit: (message: string) => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
|
initialValue?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function FeedbackDialog({ onSubmit, onCancel }: FeedbackDialogProps) {
|
export function FeedbackDialog({
|
||||||
const [feedbackText, setFeedbackText] = useState("");
|
onSubmit,
|
||||||
|
onCancel,
|
||||||
|
initialValue = "",
|
||||||
|
}: FeedbackDialogProps) {
|
||||||
|
const [feedbackText, setFeedbackText] = useState(initialValue);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
|
|
||||||
useInput((_input, key) => {
|
useInput((_input, key) => {
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ class TelemetryManager {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: `Bearer ${apiKey}`,
|
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
|
||||||
"X-Letta-Source": "letta-code",
|
"X-Letta-Source": "letta-code",
|
||||||
"X-Letta-Code-Device-ID": this.deviceId || "",
|
"X-Letta-Code-Device-ID": this.deviceId || "",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user