1
1
"use client"
2
2
3
- import { type Settings } from '../../types'
3
+ import { LLMVendor , type Settings } from '../../types'
4
4
import { useSettings } from '../../hooks/useSettings'
5
5
import { SettingInput } from '../../components/inputs/SettingInput'
6
6
import { Toggle } from '../../components/toggle'
7
7
8
8
type BaseField = {
9
9
label : string
10
10
description ?: string
11
+ vendorSpecific ?: LLMVendor
11
12
}
12
13
13
14
export type SpecializedField =
@@ -58,9 +59,14 @@ const fields: Partial<SettingsFields> & MiscPanelFields = {
58
59
options : [
59
60
{
60
61
description :
61
- 'OpenAI - about $0.08 per query (includes search + generation )' ,
62
+ 'OpenAI (will bill your own account, please be careful )' ,
62
63
value : 'OPENAI' ,
63
64
} ,
65
+ {
66
+ description :
67
+ 'Anthropic (will bill your own account, please be careful)' ,
68
+ value : 'ANTHROPIC' ,
69
+ } ,
64
70
/*
65
71
{
66
72
description: 'HuggingFace',
@@ -96,20 +102,46 @@ const fields: Partial<SettingsFields> & MiscPanelFields = {
96
102
description :
97
103
'You need a valid OpenAI account and API token to use this vendor' ,
98
104
type : 'section' ,
105
+ vendorSpecific : "OPENAI" ,
99
106
} ,
100
107
openAIKey : {
101
108
label : 'API Key' ,
102
109
description : '' ,
103
110
placeholder : 'Enter your OpenAI API access key' ,
104
111
type : 'password' ,
105
112
defaultValue : '' ,
113
+ vendorSpecific : 'OPENAI' ,
106
114
} ,
107
115
openAIModel : {
108
116
label : 'Language Model' ,
109
117
description : '' ,
110
- placeholder : 'Enter the model (default: gpt-4-turbo)' ,
118
+ placeholder : 'Enter the model (default: gpt-4o)' ,
119
+ type : 'text' ,
120
+ defaultValue : 'gpt-4o' ,
121
+ vendorSpecific : 'OPENAI' ,
122
+ } ,
123
+ anthropic : {
124
+ label : 'Anthropic Settings' ,
125
+ description :
126
+ 'You need a valid Anthropic account and API token to use this vendor' ,
127
+ type : 'section' ,
128
+ vendorSpecific : "ANTHROPIC" ,
129
+ } ,
130
+ anthropicKey : {
131
+ label : 'API Key' ,
132
+ description : '' ,
133
+ placeholder : 'Enter your Anthropic API access key' ,
134
+ type : 'password' ,
135
+ defaultValue : '' ,
136
+ vendorSpecific : 'ANTHROPIC' ,
137
+ } ,
138
+ anthropicModel : {
139
+ label : 'Language Model' ,
140
+ description : '' ,
141
+ placeholder : 'Enter the model (default: claude-3-5-sonnet-20240620)' ,
111
142
type : 'text' ,
112
- defaultValue : 'gpt-4-turbo' ,
143
+ defaultValue : 'claude-3-5-sonnet-20240620' ,
144
+ vendorSpecific : 'ANTHROPIC' ,
113
145
} ,
114
146
/*
115
147
customPrompts: {
@@ -168,6 +200,7 @@ const fields: Partial<SettingsFields> & MiscPanelFields = {
168
200
function Favorites ( ) {
169
201
const [ settings , setSettings ] = useSettings ( )
170
202
const isLoading = ! settings
203
+ const vendor : LLMVendor = settings . coreVendor
171
204
172
205
return isLoading ? (
173
206
< div className = "flex items-center justify-center h-screen w-screen text-gray-800" >
@@ -182,7 +215,7 @@ function Favorites() {
182
215
Settings
183
216
</ h3 >
184
217
< div className = "flex flex-col w-full" >
185
- { Object . entries ( fields ) . map (
218
+ { Object . entries ( fields ) . filter ( s => s [ 1 ] . vendorSpecific ? ( s [ 1 ] . vendorSpecific === vendor ) : true ) . map (
186
219
( [ name , { label, description, ...field } ] ) => (
187
220
< div key = { name } className = "flex flex-col py-3 w-full" >
188
221
{ field . type === 'section' ? (
0 commit comments