Skip to content

Commit ee15d0d

Browse files
committed
Add X to exit connect banner
1 parent 184dc30 commit ee15d0d

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

cli/src/components/chatgpt-connect-banner.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'
22

33
import { Button } from './button'
44
import { useTheme } from '../hooks/use-theme'
5+
import { useChatStore } from '../state/chat-store'
56
import {
67
connectChatGptOAuth,
78
disconnectChatGptOAuth,
@@ -20,10 +21,12 @@ type FlowState =
2021

2122
export const ChatGptConnectBanner = () => {
2223
const theme = useTheme()
24+
const setInputMode = useChatStore((state) => state.setInputMode)
2325
const [flowState, setFlowState] = useState<FlowState>('checking')
2426
const [error, setError] = useState<string | null>(null)
2527
const [authUrl, setAuthUrl] = useState<string | null>(null)
2628
const [hovered, setHovered] = useState(false)
29+
const [isCloseHovered, setIsCloseHovered] = useState(false)
2730

2831
useEffect(() => {
2932
const status = getChatGptOAuthStatus()
@@ -86,8 +89,20 @@ export const ChatGptConnectBanner = () => {
8689
customBorderChars: BORDER_CHARS,
8790
}
8891

89-
const escHint = (
90-
<text style={{ fg: theme.muted }}> esc</text>
92+
const handleClose = () => {
93+
setInputMode('default')
94+
}
95+
96+
const closeButton = (
97+
<Button
98+
onClick={handleClose}
99+
onMouseOver={() => setIsCloseHovered(true)}
100+
onMouseOut={() => setIsCloseHovered(false)}
101+
>
102+
<text style={{ fg: isCloseHovered ? theme.error : theme.muted }}>
103+
x
104+
</text>
105+
</Button>
91106
)
92107

93108
if (flowState === 'connected') {
@@ -105,7 +120,7 @@ export const ChatGptConnectBanner = () => {
105120
<span fg={theme.muted}>Disconnect</span>
106121
</text>
107122
</Button>
108-
{escHint}
123+
{closeButton}
109124
</box>
110125
</box>
111126
)
@@ -128,7 +143,7 @@ export const ChatGptConnectBanner = () => {
128143
<span fg={theme.foreground}>Retry</span>
129144
</text>
130145
</Button>
131-
{escHint}
146+
{closeButton}
132147
</box>
133148
</box>
134149
)
@@ -139,7 +154,7 @@ export const ChatGptConnectBanner = () => {
139154
<box style={{ ...panelStyle, flexDirection: 'column' }}>
140155
<box style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
141156
<text style={{ fg: theme.foreground }}>Connecting to ChatGPT...</text>
142-
{escHint}
157+
{closeButton}
143158
</box>
144159
<text style={{ fg: theme.muted }}>
145160
Sign in via your browser to connect.
@@ -166,7 +181,7 @@ export const ChatGptConnectBanner = () => {
166181
<span fg={theme.link}>Connect to ChatGPT</span>
167182
</text>
168183
</Button>
169-
{escHint}
184+
{closeButton}
170185
</box>
171186
)
172187
}

scripts/test-fireworks-long.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
export { }
1414

1515
const FIREWORKS_BASE_URL = 'https://api.fireworks.ai/inference/v1'
16-
const FIREWORKS_MODEL = 'accounts/james-65d217/deployments/lnfid5h9'
17-
// const FIREWORKS_MODEL = 'accounts/fireworks/models/minimax-m2p5'
16+
// const FIREWORKS_MODEL = 'accounts/james-65d217/deployments/lnfid5h9'
17+
const FIREWORKS_MODEL = 'accounts/fireworks/models/minimax-m2p5'
1818

1919
// Pricing constants — https://fireworks.ai/pricing
2020
const INPUT_COST_PER_TOKEN = 0.30 / 1_000_000

0 commit comments

Comments
 (0)