Skip to content

Commit e04d8d6

Browse files
address comments left by @cte on #1562 (Add prompt caching to OpenAI-compatible custom model info);
1 parent e72aba6 commit e04d8d6

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -964,19 +964,11 @@ const ApiOptions = ({
964964
apiConfiguration?.openAiCustomModelInfo?.cacheReadsPrice?.toString() ?? "0"
965965
}
966966
type="text"
967-
style={{
968-
borderColor: (() => {
969-
const value = apiConfiguration?.openAiCustomModelInfo?.cacheReadsPrice
970-
971-
if (!value && value !== 0) {
972-
return "var(--vscode-input-border)"
973-
}
974-
975-
return value >= 0
976-
? "var(--vscode-charts-green)"
977-
: "var(--vscode-errorForeground)"
978-
})(),
979-
}}
967+
className={cn("w-full", {
968+
"border-vscode-input": !apiConfiguration?.openAiCustomModelInfo?.cacheReadsPrice && apiConfiguration?.openAiCustomModelInfo?.cacheReadsPrice !== 0,
969+
"border-vscode-green": apiConfiguration?.openAiCustomModelInfo?.cacheReadsPrice >= 0,
970+
"border-vscode-error": apiConfiguration?.openAiCustomModelInfo?.cacheReadsPrice < 0,
971+
})}
980972
onChange={handleInputChange("openAiCustomModelInfo", (e) => {
981973
const value = (e.target as HTMLInputElement).value
982974
const parsed = parseFloat(value)
@@ -1005,19 +997,11 @@ const ApiOptions = ({
1005997
apiConfiguration?.openAiCustomModelInfo?.cacheWritesPrice?.toString() ?? "0"
1006998
}
1007999
type="text"
1008-
style={{
1009-
borderColor: (() => {
1010-
const value = apiConfiguration?.openAiCustomModelInfo?.cacheWritesPrice
1011-
1012-
if (!value && value !== 0) {
1013-
return "var(--vscode-input-border)"
1014-
}
1015-
1016-
return value >= 0
1017-
? "var(--vscode-charts-green)"
1018-
: "var(--vscode-errorForeground)"
1019-
})(),
1020-
}}
1000+
className={cn("w-full", {
1001+
"border-vscode-input": !apiConfiguration?.openAiCustomModelInfo?.cacheWritesPrice && apiConfiguration?.openAiCustomModelInfo?.cacheWritesPrice !== 0,
1002+
"border-vscode-green": apiConfiguration?.openAiCustomModelInfo?.cacheWritesPrice >= 0,
1003+
"border-vscode-error": apiConfiguration?.openAiCustomModelInfo?.cacheWritesPrice < 0,
1004+
})}
10211005
onChange={handleInputChange("openAiCustomModelInfo", (e) => {
10221006
const value = (e.target as HTMLInputElement).value
10231007
const parsed = parseFloat(value)

webview-ui/src/index.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@
159159
border-color: var(--border);
160160
}
161161

162+
.border-vscode-input {
163+
border-color: var(--vscode-input-border);
164+
}
165+
166+
.border-vscode-green {
167+
border-color: var(--vscode-charts-green);
168+
}
169+
170+
.border-vscode-error {
171+
border-color: var(--vscode-errorForeground);
172+
}
173+
162174
/* Code Block Styles */
163175
pre,
164176
code {

0 commit comments

Comments
 (0)