Fix/setting model page crash (#12594)

Co-authored-by: JzoNg <jzongcode@gmail.com>
This commit is contained in:
Joel 2025-01-10 13:10:58 +08:00 committed by GitHub
parent e370045ac4
commit 39ec6c8025
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 2514 additions and 168 deletions

View File

@ -0,0 +1,186 @@
<svg width="90" height="10" viewBox="0 0 90 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Anthropic" clip-path="url(#clip0_5981_49007)">
<g id="Clip path group">
<mask id="mask0_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_2">
<path id="Vector" d="M89.375 -0.00195312H0V9.99805H89.375V-0.00195312Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask0_5981_49007)">
<g id="Group">
<g id="Clip path group_2">
<mask id="mask1_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_4">
<path id="Vector_2" d="M0 -0.00390625H89.375V9.99609H0V-0.00390625Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask1_5981_49007)">
<g id="Group_2">
<g id="Clip path group_3">
<mask id="mask2_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_12">
<path id="Vector_3" d="M0 -0.00585938H89.375V9.99414H0V-0.00585938Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask2_5981_49007)">
<g id="Group_3">
<g id="Clip path group_4">
<mask id="mask3_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_89">
<path id="Vector_4" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask3_5981_49007)">
<g id="Group_4">
<g id="Group_5">
<g id="Group_6">
<path id="Vector_5" d="M18.1273 6.92438L13.7773 0.15625H11.4297V9.82501H13.4321V3.05688L17.7821 9.82501H20.1297V0.15625H18.1273V6.92438Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_5">
<mask id="mask4_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_80">
<path id="Vector_6" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask4_5981_49007)">
<g id="Group_7">
<g id="Group_8">
<g id="Group_9">
<path id="Vector_7" d="M21.7969 2.02094H25.0423V9.82501H27.1139V2.02094H30.3594V0.15625H21.7969V2.02094Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_6">
<mask id="mask5_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_71">
<path id="Vector_8" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask5_5981_49007)">
<g id="Group_10">
<g id="Group_11">
<g id="Group_12">
<path id="Vector_9" d="M38.6442 4.00994H34.0871V0.15625H32.0156V9.82501H34.0871V5.87463H38.6442V9.82501H40.7156V0.15625H38.6442V4.00994Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_7">
<mask id="mask6_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_62">
<path id="Vector_10" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask6_5981_49007)">
<g id="Group_13">
<g id="Group_14">
<g id="Group_15">
<path id="Vector_11" d="M45.3376 2.02094H47.893C48.9152 2.02094 49.4539 2.39387 49.4539 3.09831C49.4539 3.80275 48.9152 4.17569 47.893 4.17569H45.3376V2.02094ZM51.5259 3.09831C51.5259 1.27506 50.186 0.15625 47.9897 0.15625H43.2656V9.82501H45.3376V6.04037H47.6443L49.7164 9.82501H52.0094L49.715 5.75211C50.8666 5.30941 51.5259 4.37721 51.5259 3.09831Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_8">
<mask id="mask7_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_53">
<path id="Vector_12" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask7_5981_49007)">
<g id="Group_16">
<g id="Group_17">
<g id="Group_18">
<path id="Vector_13" d="M57.8732 8.05653C56.2438 8.05653 55.2496 6.89631 55.2496 5.00404C55.2496 3.08416 56.2438 1.92394 57.8732 1.92394C59.4887 1.92394 60.4691 3.08416 60.4691 5.00404C60.4691 6.89631 59.4887 8.05653 57.8732 8.05653ZM57.8732 -0.00976562C55.0839 -0.00976562 53.1094 2.06206 53.1094 5.00404C53.1094 7.91841 55.0839 9.99023 57.8732 9.99023C60.6486 9.99023 62.6094 7.91841 62.6094 5.00404C62.6094 2.06206 60.6486 -0.00976562 57.8732 -0.00976562Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_9">
<mask id="mask8_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_44">
<path id="Vector_14" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask8_5981_49007)">
<g id="Group_19">
<g id="Group_20">
<g id="Group_21">
<path id="Vector_15" d="M69.1794 4.45194H66.6233V2.02094H69.1794C70.2019 2.02094 70.7407 2.43532 70.7407 3.23644C70.7407 4.03756 70.2019 4.45194 69.1794 4.45194ZM69.2762 0.15625H64.5508V9.82501H66.6233V6.31662H69.2762C71.473 6.31662 72.8133 5.15637 72.8133 3.23644C72.8133 1.3165 71.473 0.15625 69.2762 0.15625Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_10">
<mask id="mask9_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_35">
<path id="Vector_16" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask9_5981_49007)">
<g id="Group_22">
<g id="Group_23">
<g id="Group_24">
<path id="Vector_17" d="M86.8413 6.57863C86.4823 7.51786 85.7642 8.05653 84.7837 8.05653C83.1542 8.05653 82.16 6.89631 82.16 5.00404C82.16 3.08416 83.1542 1.92394 84.7837 1.92394C85.7642 1.92394 86.4823 2.46261 86.8413 3.40183H89.0369C88.4984 1.33002 86.8827 -0.00976562 84.7837 -0.00976562C81.9942 -0.00976562 80.0195 2.06206 80.0195 5.00404C80.0195 7.91841 81.9942 9.99023 84.7837 9.99023C86.8965 9.99023 88.5122 8.63664 89.0508 6.57863H86.8413Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_11">
<mask id="mask10_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_26">
<path id="Vector_18" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask10_5981_49007)">
<g id="Group_25">
<g id="Group_26">
<g id="Group_27">
<path id="Vector_19" d="M73.6484 0.15625L77.5033 9.82501H79.6172L75.7624 0.15625H73.6484Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_12">
<mask id="mask11_5981_49007" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_17">
<path id="Vector_20" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask11_5981_49007)">
<g id="Group_28">
<g id="Group_29">
<g id="Group_30">
<path id="Vector_21" d="M3.64038 5.99893L4.95938 2.60106L6.27838 5.99893H3.64038ZM3.85422 0.15625L0 9.82501H2.15505L2.9433 7.79456H6.97558L7.76371 9.82501H9.91875L6.06453 0.15625H3.85422Z" fill="black" fill-opacity="0.95"/>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
<defs>
<clipPath id="clip0_5981_49007">
<rect width="89.375" height="10" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -0,0 +1,186 @@
<svg width="90" height="10" viewBox="0 0 90 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Anthropic" clip-path="url(#clip0_5981_52010)">
<g id="Clip path group">
<mask id="mask0_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_2">
<path id="Vector" d="M89.375 -0.00195312H0V9.99805H89.375V-0.00195312Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask0_5981_52010)">
<g id="Group">
<g id="Clip path group_2">
<mask id="mask1_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_4">
<path id="Vector_2" d="M0 -0.00390625H89.375V9.99609H0V-0.00390625Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask1_5981_52010)">
<g id="Group_2">
<g id="Clip path group_3">
<mask id="mask2_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_12">
<path id="Vector_3" d="M0 -0.00585938H89.375V9.99414H0V-0.00585938Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask2_5981_52010)">
<g id="Group_3">
<g id="Clip path group_4">
<mask id="mask3_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_89">
<path id="Vector_4" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask3_5981_52010)">
<g id="Group_4">
<g id="Group_5">
<g id="Group_6">
<path id="Vector_5" d="M18.1273 6.92438L13.7773 0.15625H11.4297V9.82501H13.4321V3.05688L17.7821 9.82501H20.1297V0.15625H18.1273V6.92438Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_5">
<mask id="mask4_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_80">
<path id="Vector_6" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask4_5981_52010)">
<g id="Group_7">
<g id="Group_8">
<g id="Group_9">
<path id="Vector_7" d="M21.7969 2.02094H25.0423V9.82501H27.1139V2.02094H30.3594V0.15625H21.7969V2.02094Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_6">
<mask id="mask5_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_71">
<path id="Vector_8" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask5_5981_52010)">
<g id="Group_10">
<g id="Group_11">
<g id="Group_12">
<path id="Vector_9" d="M38.6442 4.00994H34.0871V0.15625H32.0156V9.82501H34.0871V5.87463H38.6442V9.82501H40.7156V0.15625H38.6442V4.00994Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_7">
<mask id="mask6_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_62">
<path id="Vector_10" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask6_5981_52010)">
<g id="Group_13">
<g id="Group_14">
<g id="Group_15">
<path id="Vector_11" d="M45.3376 2.02094H47.893C48.9152 2.02094 49.4539 2.39387 49.4539 3.09831C49.4539 3.80275 48.9152 4.17569 47.893 4.17569H45.3376V2.02094ZM51.5259 3.09831C51.5259 1.27506 50.186 0.15625 47.9897 0.15625H43.2656V9.82501H45.3376V6.04037H47.6443L49.7164 9.82501H52.0094L49.715 5.75211C50.8666 5.30941 51.5259 4.37721 51.5259 3.09831Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_8">
<mask id="mask7_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_53">
<path id="Vector_12" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask7_5981_52010)">
<g id="Group_16">
<g id="Group_17">
<g id="Group_18">
<path id="Vector_13" d="M57.8732 8.05653C56.2438 8.05653 55.2496 6.89631 55.2496 5.00404C55.2496 3.08416 56.2438 1.92394 57.8732 1.92394C59.4887 1.92394 60.4691 3.08416 60.4691 5.00404C60.4691 6.89631 59.4887 8.05653 57.8732 8.05653ZM57.8732 -0.00976562C55.0839 -0.00976562 53.1094 2.06206 53.1094 5.00404C53.1094 7.91841 55.0839 9.99023 57.8732 9.99023C60.6486 9.99023 62.6094 7.91841 62.6094 5.00404C62.6094 2.06206 60.6486 -0.00976562 57.8732 -0.00976562Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_9">
<mask id="mask8_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_44">
<path id="Vector_14" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask8_5981_52010)">
<g id="Group_19">
<g id="Group_20">
<g id="Group_21">
<path id="Vector_15" d="M69.1794 4.45194H66.6233V2.02094H69.1794C70.2019 2.02094 70.7407 2.43532 70.7407 3.23644C70.7407 4.03756 70.2019 4.45194 69.1794 4.45194ZM69.2762 0.15625H64.5508V9.82501H66.6233V6.31662H69.2762C71.473 6.31662 72.8133 5.15637 72.8133 3.23644C72.8133 1.3165 71.473 0.15625 69.2762 0.15625Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_10">
<mask id="mask9_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_35">
<path id="Vector_16" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask9_5981_52010)">
<g id="Group_22">
<g id="Group_23">
<g id="Group_24">
<path id="Vector_17" d="M86.8413 6.57863C86.4823 7.51786 85.7642 8.05653 84.7837 8.05653C83.1542 8.05653 82.16 6.89631 82.16 5.00404C82.16 3.08416 83.1542 1.92394 84.7837 1.92394C85.7642 1.92394 86.4823 2.46261 86.8413 3.40183H89.0369C88.4984 1.33002 86.8827 -0.00976562 84.7837 -0.00976562C81.9942 -0.00976562 80.0195 2.06206 80.0195 5.00404C80.0195 7.91841 81.9942 9.99023 84.7837 9.99023C86.8965 9.99023 88.5122 8.63664 89.0508 6.57863H86.8413Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_11">
<mask id="mask10_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_26">
<path id="Vector_18" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask10_5981_52010)">
<g id="Group_25">
<g id="Group_26">
<g id="Group_27">
<path id="Vector_19" d="M73.6484 0.15625L77.5033 9.82501H79.6172L75.7624 0.15625H73.6484Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
<g id="Clip path group_12">
<mask id="mask11_5981_52010" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="90" height="11">
<g id="__lottie_element_17">
<path id="Vector_20" d="M0 -0.0078125H89.375V9.99219H0V-0.0078125Z" fill="white"/>
</g>
</mask>
<g mask="url(#mask11_5981_52010)">
<g id="Group_28">
<g id="Group_29">
<g id="Group_30">
<path id="Vector_21" d="M3.64038 5.99893L4.95938 2.60106L6.27838 5.99893H3.64038ZM3.85422 0.15625L0 9.82501H2.15505L2.9433 7.79456H6.97558L7.76371 9.82501H9.91875L6.06453 0.15625H3.85422Z" fill="white" fill-opacity="0.8"/>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
<defs>
<clipPath id="clip0_5981_52010">
<rect width="89.375" height="10" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 7.1 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
// GENERATE BY script
// DON NOT EDIT IT MANUALLY
import * as React from 'react'
import data from './AnthropicDark.json'
import IconBase from '@/app/components/base/icons/IconBase'
import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase'
const Icon = React.forwardRef<React.MutableRefObject<SVGElement>, Omit<IconBaseProps, 'data'>>((
props,
ref,
) => <IconBase {...props} ref={ref} data={data as IconData} />)
Icon.displayName = 'AnthropicDark'
export default Icon

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
// GENERATE BY script
// DON NOT EDIT IT MANUALLY
import * as React from 'react'
import data from './AnthropicLight.json'
import IconBase from '@/app/components/base/icons/IconBase'
import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase'
const Icon = React.forwardRef<React.MutableRefObject<SVGElement>, Omit<IconBaseProps, 'data'>>((
props,
ref,
) => <IconBase {...props} ref={ref} data={data as IconData} />)
Icon.displayName = 'AnthropicLight'
export default Icon

