mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 19:30:04 +08:00
feat: add id to miniapp
This commit is contained in:
parent
a173a87f29
commit
8566476d91
@ -16,61 +16,73 @@ import { MinAppType } from '@renderer/types'
|
|||||||
|
|
||||||
const _apps: MinAppType[] = [
|
const _apps: MinAppType[] = [
|
||||||
{
|
{
|
||||||
|
id: '360-ai-so',
|
||||||
name: '360AI搜索',
|
name: '360AI搜索',
|
||||||
logo: AiSearchAppLogo,
|
logo: AiSearchAppLogo,
|
||||||
url: 'https://so.360.com/'
|
url: 'https://so.360.com/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: '360-ai-bot',
|
||||||
name: 'AI 助手',
|
name: 'AI 助手',
|
||||||
logo: AiAssistantAppLogo,
|
logo: AiAssistantAppLogo,
|
||||||
url: 'https://bot.360.com/'
|
url: 'https://bot.360.com/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'baidu-ai-chat',
|
||||||
name: '文心一言',
|
name: '文心一言',
|
||||||
logo: BaiduAiAppLogo,
|
logo: BaiduAiAppLogo,
|
||||||
url: 'https://yiyan.baidu.com/'
|
url: 'https://yiyan.baidu.com/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'tencent-yuanbao',
|
||||||
name: '腾讯元宝',
|
name: '腾讯元宝',
|
||||||
logo: TencentYuanbaoAppLogo,
|
logo: TencentYuanbaoAppLogo,
|
||||||
url: 'https://yuanbao.tencent.com/chat'
|
url: 'https://yuanbao.tencent.com/chat'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'sensetime-chat',
|
||||||
name: '商量',
|
name: '商量',
|
||||||
logo: SensetimeAppLogo,
|
logo: SensetimeAppLogo,
|
||||||
url: 'https://chat.sensetime.com/wb/chat'
|
url: 'https://chat.sensetime.com/wb/chat'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'spark-desk',
|
||||||
name: 'SparkDesk',
|
name: 'SparkDesk',
|
||||||
logo: SparkDeskAppLogo,
|
logo: SparkDeskAppLogo,
|
||||||
url: 'https://xinghuo.xfyun.cn/desk'
|
url: 'https://xinghuo.xfyun.cn/desk'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'metaso',
|
||||||
name: '秘塔AI搜索',
|
name: '秘塔AI搜索',
|
||||||
logo: MetasoAppLogo,
|
logo: MetasoAppLogo,
|
||||||
url: 'https://metaso.cn/'
|
url: 'https://metaso.cn/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'poe',
|
||||||
name: 'Poe',
|
name: 'Poe',
|
||||||
logo: PoeAppLogo,
|
logo: PoeAppLogo,
|
||||||
url: 'https://poe.com'
|
url: 'https://poe.com'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'perplexity',
|
||||||
name: 'perplexity',
|
name: 'perplexity',
|
||||||
logo: PerplexityAppLogo,
|
logo: PerplexityAppLogo,
|
||||||
url: 'https://www.perplexity.ai/'
|
url: 'https://www.perplexity.ai/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'devv',
|
||||||
name: 'DEVV_',
|
name: 'DEVV_',
|
||||||
logo: DevvAppLogo,
|
logo: DevvAppLogo,
|
||||||
url: 'https://devv.ai/'
|
url: 'https://devv.ai/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'tiangong-ai',
|
||||||
name: '天工AI',
|
name: '天工AI',
|
||||||
logo: TiangongAiLogo,
|
logo: TiangongAiLogo,
|
||||||
url: 'https://www.tiangong.cn/'
|
url: 'https://www.tiangong.cn/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'zhihu-zhiada',
|
||||||
name: '知乎直答',
|
name: '知乎直答',
|
||||||
logo: ZhihuAppLogo,
|
logo: ZhihuAppLogo,
|
||||||
url: 'https://zhida.zhihu.com/'
|
url: 'https://zhida.zhihu.com/'
|
||||||
|
|||||||
@ -136,6 +136,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://platform.openai.com/docs/models'
|
models: 'https://platform.openai.com/docs/models'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'openai',
|
||||||
name: 'ChatGPT',
|
name: 'ChatGPT',
|
||||||
url: 'https://chatgpt.com/',
|
url: 'https://chatgpt.com/',
|
||||||
logo: OpenAiProviderLogo
|
logo: OpenAiProviderLogo
|
||||||
@ -152,6 +153,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://ai.google.dev/gemini-api/docs/models/gemini'
|
models: 'https://ai.google.dev/gemini-api/docs/models/gemini'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'gemini',
|
||||||
name: 'Gemini',
|
name: 'Gemini',
|
||||||
url: 'https://gemini.google.com/',
|
url: 'https://gemini.google.com/',
|
||||||
logo: GeminiProviderLogo
|
logo: GeminiProviderLogo
|
||||||
@ -168,6 +170,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://docs.siliconflow.cn/docs/model-names'
|
models: 'https://docs.siliconflow.cn/docs/model-names'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'silicon',
|
||||||
name: 'SiliconFlow',
|
name: 'SiliconFlow',
|
||||||
url: 'https://cloud.siliconflow.cn/playground/chat',
|
url: 'https://cloud.siliconflow.cn/playground/chat',
|
||||||
logo: SiliconFlowProviderLogo
|
logo: SiliconFlowProviderLogo
|
||||||
@ -184,6 +187,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://platform.deepseek.com/api-docs/'
|
models: 'https://platform.deepseek.com/api-docs/'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'deepseek',
|
||||||
name: 'DeepSeek',
|
name: 'DeepSeek',
|
||||||
url: 'https://chat.deepseek.com/',
|
url: 'https://chat.deepseek.com/',
|
||||||
logo: DeepSeekProviderLogo
|
logo: DeepSeekProviderLogo
|
||||||
@ -211,6 +215,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://platform.lingyiwanwu.com/docs#%E6%A8%A1%E5%9E%8B'
|
models: 'https://platform.lingyiwanwu.com/docs#%E6%A8%A1%E5%9E%8B'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'yi',
|
||||||
name: 'Yi',
|
name: 'Yi',
|
||||||
url: 'https://www.wanzhi.com/',
|
url: 'https://www.wanzhi.com/',
|
||||||
logo: YiProviderLogo
|
logo: YiProviderLogo
|
||||||
@ -227,6 +232,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://open.bigmodel.cn/modelcenter/square'
|
models: 'https://open.bigmodel.cn/modelcenter/square'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'zhipu',
|
||||||
name: '智谱',
|
name: '智谱',
|
||||||
url: 'https://chatglm.cn/main/alltoolsdetail',
|
url: 'https://chatglm.cn/main/alltoolsdetail',
|
||||||
logo: ZhipuProviderLogo
|
logo: ZhipuProviderLogo
|
||||||
@ -243,6 +249,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://platform.moonshot.cn/docs/intro#%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8'
|
models: 'https://platform.moonshot.cn/docs/intro#%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'moonshot',
|
||||||
name: 'Kimi',
|
name: 'Kimi',
|
||||||
url: 'https://kimi.moonshot.cn/',
|
url: 'https://kimi.moonshot.cn/',
|
||||||
logo: KimiAppLogo
|
logo: KimiAppLogo
|
||||||
@ -259,6 +266,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://platform.baichuan-ai.com/price'
|
models: 'https://platform.baichuan-ai.com/price'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'baichuan',
|
||||||
name: '百小应',
|
name: '百小应',
|
||||||
url: 'https://ying.baichuan-ai.com/chat',
|
url: 'https://ying.baichuan-ai.com/chat',
|
||||||
logo: BaicuanAppLogo
|
logo: BaicuanAppLogo
|
||||||
@ -275,6 +283,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://dashscope.console.aliyun.com/model'
|
models: 'https://dashscope.console.aliyun.com/model'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'dashscope',
|
||||||
name: '通义千问',
|
name: '通义千问',
|
||||||
url: 'https://tongyi.aliyun.com/qianwen/',
|
url: 'https://tongyi.aliyun.com/qianwen/',
|
||||||
logo: QwenModelLogo
|
logo: QwenModelLogo
|
||||||
@ -291,6 +300,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://platform.stepfun.com/docs/llm/text'
|
models: 'https://platform.stepfun.com/docs/llm/text'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'stepfun',
|
||||||
name: '跃问',
|
name: '跃问',
|
||||||
url: 'https://yuewen.cn/chats/new',
|
url: 'https://yuewen.cn/chats/new',
|
||||||
logo: YuewenAppLogo
|
logo: YuewenAppLogo
|
||||||
@ -307,6 +317,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint'
|
models: 'https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'doubao',
|
||||||
name: '豆包',
|
name: '豆包',
|
||||||
url: 'https://www.doubao.com/chat/',
|
url: 'https://www.doubao.com/chat/',
|
||||||
logo: DoubaoProviderLogo
|
logo: DoubaoProviderLogo
|
||||||
@ -323,6 +334,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://platform.minimaxi.com/document/Models'
|
models: 'https://platform.minimaxi.com/document/Models'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'minimax',
|
||||||
name: '海螺',
|
name: '海螺',
|
||||||
url: 'https://hailuoai.com/',
|
url: 'https://hailuoai.com/',
|
||||||
logo: HailuoModelLogo
|
logo: HailuoModelLogo
|
||||||
@ -355,6 +367,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://console.groq.com/docs/models'
|
models: 'https://console.groq.com/docs/models'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'groq',
|
||||||
name: 'Groq',
|
name: 'Groq',
|
||||||
url: 'https://chat.groq.com/',
|
url: 'https://chat.groq.com/',
|
||||||
logo: GroqProviderLogo
|
logo: GroqProviderLogo
|
||||||
@ -381,6 +394,7 @@ export const PROVIDER_CONFIG = {
|
|||||||
models: 'https://docs.anthropic.com/en/docs/about-claude/models'
|
models: 'https://docs.anthropic.com/en/docs/about-claude/models'
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
|
id: 'anthropic',
|
||||||
name: 'Claude',
|
name: 'Claude',
|
||||||
url: 'https://claude.ai/',
|
url: 'https://claude.ai/',
|
||||||
logo: AnthropicProviderLogo
|
logo: AnthropicProviderLogo
|
||||||
|
|||||||
@ -4,44 +4,16 @@ import { Center } from '@renderer/components/Layout'
|
|||||||
import { getAllMinApps } from '@renderer/config/minapp'
|
import { getAllMinApps } from '@renderer/config/minapp'
|
||||||
import { Empty, Input } from 'antd'
|
import { Empty, Input } from 'antd'
|
||||||
import { isEmpty } from 'lodash'
|
import { isEmpty } from 'lodash'
|
||||||
import { FC, useEffect, useState } from 'react'
|
import { FC, useMemo, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
import App from './App'
|
import App from './App'
|
||||||
|
|
||||||
// 定义应用的类型
|
|
||||||
interface AppType {
|
|
||||||
id: string // 确保 id 是 string 类型
|
|
||||||
name: string
|
|
||||||
url: string
|
|
||||||
logo: string
|
|
||||||
sortOrder?: number // 可选属性
|
|
||||||
}
|
|
||||||
|
|
||||||
const AppsPage: FC = () => {
|
const AppsPage: FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const [apps, setApps] = useState<AppType[]>([]) // 使用定义的类型
|
const apps = useMemo(() => getAllMinApps(), [])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const list = getAllMinApps()
|
|
||||||
const processedList: AppType[] = list.map((app, index) => {
|
|
||||||
// 为每个应用添加 id 和排序编号
|
|
||||||
const id = app.id ? String(app.id) : app.name.toLowerCase() // 确保 id 是字符串
|
|
||||||
return {
|
|
||||||
...app,
|
|
||||||
id,
|
|
||||||
sortOrder: index + 1 // 排序编号从 1 开始
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 存储到本地存储
|
|
||||||
localStorage.setItem('minApps', JSON.stringify(processedList))
|
|
||||||
|
|
||||||
// 更新状态
|
|
||||||
setApps(processedList)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const filteredApps = search
|
const filteredApps = search
|
||||||
? apps.filter(
|
? apps.filter(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user