Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions web/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,13 @@ export default function HomePage() {
const empty = turns.length === 0

function handleCommand(command: string) {
if (command === "info") {
const [cmd, ...args] = command.trim().split(/\s+/)
if (cmd === "info") {
const windowArg = args[0]
setTurns((prev) => [
...prev,
{ mode: "chat", role: "user", content: "/info" },
{ mode: "command", command: "info" },
{ mode: "chat", role: "user", content: `/${command}` },
{ mode: "command", command: "info", window: windowArg },
])
}
}
Expand Down Expand Up @@ -386,6 +388,7 @@ export default function HomePage() {
key={`cmd-${i}`}
projectId={project.id}
projectName={project.name}
window={t.window}
onAction={handleSuggestedAction}
/>
) : null
Expand Down
2 changes: 1 addition & 1 deletion web/components/chat/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function ChatInput({
const cmdName = trimmed.slice(1).split(/\s/)[0]
const match = getFilteredCommands(cmdName).find((c) => c.name === cmdName)
if (match) {
executeCommand(match.name)
executeCommand(trimmed.slice(1))
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion web/components/chat/CommandPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type SlashCommand = {
}

const COMMANDS: SlashCommand[] = [
{ name: "info", description: "Show project overview (services, timeline, clusters)", icon: <Activity className="size-4" /> },
{ name: "info", description: "Show project overview, optional window like 1h, 24h", icon: <Activity className="size-4" /> },
]

interface CommandPickerProps {
Expand Down
7 changes: 4 additions & 3 deletions web/components/projects/ProjectOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function shortDate(iso: string): string {
interface ProjectOverviewProps {
projectId: string
projectName: string
window?: string
onAction: (action: SuggestedAction) => void
}

Expand All @@ -59,14 +60,14 @@ interface ProjectOverviewProps {
* services, and suggested next actions. Fetched live on mount; not persisted
* as a chat message.
*/
export function ProjectOverview({ projectId, projectName, onAction }: ProjectOverviewProps) {
export function ProjectOverview({ projectId, projectName, window, onAction }: ProjectOverviewProps) {
const [overview, setOverview] = useState<Overview | null>(null)
const [failed, setFailed] = useState(false)

useEffect(() => {
let cancelled = false
setOverview(null)
api.projects.overview(projectId)
api.projects.overview(projectId, window)
.then((d: Overview) => { if (!cancelled) setOverview(d) })
.catch((e: any) => {
if (!cancelled) {
Expand All @@ -75,7 +76,7 @@ export function ProjectOverview({ projectId, projectName, onAction }: ProjectOve
}
})
return () => { cancelled = true }
}, [projectId])
}, [projectId, window])

if (failed) return null
if (!overview) {
Expand Down
1 change: 1 addition & 0 deletions web/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export type Turn =
| {
mode: "command"
command: string
window?: string
}

export type ConversationSummary = {
Expand Down
Loading