View File

@ -1,3 +1,5 @@
export { default as AnthropicDark } from './AnthropicDark'
export { default as AnthropicLight } from './AnthropicLight'
export { default as AnthropicText } from './AnthropicText'
export { default as Anthropic } from './Anthropic'
export { default as AzureOpenaiServiceText } from './AzureOpenaiServiceText'

View File

@ -7,6 +7,7 @@ import { useLanguage } from '../hooks'
import { Group } from '@/app/components/base/icons/src/vender/other'
import { OpenaiBlue, OpenaiViolet } from '@/app/components/base/icons/src/public/llm'
import cn from '@/utils/classnames'
import { renderI18nObject } from '@/hooks/use-i18n'
type ModelIconProps = {
provider?: Model | ModelProvider
@ -22,16 +23,16 @@ const ModelIcon: FC<ModelIconProps> = ({
}) => {
const language = useLanguage()
if (provider?.provider.includes('openai') && modelName?.includes('gpt-4o'))
return <div className='flex items-center justify-center'><OpenaiBlue className={cn('w-5 h-5', className)}/></div>
return <div className='flex items-center justify-center'><OpenaiBlue className={cn('w-5 h-5', className)} /></div>
if (provider?.provider.includes('openai') && modelName?.startsWith('gpt-4'))
return <div className='flex items-center justify-center'><OpenaiViolet className={cn('w-5 h-5', className)}/></div>
return <div className='flex items-center justify-center'><OpenaiViolet className={cn('w-5 h-5', className)} /></div>
if (provider?.icon_small) {
return (
<div className={`flex items-center justify-center w-5 h-5 ${isDeprecated ? 'opacity-50' : ''}`}>
<img
alt='model-icon'
src={`${provider.icon_small[language] || provider.icon_small.en_US}`}
src={renderI18nObject(provider.icon_small, language)}
className={cn('w-4.5 h-4.5', className)}
/>
</div>

View File

@ -1,7 +1,11 @@
import type { FC } from 'react'
import type { ModelProvider } from '../declarations'
import { useLanguage } from '../hooks'
import { AnthropicText, Openai } from '@/app/components/base/icons/src/vender/other'
import { useAppContext } from '@/context/app-context'
import { Openai } from '@/app/components/base/icons/src/vender/other'
import { AnthropicDark, AnthropicLight } from '@/app/components/base/icons/src/public/llm'
import { renderI18nObject } from '@/hooks/use-i18n'
import { Theme } from '@/types/app'
import cn from '@/utils/classnames'
type ProviderIconProps = {
@ -12,12 +16,14 @@ const ProviderIcon: FC<ProviderIconProps> = ({
provider,
className,
}) => {
const { theme } = useAppContext()
const language = useLanguage()
if (provider.provider === 'langgenius/anthropic/anthropic') {
return (
<div className='mb-2'>
<AnthropicText className='w-auto h-6 text-text-inverted-dimmed' />
<div className='mb-2 py-[7px]'>
{theme === Theme.dark && <AnthropicLight className='w-[90px] h-2.5' />}
{theme === Theme.light && <AnthropicDark className='w-[90px] h-2.5' />}
</div>
)
}
@ -34,11 +40,11 @@ const ProviderIcon: FC<ProviderIconProps> = ({
<div className={cn('inline-flex items-center gap-2', className)}>
<img
alt='provider-icon'
src={`${provider.icon_small[language] || provider.icon_small.en_US}`}
src={renderI18nObject(provider.icon_small, language)}
className='w-6 h-6'
/>
<div className='system-md-semibold text-text-primary'>
{provider.label[language] || provider.label.en_US}
{renderI18nObject(provider.label, language)}
</div>
</div>
)

View File

@ -1,160 +0,0 @@
import type { PluginDeclaration } from '../types'
import { PluginType } from '../types'
export const toolNeko: PluginDeclaration = {
plugin_unique_identifier: 'xxxxxx',
version: '0.0.1',
author: 'langgenius',
name: 'neko',
description: {
en_US: 'Neko is a cute cat.',
zh_Hans: '这是一只可爱的小猫。',
pt_BR: 'Neko is a cute cat.',
ja_JP: 'Neko is a cute cat.',
},
icon: '241e5209ecc8b5ce6b7a29a8e50388e9c75b89c3047c6ecd8e552f26de758883.svg',
label: {
en_US: 'Neko',
zh_Hans: 'Neko',
pt_BR: 'Neko',
ja_JP: 'Neko',
},
category: 'extension' as any,
created_at: '2024-07-12T08:03:44.658609Z',
resource: {
memory: 1048576,
permission: {
tool: {
enabled: true,
},
model: {
enabled: true,
llm: true,
text_embedding: false,
rerank: false,
tts: false,
speech2text: false,
moderation: false,
},
node: null,
endpoint: {
enabled: true,
},
storage: {
enabled: true,
size: 1048576,
},
},
},
plugins: {
tools: null,
models: null,
endpoints: [
'provider/neko.yaml',
],
},
tags: [],
verified: false,
tool: null,
model: null,
endpoint: null,
}
export const toolNotion = {
type: PluginType.tool,
org: 'Notion',
name: 'notion page search',
version: '1.2.0',
latest_version: '1.3.0',
icon: 'https://via.placeholder.com/150',
label: {
'en-US': 'Notion Page Search',
'zh-Hans': 'Notion 页面搜索',
},
brief: {
'en-US': 'Description: Search Notion pages and open visited ones faster. No admin access required.More and more info...More and more info...More and more info...',
'zh-Hans': '搜索 Notion 页面并更快地打开已访问的页面。无需管理员访问权限。More and more info...More and more info...More and more info...',
},
}
export const toolNotionManifest: PluginDeclaration = {
version: '1.2.0',
author: 'Notion',
icon: 'https://via.placeholder.com/150',
name: 'notion page search',
category: PluginType.tool,
label: {
'en-US': 'Notion Page Search',
'zh-Hans': 'Notion 页面搜索',
},
description: {
'en-US': 'Description: Search Notion pages and open visited ones faster. No admin access required.More and more info...More and more info...More and more info...',
'zh-Hans': '搜索 Notion 页面并更快地打开已访问的页面。无需管理员访问权限。More and more info...More and more info...More and more info...',
},
created_at: '2022-01-01',
resource: {},
plugins: {},
verified: true,
endpoint: {
settings: [],
endpoints: [],
},
tool: {
} as any,
model: {},
}
export const extensionDallE = {
type: PluginType.extension,
org: 'OpenAI',
name: 'DALL-E',
version: '1.1.0',
latest_version: '1.2.0',
install_count: 1234,
icon: 'https://via.placeholder.com/150',
label: {
'en-US': 'DALL-E',
'zh-Hans': 'DALL-E',
},
brief: {
'en-US': 'Description: A simple plugin to use OpenAI DALL-E model.',
'zh-Hans': '一个使用 OpenAI DALL-E 模型的简单插件。',
},
}
export const modelGPT4 = {
type: PluginType.model,
org: 'OpenAI',
name: 'GPT-4',
version: '1.0.0',
latest_version: '1.0.0',
install_count: 99999,
icon: 'https://via.placeholder.com/150',
label: {
'en-US': 'GPT-4',
'zh-Hans': 'GPT-4',
},
brief: {
'en-US': 'Description: A simple plugin to use OpenAI GPT-4 model.',
'zh-Hans': '一个使用 OpenAI GPT-4 模型的简单插件。',
},
}
export const customTool = {
type: PluginType.tool,
name: 'notion page search',
version: '1.2.0',
latest_version: '1.3.0',
icon: {
content: '🕵️',
background: '#FEF7C3',
},
label: {
'en-US': 'Notion Page Search',
'zh-Hans': 'Notion 页面搜索',
},
brief: {
'en-US': 'Description: Search Notion pages and open visited ones faster. No admin access required.More and more info...More and more info...More and more info...',
'zh-Hans': '搜索 Notion 页面并更快地打开已访问的页面。无需管理员访问权限。More and more info...More and more info...More and more info...',
},
}

View File

@ -1,6 +1,7 @@
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
export const renderI18nObject = (obj: Record<string, string>, language: string) => {
if (!obj) return ''
if (obj?.[language]) return obj[language]
if (obj?.en_US) return obj.en_US
return Object.values(obj)[0]