-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Enhance stock analysis agent and other components #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,11 +26,11 @@ export function AgentChainOfThought({ | |||||||||
| defaultOpen = true, | ||||||||||
| className, | ||||||||||
| }: AgentChainOfThoughtProps) { | ||||||||||
| if (!steps || steps.length === 0) {return null} | ||||||||||
|
|
||||||||||
| const completedCount = useMemo(() => steps.filter((s) => s.status === "complete").length, [steps]) | ||||||||||
| const activeStep = useMemo(() => steps.find((s) => s.status === "active"), [steps]) | ||||||||||
|
|
||||||||||
| if (steps.length === 0) {return null} | ||||||||||
|
||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <ChainOfThought defaultOpen={defaultOpen} className={className}> | ||||||||||
| <ChainOfThoughtHeader className="flex items-center gap-2"> | ||||||||||
|
|
@@ -59,7 +59,7 @@ export function AgentChainOfThought({ | |||||||||
| description={step.description} | ||||||||||
| status={step.status} | ||||||||||
| > | ||||||||||
| {step.duration && step.status === "complete" && ( | ||||||||||
| {(Boolean(step.duration)) && step.status === "complete" && ( | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The explicit
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider removing redundant Boolean() wrapper. The explicit -{(Boolean(step.duration)) && step.status === "complete" && (
+{step.duration && step.status === "complete" && (🤖 Prompt for AI Agents
|
||||||||||
| {(Boolean(step.duration)) && step.status === "complete" && ( | |
| {step.duration && step.status === "complete" && ( |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,7 +57,7 @@ export function AgentCheckpoint({ | |||||||||
| onRestore, | ||||||||||
| className, | ||||||||||
| }: AgentCheckpointProps) { | ||||||||||
| const date = timestamp ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined | ||||||||||
| const date = timestamp !== undefined ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change might introduce a runtime error. The original check
Suggested change
|
||||||||||
| const date = timestamp !== undefined ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined | |
| const date = timestamp ? (typeof timestamp === "string" ? new Date(timestamp) : timestamp) : undefined |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,8 +24,7 @@ interface AgentInlineCitationProps { | |||||||||
| } | ||||||||||
|
|
||||||||||
| export function AgentInlineCitation({ citations, text }: AgentInlineCitationProps) { | ||||||||||
| const citation = citations[0] | ||||||||||
| if (!citation) {return <span>{text}</span>} | ||||||||||
| if (citations.length === 0) {return <span>{text}</span>} | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Suggest formatting the conditional return for readability. The logic is correct, but placing the return statement on the same line reduces readability. 🔎 Proposed formatting improvement- if (citations.length === 0) {return <span>{text}</span>}
+ if (citations.length === 0) {
+ return <span>{text}</span>
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <InlineCitation> | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,10 +117,10 @@ function TaskSection({ | |
| )} | ||
| </QueueItemActions> | ||
| </div> | ||
| {task.description && ( | ||
| {(Boolean(task.description)) && ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| <QueueItemDescription>{task.description}</QueueItemDescription> | ||
| )} | ||
| {task.error && ( | ||
| {(Boolean(task.error)) && ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| <QueueItemDescription className="text-destructive"> | ||
| {task.error} | ||
| </QueueItemDescription> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -116,7 +116,7 @@ export function ChatHeader() { | |||||
| const usedTokens = usage ? usage.inputTokens + usage.outputTokens : 0 | ||||||
|
|
||||||
| return ( | ||||||
| <header className="flex items-center justify-between border-b border-border px-4 py-3"> | ||||||
| <header className="flex items-center justify-between border-b border-border px-4 py-3 mt-16"> | ||||||
| <div className="flex items-center gap-3"> | ||||||
| <MessageSquareIcon className="size-5 text-muted-foreground" /> | ||||||
| <div className="flex flex-col"> | ||||||
|
|
@@ -201,15 +201,15 @@ export function ChatHeader() { | |||||
| <Button | ||||||
| variant="outline" | ||||||
| size="sm" | ||||||
| className="min-w-[140px] justify-between gap-2" | ||||||
| className="min-w-35 justify-between gap-2" | ||||||
| > | ||||||
| <CpuIcon className="size-3.5 text-muted-foreground" /> | ||||||
| <span className="truncate text-xs">{selectedModel.name}</span> | ||||||
| </Button> | ||||||
| </ModelSelectorTrigger> | ||||||
| <ModelSelectorContent className="w-[340px]"> | ||||||
| <ModelSelectorContent className="w-85"> | ||||||
| <ModelSelectorInput placeholder="Search models..." /> | ||||||
| <ModelSelectorList className="max-h-[400px]"> | ||||||
| <ModelSelectorList className="max-h-100"> | ||||||
|
Comment on lines
+204
to
+212
|
||||||
| <ModelSelectorEmpty>No models found.</ModelSelectorEmpty> | ||||||
| {PROVIDER_ORDER.map((provider) => { | ||||||
| const models = modelsByProvider[provider] | ||||||
|
|
@@ -266,9 +266,9 @@ export function ChatHeader() { | |||||
| <span className="truncate">{agentConfig?.name ?? selectedAgent}</span> | ||||||
| </Button> | ||||||
| </ModelSelectorTrigger> | ||||||
| <ModelSelectorContent className="w-[320px]"> | ||||||
| <ModelSelectorContent className="w-80"> | ||||||
| <ModelSelectorInput placeholder="Search agents..." /> | ||||||
| <ModelSelectorList className="max-h-[400px]"> | ||||||
| <ModelSelectorList className="max-h-100"> | ||||||
| <ModelSelectorEmpty>No agents found.</ModelSelectorEmpty> | ||||||
| {CATEGORY_ORDER.map((category) => { | ||||||
| const agents = agentsByCategory[category] | ||||||
|
|
@@ -282,7 +282,7 @@ export function ChatHeader() { | |||||
| {agents.map((agent) => ( | ||||||
| <ModelSelectorItem | ||||||
| key={agent.id} | ||||||
| value={agent.id} | ||||||
| value={agent.name} | ||||||
|
||||||
| value={agent.name} | |
| value={agent.id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better performance, it's a good practice to have early returns at the beginning of the function body, before any hooks like
useMemoare called. This avoids unnecessary computations when the component is going to returnnullanyway. Consider moving theif (steps.length === 0)check to be the first line in the component.