diff --git a/src/views/webviewContent.ts b/src/views/webviewContent.ts index b9b9982..6551c7c 100644 --- a/src/views/webviewContent.ts +++ b/src/views/webviewContent.ts @@ -45,18 +45,103 @@ export function getWebviewContent(iconUri?: string): string { } .message { margin-bottom: 12px; - padding: 10px 15px; - border-radius: 8px; - max-width: 80%; } .user-message { + padding: 10px 15px; + border-radius: 8px; background: var(--vscode-button-secondaryBackground); + border: 1px solid var(--vscode-input-border); margin-left: auto; + width: fit-content; + max-width: 80%; } .bot-message { - background: var(--vscode-button-background); - color: var(--vscode-button-foreground); - margin-right: auto; + padding: 0; + text-align: left; + color: var(--vscode-foreground); + max-width: 100%; + position: relative; + } + .message-actions { + display: flex; + gap: 8px; + margin-top: 12px; + margin-left: 10px; + opacity: 0.85; + transition: opacity 0.2s ease; + } + .message-actions:hover { + opacity: 1; + } + .action-btn { + background: transparent; + border: none; + cursor: pointer; + padding: 4px; + display: flex; + align-items: center; + justify-content: center; + color: var(--vscode-foreground); + opacity: 0.9; + transition: opacity 0.2s ease; + position: relative; + } + .action-btn:hover { + opacity: 1; + } + .action-btn svg { + width: 14px; + height: 14px; + } + .action-btn.active { + color: var(--vscode-button-background); + opacity: 1; + } + .action-btn .action-tooltip { + visibility: hidden; + width: auto; + background: #1e1e1e; + color: #ffffff; + text-align: center; + border-radius: 4px; + border: 1px solid rgba(255, 255, 255, 0.2); + padding: 4px 8px; + position: absolute; + z-index: 1000; + bottom: 125%; + left: 50%; + transform: translateX(-50%) translateY(5px); + opacity: 0; + transition: all 0.2s ease; + font-size: 12px; + white-space: nowrap; + pointer-events: none; + } + .action-btn .action-tooltip::after { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #1e1e1e transparent transparent transparent; + } + .action-btn .action-tooltip::before { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -6px; + border-width: 6px; + border-style: solid; + border-color: rgba(255, 255, 255, 0.2) transparent transparent transparent; + z-index: -1; + } + .action-btn:hover .action-tooltip { + visibility: visible; + opacity: 1; + transform: translateX(-50%) translateY(0); } .input-area { border-top: 1px solid var(--vscode-panel-border); @@ -65,8 +150,8 @@ export function getWebviewContent(iconUri?: string): string { } .input-group { display: flex; + flex-direction: column; gap: 10px; - align-items: flex-end; background: var(--vscode-input-background); border: 1px solid var(--vscode-input-border); border-radius: 8px; @@ -82,16 +167,27 @@ export function getWebviewContent(iconUri?: string): string { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.2); } .input-wrapper { - flex: 1; display: flex; flex-direction: column; gap: 8px; + width: 100%; + } + .input-bottom-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; } .mode-selector { display: flex; align-items: center; position: relative; } + .input-actions { + display: flex; + align-items: center; + gap: 10px; + } .mode-selector select { padding: 2px 4px; background: transparent; @@ -140,7 +236,17 @@ export function getWebviewContent(iconUri?: string): string { border-width: 6px; border-style: solid; border-color: #1e1e1e transparent transparent transparent; - filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); + } + .tooltip .tooltiptext::before { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -7px; + border-width: 7px; + border-style: solid; + border-color: rgba(255, 255, 255, 0.2) transparent transparent transparent; + z-index: -1; } .tooltip:hover .tooltiptext { visibility: visible; @@ -157,8 +263,25 @@ export function getWebviewContent(iconUri?: string): string { font-family: inherit; resize: none; min-height: 40px; + max-height: 200px; outline: none; box-sizing: border-box; + overflow-y: auto; + line-height: 1.5; + } + /* 简洁的滚动条样式 */ + textarea::-webkit-scrollbar { + width: 8px; + } + textarea::-webkit-scrollbar-track { + background: transparent; + } + textarea::-webkit-scrollbar-thumb { + background: rgba(128, 128, 128, 0.5); + border-radius: 4px; + } + textarea::-webkit-scrollbar-button { + display: none; } button { padding: 0 20px; @@ -180,8 +303,6 @@ export function getWebviewContent(iconUri?: string): string { transition: opacity 0.2s ease; width: 32px; height: 32px; - align-self: flex-end; - margin-bottom: -6px; } .optimize-button:hover { opacity: 0.7; @@ -299,8 +420,6 @@ export function getWebviewContent(iconUri?: string): string { flex-direction: column; align-items: center; position: relative; - align-self: flex-end; - margin-bottom: -10px; } .context-info { display: flex; @@ -475,63 +594,66 @@ export function getWebviewContent(iconUri?: string): string { placeholder="输入您的问题..." onkeydown="if(event.key === 'Enter' && !event.shiftKey) { event.preventDefault(); sendMessage(); }" > -