Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

feat: refactor AgentChat components for improved layout and message handling

Khuram Niaz6699285a3540
diff --git a/src/components/agent/AgentChatEmptyState.tsx b/src/components/agent/AgentChatEmptyState.tsx
index e60e583..9a67a0d 100644
--- a/src/components/agent/AgentChatEmptyState.tsx
+++ b/src/components/agent/AgentChatEmptyState.tsx
@@ -3,16 +3,18 @@
import { Suggestion, Suggestions } from "@/components/ai-elements/suggestion";
import { useAgentChat } from "@/components/agent/AgentChatProvider";
-// Complete prompts, not fragments — clicking one fills the composer so it can
-// be edited before it costs a 30–60s local generation.
-const EXAMPLES = [
- "Add this job posting",
- "Review my resume",
- "Add a job: Senior Platform Engineer at Stripe, remote",
-];
+// Both send immediately on click — neither needs editing first. "Add this
+// job posting" has no company/title yet, so the model asks the user to
+// paste it rather than calling add_job.
+const EXAMPLES = ["Add this job posting", "Review my resume"];
export function AgentChatEmptyState() {
- const { prefillComposer } = useAgentChat();
+ const { sendMessage, preflight } = useAgentChat();
+
+ const handleClick = (example: string) => {
+ if (!preflight.ok) return;
+ void sendMessage({ parts: [{ type: "text", text: example }] });
+ };
return (
<div className="flex flex-1 flex-col justify-end gap-4 p-4">
@@ -28,8 +30,9 @@ export function AgentChatEmptyState() {
<Suggestions>
{EXAMPLES.map((example) => (
<Suggestion
+ disabled={!preflight.ok}
key={example}
- onClick={prefillComposer}
+ onClick={handleClick}
suggestion={example}
/>
))}
diff --git a/src/components/agent/AgentChatPanel.tsx b/src/components/agent/AgentChatPanel.tsx
index fc42738..0013335 100644
--- a/src/components/agent/AgentChatPanel.tsx
+++ b/src/components/agent/AgentChatPanel.tsx
@@ -117,10 +117,18 @@ export function AgentChatPanel() {
</Button>
</div>
- {messages.length > 0 ? <AgentChatMessages /> : <AgentChatEmptyState />}
+ <div className="flex min-h-0 flex-1 flex-col lg:mx-auto lg:w-full lg:max-w-6xl">
+ {messages.length > 0 ? (
+ <AgentChatMessages />
+ ) : (
+ <AgentChatEmptyState />
+ )}
+ </div>
<div className="shrink-0 border-t p-3">
- <AgentChatInput />
+ <div className="lg:mx-auto lg:w-full lg:max-w-6xl">
+ <AgentChatInput />
+ </div>
</div>
</SheetContent>
</Sheet>