Minor fixes

This commit is contained in:
Saoud Rizwan
2024-08-25 05:48:17 -04:00
parent cfb3c20afa
commit d7a31705a9
2 changed files with 69 additions and 52 deletions

View File

@@ -32,12 +32,14 @@ const App: React.FC = () => {
const [taskHistory, setTaskHistory] = useState<HistoryItem[]>([])
const [showAnnouncement, setShowAnnouncement] = useState(false)
const [koduCredits, setKoduCredits] = useState<number | undefined>(undefined)
const [isNewUser, setIsNewUser] = useState(false)
useEffect(() => {
vscode.postMessage({ type: "webviewDidLaunch" })
}, [])
const handleMessage = useCallback((e: MessageEvent) => {
const handleMessage = useCallback(
(e: MessageEvent) => {
const message: ExtensionMessage = e.data
switch (message.type) {
case "state":
@@ -48,9 +50,14 @@ const App: React.FC = () => {
message.state!.apiConfiguration?.awsAccessKey !== undefined ||
message.state!.apiConfiguration?.koduApiKey !== undefined
setShowWelcome(!hasKey)
if (!hasKey && !isNewUser) {
setIsNewUser(true)
}
setApiConfiguration(message.state!.apiConfiguration)
setMaxRequestsPerTask(
message.state!.maxRequestsPerTask !== undefined ? message.state!.maxRequestsPerTask.toString() : ""
message.state!.maxRequestsPerTask !== undefined
? message.state!.maxRequestsPerTask.toString()
: ""
)
setCustomInstructions(message.state!.customInstructions || "")
setAlwaysAllowReadOnly(message.state!.alwaysAllowReadOnly || false)
@@ -79,17 +86,27 @@ const App: React.FC = () => {
setShowHistory(false)
break
case "koduAuthenticated":
if (!isNewUser) {
setShowSettings(true)
setShowHistory(false)
}
break
}
break
}
// we don't need to define any dependencies since we're not using any state in the callback. if you were to use state, you'd either have to include it in the dependency array or use the updater function `setUserText(prev => `${prev}${key}`);`. (react-use takes care of not registering the same listener multiple times even if this callback is updated.)
}, [])
// (react-use takes care of not registering the same listener multiple times even if this callback is updated.)
},
[isNewUser]
)
useEvent("message", handleMessage)
useEffect(() => {
if (showWelcome === false) {
setIsNewUser(false)
}
}, [showWelcome])
const { selectedModelInfo } = useMemo(() => {
return normalizeApiConfiguration(apiConfiguration)
}, [apiConfiguration])

View File

@@ -54,9 +54,9 @@ const Announcement = ({ version, hideAnnouncement, apiConfiguration }: Announcem
</li>
<li>
Added "Always allow read-only operations" setting to let Claude read files and view directories
without needing to hit Allow.
without needing to approve (off by default)
</li>
<li>Added sliding window context management to keep tasks going past 200k tokens.</li>
<li>Added sliding window context management to keep tasks going past 200k tokens</li>
</ul>
<p style={{ margin: "0" }}>
Follow me for more updates!{" "}