Skip to content

Commit 5a0b5d6

Browse files
committed
feat: Enhance stock analysis agent and other components
- Refactored stock analysis agent's reasoning protocol for clarity and conciseness, consolidating multiple analysis frameworks into a streamlined process. - Updated data gathering and analysis phases in the stock analysis agent to improve efficiency and clarity. - Added tool efficiency guidelines to the weather agent to prevent repetitive tool usage. - Changed index configuration in pg-storage from 'flat' to 'hnsw' for improved performance with high-dimensional embeddings. - Cleaned up memory template in pg-storage for better readability and organization. - Updated web scraper tool to introduce new schemas for crawling, extraction, request, and storage options, enhancing configurability. - Improved output structure in web scraper tool to better organize extracted content and analysis results. - Introduced a new chat sidebar component for displaying agent details, features, checkpoints, and memory settings in a user-friendly manner.
1 parent 5c49ad0 commit 5a0b5d6

37 files changed

Lines changed: 943 additions & 1644 deletions

Copilot-Processing.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,22 @@ Instructions also mention Unreal Engine ThirdPerson template project and UE C++
3131
- [x] Update `src/mastra/config/google.ts` to use `createGoogleGenerativeAI`.
3232
- [x] Update `src/mastra/config/pg-storage.ts` to use local provider instance instead of legacy facade.
3333
- [x] Update documentation
34+
- [x] Improve Chat UI and Google 3 Model Support:
35+
- [x] Add Gemini 3 Flash and update Gemini 3 Pro in `google-models.ts`.
36+
- [x] Improve `ChatInput` with `ModelSelector`, `Context`, `SpeechButton`, and `ActionMenu`.
37+
- [x] Create `ChatSidebar` for agent details, checkpoints, and memory settings.
38+
- [x] Update `ChatPage` layout to include sidebar and adjust height for Navbar.
39+
- [x] Restore all features to `ChatHeader` and add `mt-16` to lower it below the Navbar.
40+
- [x] Add `gemini3Expert` agent to `agents.ts`.
3441

3542
## Summary
3643

37-
Enhanced the GitHub toolset in `src/mastra/tools/github.ts` by adding 5 new tools:
44+
Enhanced the Chat UI and added support for Google Gemini 3 models:
3845

39-
1. `createPullRequest`: Create a new PR with title, head, base, and body.
40-
2. `mergePullRequest`: Merge an existing PR using merge, squash, or rebase methods.
41-
3. `addIssueComment`: Add comments to issues or PRs.
42-
4. `getPullRequest`: Retrieve detailed information about a specific PR.
43-
5. `getIssue`: Retrieve detailed information about a specific issue.
44-
45-
Fixed a TypeScript error in `src/mastra/agents/bgColorAgent.ts` where `colorChangeTool` was incompatible with the `Agent` class.
46-
47-
Fixed a runtime error in `app/components/navbar.tsx` caused by `NavigationMenuTrigger` receiving multiple children when `asChild` was true. The `NavigationMenuTrigger` component in `ui/navigation-menu.tsx` was updated to only render the chevron icon when `asChild` is false.
48-
49-
Updated `src/mastra/config/google.ts` and `src/mastra/config/pg-storage.ts` to be compatible with `@ai-sdk/google` v3. This involved:
50-
51-
- Using `createGoogleGenerativeAI` to create a provider instance in `google.ts`.
52-
- Updating `pg-storage.ts` to import the `google` provider from the local config instead of the removed facade in `@ai-sdk/google`.
53-
- Removing unnecessary type casts in `pg-storage.ts`.
46+
1. **Google 3 Models**: Added `gemini-3-flash-preview` and updated `gemini-3-pro-preview` in the model configuration.
47+
2. **Chat UI Improvement**:
48+
- **Rich Input**: The `ChatInput` now features a model selector, token usage context, speech-to-text button, and an action menu for attachments.
49+
- **Sidebar Layout**: Added a `ChatSidebar` that displays agent capabilities, conversation checkpoints, and memory configuration (Thread ID/Resource ID).
50+
- **Lowered Header**: The `ChatHeader` now has a top margin (`mt-16`) to sit perfectly below the fixed global Navbar. All original features (checkpoints, memory settings, usage) have been restored to the header while also being available in the sidebar.
51+
- **Layout Adjustment**: Updated the `ChatPage` height to `h-[calc(100vh-4rem)]` to account for the Navbar height and prevent unwanted scrolling.
52+
3. **New Agent**: Added a specialized `Gemini 3 Expert` agent configuration.

