Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: jyong <718720800@qq.com>tags/0.9.2
| Get model provider icon | Get model provider icon | ||||
| """ | """ | ||||
| @setup_required | |||||
| @login_required | |||||
| @account_initialization_required | |||||
| def get(self, provider: str, icon_type: str, lang: str): | def get(self, provider: str, icon_type: str, lang: str): | ||||
| model_provider_service = ModelProviderService() | model_provider_service = ModelProviderService() | ||||
| icon, mimetype = model_provider_service.get_model_provider_icon( | icon, mimetype = model_provider_service.get_model_provider_icon( | ||||
| provider=provider, icon_type=icon_type, lang=lang | |||||
| provider=provider, | |||||
| icon_type=icon_type, | |||||
| lang=lang, | |||||
| ) | ) | ||||
| return send_file(io.BytesIO(icon), mimetype=mimetype) | return send_file(io.BytesIO(icon), mimetype=mimetype) |
| return ( | return ( | ||||
| <img | <img | ||||
| alt='model-icon' | alt='model-icon' | ||||
| src={`${provider.icon_small[language] || provider.icon_small.en_US}?_token=${localStorage.getItem('console_token')}`} | |||||
| src={`${provider.icon_small[language] || provider.icon_small.en_US}`} | |||||
| className={`w-4 h-4 ${className}`} | className={`w-4 h-4 ${className}`} | ||||
| /> | /> | ||||
| ) | ) |
| return ( | return ( | ||||
| <img | <img | ||||
| alt='provider-icon' | alt='provider-icon' | ||||
| src={`${provider.icon_large[language] || provider.icon_large.en_US}?_token=${localStorage.getItem('console_token')}`} | |||||
| src={`${provider.icon_large[language] || provider.icon_large.en_US}`} | |||||
| className={`w-auto h-6 ${className}`} | className={`w-auto h-6 ${className}`} | ||||
| /> | /> | ||||
| ) | ) |