Skip to content

Commit

Permalink
clean up & apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
abeatrix committed Jan 7, 2025
1 parent b8a4a35 commit b529c9f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
8 changes: 6 additions & 2 deletions vscode/src/chat/agentic/DeepCody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ import { ACTIONS_TAGS, CODYAGENT_PROMPTS } from './prompts'
*/
export class DeepCodyAgent {
public static readonly id = 'deep-cody'
/**
* NOTE: Currently A/B test to default to 3.5 Haiku / 3.5 Sonnet for the review step.
*/
public static model: string | undefined = undefined

protected readonly multiplexer = new BotResponseMultiplexer()
Expand Down Expand Up @@ -289,7 +292,7 @@ export class DeepCodyAgent {
await this.multiplexer.notifyTurnComplete()
}

return accumulated.toString()
return accumulated.consumeAndClear()
}

protected getPrompter(items: ContextItem[]): DefaultPrompter {
Expand All @@ -313,7 +316,8 @@ export class RawTextProcessor {
this.parts.push(str)
}

public toString(): string {
// Destructive read that clears state
public consumeAndClear(): string {
const joined = this.parts.join('')
this.reset()
return joined
Expand Down
2 changes: 2 additions & 0 deletions vscode/src/chat/chat-view/ChatsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
handleCodeFromInsertAtCursor,
handleCodeFromSaveToNewFile,
} from '../../services/utils/codeblock-action-tracker'
import { CodyToolProvider } from '../agentic/CodyToolProvider'
import type { ChatIntentAPIClient } from '../context/chatIntentAPIClient'
import type { SmartApplyResult } from '../protocol'
import {
Expand Down Expand Up @@ -579,6 +580,7 @@ export class ChatsController implements vscode.Disposable {

public dispose(): void {
this.disposeAllChats()
CodyToolProvider.dispose()
vscode.Disposable.from(...this.disposables).dispose()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ export const AddContextButton: FunctionComponent<{
}> = ({ onClick, className }) => (
<Tooltip>
<TooltipTrigger asChild>
<Button variant="ghost" onClick={onClick} aria-label="Add context" className={className}>
<Button
variant="ghost"
size="none"
onClick={onClick}
aria-label="Add context"
className={className}
>
<AtSignIcon className="tw-w-8 tw-h-8" strokeWidth={1.25} />
</Button>
</TooltipTrigger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useTelemetryRecorder } from '../../../../../../utils/telemetry'
interface ToolboxButtonProps {
api: WebviewToExtensionAPI
settings: AgentToolboxSettings
className?: string
}

const ToolboxOptionText = {
Expand Down Expand Up @@ -44,7 +43,7 @@ export const ToolboxButton: FC<ToolboxButtonProps> = memo(({ settings, api }) =>
const onSubmit = useCallback(
(close: () => void) => {
setIsLoading(true)
api.updateToolboxSettings(settingsForm).subscribe({
const subscription = api.updateToolboxSettings(settingsForm).subscribe({
next: () => {
setIsLoading(false)
close()
Expand All @@ -54,7 +53,13 @@ export const ToolboxButton: FC<ToolboxButtonProps> = memo(({ settings, api }) =>
setSettingsForm(settings)
setIsLoading(false)
},
complete: () => {
setIsLoading(false)
},
})
return () => {
subscription.unsubscribe()
}
},
[api.updateToolboxSettings, settingsForm, settings]
)
Expand Down Expand Up @@ -149,13 +154,14 @@ export const ToolboxButton: FC<ToolboxButtonProps> = memo(({ settings, api }) =>
},
}}
>
<Button variant="ghost" className="!tw-p-2 tw-relative">
<BrainIcon size={16} strokeWidth={1.25} className="tw-w-8 tw-h-8" />
{settings.agent?.name ? (
<span className="tw-absolute tw-top-0 tw-right-0 tw-w-2 tw-h-2 tw-rounded-full tw-bg-green-500 tw-animate-[pulse_5s_ease-in-out_infinite]" />
) : (
<span className="tw-absolute tw-top-0 tw-right-0 tw-w-2 tw-h-2 tw-rounded-full tw-bg-red-500 tw-animate-[pulse_5s_ease-in-out_infinite]" />
)}
<Button variant="ghost" size="none">
<BrainIcon
size={16}
strokeWidth={1.25}
className={`tw-w-8 tw-h-8 ${
settings.agent?.name ? 'tw-text-green-500' : 'tw-text-muted-foreground'
}`}
/>
</Button>
</ToolbarPopoverItem>
</div>
Expand Down

0 comments on commit b529c9f

Please sign in to comment.