provider.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { ProviderConfig } from "@/app/store";
  2. import { ProviderConfigProps } from "../types";
  3. import { ListItem, PasswordInput } from "../../ui-lib";
  4. import Locale from "@/app/locales";
  5. import { REMOTE_API_HOST } from "@/app/constant";
  6. export function AnthropicProviderConfig(
  7. props: ProviderConfigProps<ProviderConfig["anthropic"]>,
  8. ) {
  9. return (
  10. <>
  11. <ListItem
  12. title={Locale.Settings.Endpoint.Title}
  13. subTitle={Locale.Settings.Endpoint.SubTitle}
  14. >
  15. <input
  16. type="text"
  17. value={props.config.endpoint}
  18. placeholder={REMOTE_API_HOST}
  19. onChange={(e) =>
  20. props.updateConfig(
  21. (config) => (config.endpoint = e.currentTarget.value),
  22. )
  23. }
  24. ></input>
  25. </ListItem>
  26. <ListItem
  27. title={Locale.Settings.Token.Title}
  28. subTitle={Locale.Settings.Token.SubTitle}
  29. >
  30. <PasswordInput
  31. value={props.config.apiKey}
  32. type="text"
  33. placeholder={Locale.Settings.Token.Placeholder}
  34. onChange={(e) => {
  35. props.updateConfig(
  36. (config) => (config.apiKey = e.currentTarget.value),
  37. );
  38. }}
  39. />
  40. </ListItem>
  41. <ListItem title={"Anthropic Version"} subTitle={"填写 API 版本号"}>
  42. <PasswordInput
  43. value={props.config.version}
  44. type="text"
  45. onChange={(e) => {
  46. props.updateConfig(
  47. (config) => (config.version = e.currentTarget.value),
  48. );
  49. }}
  50. />
  51. </ListItem>
  52. <ListItem
  53. title={Locale.Settings.CustomModel.Title}
  54. subTitle={Locale.Settings.CustomModel.SubTitle}
  55. >
  56. <input
  57. type="text"
  58. value={props.config.customModels}
  59. placeholder="model1,model2,model3"
  60. onChange={(e) =>
  61. props.updateConfig(
  62. (config) => (config.customModels = e.currentTarget.value),
  63. )
  64. }
  65. ></input>
  66. </ListItem>
  67. </>
  68. );
  69. }