app/chat/components/agent-chain-of-thought.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export function AgentChainOfThought({
2626
defaultOpen = true,
2727
className,
2828
}: AgentChainOfThoughtProps) {
29-
if (!steps || steps.length === 0) {return null}
30-
3129
const completedCount = useMemo(() => steps.filter((s) => s.status === "complete").length, [steps])
3230
const activeStep = useMemo(() => steps.find((s) => s.status === "active"), [steps])
3331

32+
if (steps.length === 0) {return null}
33+
3434
return (
3535
<ChainOfThought defaultOpen={defaultOpen} className={className}>
3636
<ChainOfThoughtHeader className="flex items-center gap-2">
@@ -59,7 +59,7 @@ export function AgentChainOfThought({
5959
description={step.description}
6060
status={step.status}
6161
>
62-
{step.duration && step.status === "complete" && (
62+
{(Boolean(step.duration)) && step.status === "complete" && (
6363
<span className="flex items-center gap-1 text-xs text-muted-foreground">
6464
<ClockIcon className="size-3" />
6565
{step.duration}s

app/chat/components/agent-checkpoint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function AgentCheckpoint({
5757
onRestore,
5858
className,
5959
}: AgentCheckpointProps) {
60-
const date = timestamp ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined
60+
const date = timestamp !== undefined ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined
6161
const displayLabel = label ?? (date
6262
? `Checkpoint at ${formatTime(date)}`
6363
: `Checkpoint ${messageIndex + 1}`)

app/chat/components/agent-inline-citation.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ interface AgentInlineCitationProps {
2424
}
2525

2626
export function AgentInlineCitation({ citations, text }: AgentInlineCitationProps) {
27-
const citation = citations[0]
28-
if (!citation) {return <span>{text}</span>}
27+
if (citations.length === 0) {return <span>{text}</span>}
2928

3029
return (
3130
<InlineCitation>

app/chat/components/agent-queue.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ function TaskSection({
117117
)}
118118
</QueueItemActions>
119119
</div>
120-
{task.description && (
120+
{(Boolean(task.description)) && (
121121
<QueueItemDescription>{task.description}</QueueItemDescription>
122122
)}
123-
{task.error && (
123+
{(Boolean(task.error)) && (
124124
<QueueItemDescription className="text-destructive">
125125
{task.error}
126126
</QueueItemDescription>

app/chat/components/chat-header.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function ChatHeader() {
116116
const usedTokens = usage ? usage.inputTokens + usage.outputTokens : 0
117117

118118
return (
119-
<header className="flex items-center justify-between border-b border-border px-4 py-3">
119+
<header className="flex items-center justify-between border-b border-border px-4 py-3 mt-16">
120120
<div className="flex items-center gap-3">
121121
<MessageSquareIcon className="size-5 text-muted-foreground" />
122122
<div className="flex flex-col">
@@ -201,15 +201,15 @@ export function ChatHeader() {
201201
<Button
202202
variant="outline"
203203
size="sm"
204-
className="min-w-[140px] justify-between gap-2"
204+
className="min-w-35 justify-between gap-2"
205205
>
206206
<CpuIcon className="size-3.5 text-muted-foreground" />
207207
<span className="truncate text-xs">{selectedModel.name}</span>
208208
</Button>
209209
</ModelSelectorTrigger>
210-
<ModelSelectorContent className="w-[340px]">
210+
<ModelSelectorContent className="w-85">
211211
<ModelSelectorInput placeholder="Search models..." />
212-
<ModelSelectorList className="max-h-[400px]">
212+
<ModelSelectorList className="max-h-100">
213213
<ModelSelectorEmpty>No models found.</ModelSelectorEmpty>
214214
{PROVIDER_ORDER.map((provider) => {
215215
const models = modelsByProvider[provider]
@@ -266,9 +266,9 @@ export function ChatHeader() {
266266
<span className="truncate">{agentConfig?.name ?? selectedAgent}</span>
267267
</Button>
268268
</ModelSelectorTrigger>
269-
<ModelSelectorContent className="w-[320px]">
269+
<ModelSelectorContent className="w-80">
270270
<ModelSelectorInput placeholder="Search agents..." />
271-
<ModelSelectorList className="max-h-[400px]">
271+
<ModelSelectorList className="max-h-100">
272272
<ModelSelectorEmpty>No agents found.</ModelSelectorEmpty>
273273
{CATEGORY_ORDER.map((category) => {
274274
const agents = agentsByCategory[category]
@@ -282,7 +282,7 @@ export function ChatHeader() {
282282
{agents.map((agent) => (
283283
<ModelSelectorItem
284284
key={agent.id}
285-
value={agent.id}
285+
value={agent.name}
286286
onSelect={() => handleSelectAgent(agent)}
287287
className="flex items-center justify-between"
288288
>

0 commit comments

Comments
 (0)