From cceebdc04c27751f709dca48b7e1c44cf2c003a2 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:22:52 -0400 Subject: [PATCH] Bug fixes for openai provider --- src/ClaudeDev.ts | 2 +- webview-ui/src/components/ApiOptions.tsx | 7 +++---- webview-ui/src/components/ChatRow.tsx | 8 +++++--- webview-ui/src/components/HistoryPreview.tsx | 4 ++-- webview-ui/src/components/HistoryView.tsx | 12 +++++++----- webview-ui/src/components/TaskHeader.tsx | 2 +- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/ClaudeDev.ts b/src/ClaudeDev.ts index ab00a31..89712a4 100644 --- a/src/ClaudeDev.ts +++ b/src/ClaudeDev.ts @@ -917,7 +917,7 @@ export class ClaudeDev { } as ClaudeSayTool) ) return `The user accepted but made the following changes to your content:\n\n${userDiff}\n\nFinal result ${ - fileExists ? "applied to" : "written as new file" + fileExists ? "saved to" : "written as new file" } ${relPath}:\n\n${diffResult}` } else { const diffResult = diff.createPatch(relPath, originalContent, newContent) diff --git a/webview-ui/src/components/ApiOptions.tsx b/webview-ui/src/components/ApiOptions.tsx index 327ac41..bccd02b 100644 --- a/webview-ui/src/components/ApiOptions.tsx +++ b/webview-ui/src/components/ApiOptions.tsx @@ -73,7 +73,7 @@ const ApiOptions: React.FC = ({ showModelOptions, apiErrorMessa id="api-provider" value={selectedProvider} onChange={handleInputChange("apiProvider")} - style={{ minWidth: 125 }}> + style={{ minWidth: 130 }}> Anthropic OpenRouter AWS Bedrock @@ -294,9 +294,8 @@ const ApiOptions: React.FC = ({ showModelOptions, apiErrorMessa }}> You can use any OpenAI compatible API with models that support tool use.{" "} - (Note: Claude Dev uses complex prompts, so results - may vary depending on the quality of the model you choose. Less capable models may not work - as expected.) + (Note: Claude Dev uses complex prompts, so less + capable models may not work as expected.)

diff --git a/webview-ui/src/components/ChatRow.tsx b/webview-ui/src/components/ChatRow.tsx index ab84b37..eff54f4 100644 --- a/webview-ui/src/components/ChatRow.tsx +++ b/webview-ui/src/components/ChatRow.tsx @@ -93,7 +93,7 @@ const ChatRow: React.FC = ({ ] case "api_req_started": return [ - cost ? ( + cost != null ? ( @@ -104,7 +104,7 @@ const ChatRow: React.FC = ({ ) : ( ProgressIndicator ), - cost ? ( + cost != null ? ( API Request Complete ) : apiRequestFailedMessage ? ( API Request Failed @@ -266,7 +266,9 @@ const ChatRow: React.FC = ({
{icon} {title} - {cost && ${Number(cost)?.toFixed(4)}} + {cost != null && cost > 0 && ( + ${Number(cost)?.toFixed(4)} + )}
{ Tokens: ↑{item.tokensIn?.toLocaleString()} ↓{item.tokensOut?.toLocaleString()} - {item.cacheWrites && item.cacheReads && ( + {!!item.cacheWrites && ( <> {" • "} Cache: +{item.cacheWrites?.toLocaleString()} →{" "} - {item.cacheReads?.toLocaleString()} + {(item.cacheReads || 0).toLocaleString()} )} diff --git a/webview-ui/src/components/HistoryView.tsx b/webview-ui/src/components/HistoryView.tsx index 5f1f89d..af15635 100644 --- a/webview-ui/src/components/HistoryView.tsx +++ b/webview-ui/src/components/HistoryView.tsx @@ -65,12 +65,13 @@ const HistoryView = ({ onDone }: HistoryViewProps) => { const ExportButton = ({ itemId }: { itemId: string }) => ( { e.stopPropagation() handleExportMd(itemId) }}> -
EXPORT .MD
+
EXPORT
) @@ -81,11 +82,12 @@ const HistoryView = ({ onDone }: HistoryViewProps) => { .history-item:hover { background-color: var(--vscode-list-hoverBackground); } - .delete-button { + .delete-button, .export-button { opacity: 0; pointer-events: none; } - .history-item:hover .delete-button { + .history-item:hover .delete-button, + .history-item:hover .export-button { opacity: 1; pointer-events: auto; } @@ -282,7 +284,7 @@ const HistoryView = ({ onDone }: HistoryViewProps) => { {!item.totalCost && } - {item.cacheWrites && item.cacheReads && ( + {!!item.cacheWrites && (
{ marginBottom: 0, }} /> - {item.cacheReads?.toLocaleString()} + {(item.cacheReads || 0).toLocaleString()}
)} diff --git a/webview-ui/src/components/TaskHeader.tsx b/webview-ui/src/components/TaskHeader.tsx index 2ae382b..ffdda2f 100644 --- a/webview-ui/src/components/TaskHeader.tsx +++ b/webview-ui/src/components/TaskHeader.tsx @@ -103,7 +103,7 @@ const TaskHeader: React.FC = ({ marginBottom: "-2px", marginRight: "-2.5px", }}> -
EXPORT .MD
+
EXPORT
)