Add welcome text when user has to make his first input

This commit is contained in:
Saoud Rizwan
2024-07-10 01:06:07 -04:00
parent bd35b18fd0
commit c8d4e1d4e8
4 changed files with 17 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ https://github.com/microsoft/vscode-webview-ui-toolkit-samples/tree/main/framewo
export function activate(context: vscode.ExtensionContext) { export function activate(context: vscode.ExtensionContext) {
// Use the console to output diagnostic information (console.log) and errors (console.error) // Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated // This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "claude-dev" is now active!') //console.log('Congratulations, your extension "claude-dev" is now active!')
// The command has been defined in the package.json file // The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand // Now provide the implementation of the command with registerCommand
@@ -35,7 +35,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push( context.subscriptions.push(
vscode.commands.registerCommand("claude-dev.plusButtonTapped", async () => { vscode.commands.registerCommand("claude-dev.plusButtonTapped", async () => {
const message = "claude-dev.plusButtonTapped!" //const message = "claude-dev.plusButtonTapped!"
//vscode.window.showInformationMessage(message) //vscode.window.showInformationMessage(message)
await provider.clearTask() await provider.clearTask()
await provider.postStateToWebview() await provider.postStateToWebview()
@@ -45,8 +45,8 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push( context.subscriptions.push(
vscode.commands.registerCommand("claude-dev.settingsButtonTapped", () => { vscode.commands.registerCommand("claude-dev.settingsButtonTapped", () => {
const message = "claude-dev.settingsButtonTapped!" //const message = "claude-dev.settingsButtonTapped!"
vscode.window.showInformationMessage(message) //vscode.window.showInformationMessage(message)
provider.postMessageToWebview({ type: "action", action: "settingsButtonTapped"}) provider.postMessageToWebview({ type: "action", action: "settingsButtonTapped"})
}) })
) )

View File

@@ -1,5 +1,5 @@
import { ClaudeAsk, ClaudeMessage, ExtensionMessage } from "@shared/ExtensionMessage" import { ClaudeAsk, ClaudeMessage, ExtensionMessage } from "@shared/ExtensionMessage"
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react" import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import { KeyboardEvent, useEffect, useMemo, useRef, useState } from "react" import { KeyboardEvent, useEffect, useMemo, useRef, useState } from "react"
import DynamicTextArea from "react-textarea-autosize" import DynamicTextArea from "react-textarea-autosize"
import { vscode } from "../utilities/vscode" import { vscode } from "../utilities/vscode"
@@ -255,7 +255,7 @@ const ChatView = ({ messages }: ChatViewProps) => {
flexDirection: "column", flexDirection: "column",
overflow: "hidden", overflow: "hidden",
}}> }}>
{task && ( {task ? (
<TaskHeader <TaskHeader
taskText={task.text || ""} taskText={task.text || ""}
tokensIn={apiMetrics.totalTokensIn} tokensIn={apiMetrics.totalTokensIn}
@@ -263,6 +263,14 @@ const ChatView = ({ messages }: ChatViewProps) => {
totalCost={apiMetrics.totalCost} totalCost={apiMetrics.totalCost}
onClose={handleTaskCloseButtonClick} onClose={handleTaskCloseButtonClick}
/> />
) : (
<div style={{ padding: "0 25px" }}>
<h2>What can I do for you?</h2>
<p>
{/*prettier-ignore*/}
Thanks to <VSCodeLink href="https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf" style={{ display: "inline" }}>Claude 3.5 Sonnet's agentic coding capabilities</VSCodeLink>, I can handle complex software development tasks step-by-step. With tools that let me read & write files, create entire projects from scratch, and execute terminal commands (after you grant permission), I can assist you in ways that go beyond simple code completion or tech support.
</p>
</div>
)} )}
<div <div
id="chat-view-container" id="chat-view-container"
@@ -306,7 +314,7 @@ const ChatView = ({ messages }: ChatViewProps) => {
onChange={(e) => setInputValue(e.target.value)} onChange={(e) => setInputValue(e.target.value)}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
onHeightChange={() => scrollToBottom(true)} onHeightChange={() => scrollToBottom(true)}
placeholder="Type a message..." placeholder={task ? "Type a message..." : "Type your task here..."}
maxRows={10} maxRows={10}
autoFocus={true} autoFocus={true}
style={{ style={{

View File

@@ -148,10 +148,9 @@ const SettingsView = ({ apiKey, setApiKey, maxRequestsPerTask, setMaxRequestsPer
textAlign: "center", textAlign: "center",
color: "var(--vscode-descriptionForeground)", color: "var(--vscode-descriptionForeground)",
fontSize: "12px", fontSize: "12px",
lineHeight: "1.5", lineHeight: "1.2",
fontStyle: "italic", fontStyle: "italic",
}}> }}>
<p>Made possible by the latest breakthroughs in Claude 3.5 Sonnet's agentic coding capabilities.</p>
<p> <p>
This project was made for Anthropic's "Build with Claude June 2024 contest" This project was made for Anthropic's "Build with Claude June 2024 contest"
<VSCodeLink href="https://github.com/saoudrizwan/claude-dev"> <VSCodeLink href="https://github.com/saoudrizwan/claude-dev">

View File

@@ -40,7 +40,7 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({ taskText, tokensIn, tokensOut,
<span className="codicon codicon-close"></span> <span className="codicon codicon-close"></span>
</VSCodeButton> </VSCodeButton>
</div> </div>
<div style={{ fontSize: "var(--vscode-font-size)", lineHeight: "1.5" }}> <div style={{ fontSize: "var(--vscode-font-size)" }}>
<TextTruncate <TextTruncate
line={isExpanded ? 0 : 3} line={isExpanded ? 0 : 3}
element="span" element="span"