@yuhuanowo/yunui 0.2.16 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/README.zh-CN.md +14 -1
- package/README.zh-TW.md +14 -1
- package/dist/ai.d.ts +191 -7
- package/dist/ai.js +662 -168
- package/dist/ai.js.map +1 -1
- package/dist/chat.d.ts +31 -5
- package/dist/chat.js +71 -13
- package/dist/chat.js.map +1 -1
- package/dist/{chunk-5E3O6ANF.js → chunk-AFVENY4D.js} +386 -74
- package/dist/chunk-AFVENY4D.js.map +1 -0
- package/dist/{chunk-GSPJ5YI6.js → chunk-GAXVET76.js} +36 -24
- package/dist/chunk-GAXVET76.js.map +1 -0
- package/dist/{chunk-UYYG4XDW.js → chunk-LEBQPP4B.js} +80 -7
- package/dist/chunk-LEBQPP4B.js.map +1 -0
- package/dist/chunk-ST6TSBVQ.js +208 -0
- package/dist/chunk-ST6TSBVQ.js.map +1 -0
- package/dist/chunk-V7VJKZ5Q.js +254 -0
- package/dist/chunk-V7VJKZ5Q.js.map +1 -0
- package/dist/{chunk-5TOGZTAO.js → chunk-YKWRCA2S.js} +184 -208
- package/dist/chunk-YKWRCA2S.js.map +1 -0
- package/dist/content.d.ts +48 -6
- package/dist/content.js +233 -49
- package/dist/content.js.map +1 -1
- package/dist/index.d.ts +319 -22
- package/dist/index.js +4 -4
- package/dist/patterns.d.ts +557 -25
- package/dist/patterns.js +1076 -186
- package/dist/patterns.js.map +1 -1
- package/icons/apps/aistudio.webp +0 -0
- package/icons/apps/application.png +0 -0
- package/icons/apps/baixiaoying.webp +0 -0
- package/icons/apps/coze.webp +0 -0
- package/icons/apps/dify.webp +0 -0
- package/icons/apps/doubao.webp +0 -0
- package/icons/apps/flowith.webp +0 -0
- package/icons/apps/gemini.webp +0 -0
- package/icons/apps/github-copilot.webp +0 -0
- package/icons/apps/google.webp +0 -0
- package/icons/apps/grok.webp +0 -0
- package/icons/apps/kimi.webp +0 -0
- package/icons/apps/longcat.webp +0 -0
- package/icons/apps/metaso.webp +0 -0
- package/icons/apps/monica.webp +0 -0
- package/icons/apps/n8n.webp +0 -0
- package/icons/apps/nm-search.webp +0 -0
- package/icons/apps/notebooklm.webp +0 -0
- package/icons/apps/perplexity.webp +0 -0
- package/icons/apps/poe.webp +0 -0
- package/icons/apps/qingyan.webp +0 -0
- package/icons/apps/stepfun.webp +0 -0
- package/icons/apps/tiangong.webp +0 -0
- package/icons/apps/xiaoyi.webp +0 -0
- package/icons/apps/yuanbao.webp +0 -0
- package/icons/apps/zai.webp +0 -0
- package/icons/models/ai21.webp +0 -0
- package/icons/models/aimass.webp +0 -0
- package/icons/models/anthropic.webp +0 -0
- package/icons/models/baichuan.webp +0 -0
- package/icons/models/byte_dance.webp +0 -0
- package/icons/models/chatglm.webp +0 -0
- package/icons/models/claude.webp +0 -0
- package/icons/models/codegeex.webp +0 -0
- package/icons/models/cogview3flash.webp +0 -0
- package/icons/models/cohere.webp +0 -0
- package/icons/models/copilot.webp +0 -0
- package/icons/models/dalle.webp +0 -0
- package/icons/models/dbrx.webp +0 -0
- package/icons/models/deepseek.webp +0 -0
- package/icons/models/doubao.webp +0 -0
- package/icons/models/flux.webp +0 -0
- package/icons/models/gemini.webp +0 -0
- package/icons/models/gemma.webp +0 -0
- package/icons/models/google.webp +0 -0
- package/icons/models/grok.webp +0 -0
- package/icons/models/hailuo.webp +0 -0
- package/icons/models/huggingface.webp +0 -0
- package/icons/models/hunyuan.webp +0 -0
- package/icons/models/ibm.webp +0 -0
- package/icons/models/ideogram.webp +0 -0
- package/icons/models/internlm.webp +0 -0
- package/icons/models/jina.webp +0 -0
- package/icons/models/llava.webp +0 -0
- package/icons/models/luma.webp +0 -0
- package/icons/models/magic.webp +0 -0
- package/icons/models/microsoft.webp +0 -0
- package/icons/models/midjourney.webp +0 -0
- package/icons/models/minimax.webp +0 -0
- package/icons/models/mistral.webp +0 -0
- package/icons/models/moonshot.webp +0 -0
- package/icons/models/nousresearch.webp +0 -0
- package/icons/models/nvidia.webp +0 -0
- package/icons/models/o3.webp +0 -0
- package/icons/models/openai.webp +0 -0
- package/icons/models/palm.webp +0 -0
- package/icons/models/perplexity.webp +0 -0
- package/icons/models/qwen.webp +0 -0
- package/icons/models/stability.webp +0 -0
- package/icons/models/step.webp +0 -0
- package/icons/models/suno.webp +0 -0
- package/icons/models/upstage.webp +0 -0
- package/icons/models/vidu.webp +0 -0
- package/icons/models/volcengine.webp +0 -0
- package/icons/models/voyageai.webp +0 -0
- package/icons/models/wenxin.webp +0 -0
- package/icons/models/xirang.png +0 -0
- package/icons/models/xirang_dark.png +0 -0
- package/icons/models/yi.webp +0 -0
- package/icons/models/zai.webp +0 -0
- package/icons/models/zero-one.webp +0 -0
- package/icons/models/zhipu.webp +0 -0
- package/icons/providers/302ai.webp +0 -0
- package/icons/providers/DMXAPI-to-img.webp +0 -0
- package/icons/providers/Tesseract.js.png +0 -0
- package/icons/providers/ace.webp +0 -0
- package/icons/providers/adobe.webp +0 -0
- package/icons/providers/adobefirefly.webp +0 -0
- package/icons/providers/agentvoice.webp +0 -0
- package/icons/providers/agui.webp +0 -0
- package/icons/providers/ai2.webp +0 -0
- package/icons/providers/ai21.webp +0 -0
- package/icons/providers/ai302.webp +0 -0
- package/icons/providers/ai360.webp +0 -0
- package/icons/providers/aiOnly.webp +0 -0
- package/icons/providers/aihubmix.webp +0 -0
- package/icons/providers/aimass.webp +0 -0
- package/icons/providers/aionlabs.webp +0 -0
- package/icons/providers/airjelly.webp +0 -0
- package/icons/providers/aistudio.webp +0 -0
- package/icons/providers/akashchat.webp +0 -0
- package/icons/providers/alephalpha.webp +0 -0
- package/icons/providers/alibaba.webp +0 -0
- package/icons/providers/alibabacloud.webp +0 -0
- package/icons/providers/amp.webp +0 -0
- package/icons/providers/antgroup.webp +0 -0
- package/icons/providers/anthropic.webp +0 -0
- package/icons/providers/antigravity.webp +0 -0
- package/icons/providers/anyscale.webp +0 -0
- package/icons/providers/apertis.webp +0 -0
- package/icons/providers/apple.webp +0 -0
- package/icons/providers/arcee.webp +0 -0
- package/icons/providers/askverdict.webp +0 -0
- package/icons/providers/assemblyai.webp +0 -0
- package/icons/providers/atlascloud.webp +0 -0
- package/icons/providers/automatic.webp +0 -0
- package/icons/providers/aws-bedrock.webp +0 -0
- package/icons/providers/aws.webp +0 -0
- package/icons/providers/aya.webp +0 -0
- package/icons/providers/azure.webp +0 -0
- package/icons/providers/azureai.webp +0 -0
- package/icons/providers/baai.webp +0 -0
- package/icons/providers/baichuan.webp +0 -0
- package/icons/providers/baidu-cloud.webp +0 -0
- package/icons/providers/baidu.webp +0 -0
- package/icons/providers/baiducloud.webp +0 -0
- package/icons/providers/bailian.webp +0 -0
- package/icons/providers/baseten.webp +0 -0
- package/icons/providers/bedrock.webp +0 -0
- package/icons/providers/bfl.webp +0 -0
- package/icons/providers/bigModel.webp +0 -0
- package/icons/providers/bilibili.webp +0 -0
- package/icons/providers/bilibiliindex.webp +0 -0
- package/icons/providers/bing.webp +0 -0
- package/icons/providers/briaai.webp +0 -0
- package/icons/providers/burncloud.webp +0 -0
- package/icons/providers/bytedance.webp +0 -0
- package/icons/providers/capcut.webp +0 -0
- package/icons/providers/centml.webp +0 -0
- package/icons/providers/cephalon.jpeg +0 -0
- package/icons/providers/cerebras.webp +0 -0
- package/icons/providers/chatglm.webp +0 -0
- package/icons/providers/cherryin.png +0 -0
- package/icons/providers/cherrystudio.webp +0 -0
- package/icons/providers/civitai.webp +0 -0
- package/icons/providers/claude.webp +0 -0
- package/icons/providers/claudecode.webp +0 -0
- package/icons/providers/cline.webp +0 -0
- package/icons/providers/clipdrop.webp +0 -0
- package/icons/providers/cloudflare.webp +0 -0
- package/icons/providers/codebuddy.webp +0 -0
- package/icons/providers/codeflicker.webp +0 -0
- package/icons/providers/codegeex.webp +0 -0
- package/icons/providers/codex.webp +0 -0
- package/icons/providers/cogvideo.webp +0 -0
- package/icons/providers/cogview.webp +0 -0
- package/icons/providers/cogview3flash.webp +0 -0
- package/icons/providers/cohere.webp +0 -0
- package/icons/providers/colab.webp +0 -0
- package/icons/providers/cometapi.webp +0 -0
- package/icons/providers/comfyui.webp +0 -0
- package/icons/providers/commanda.webp +0 -0
- package/icons/providers/copilot.webp +0 -0
- package/icons/providers/copilotkit.webp +0 -0
- package/icons/providers/coqui.webp +0 -0
- package/icons/providers/coze.webp +0 -0
- package/icons/providers/crewai.webp +0 -0
- package/icons/providers/crusoe.webp +0 -0
- package/icons/providers/cursor.webp +0 -0
- package/icons/providers/cybercut.webp +0 -0
- package/icons/providers/dalle.webp +0 -0
- package/icons/providers/dbrx.webp +0 -0
- package/icons/providers/deepai.webp +0 -0
- package/icons/providers/deepcogito.webp +0 -0
- package/icons/providers/deepinfra.webp +0 -0
- package/icons/providers/deepl.webp +0 -0
- package/icons/providers/deepmind.webp +0 -0
- package/icons/providers/deepseek.webp +0 -0
- package/icons/providers/devin.webp +0 -0
- package/icons/providers/dify.webp +0 -0
- package/icons/providers/dmxapi-logo-dark.webp +0 -0
- package/icons/providers/dmxapi-logo.webp +0 -0
- package/icons/providers/doc2x.webp +0 -0
- package/icons/providers/docsearch.webp +0 -0
- package/icons/providers/dolphin.webp +0 -0
- package/icons/providers/doubao.webp +0 -0
- package/icons/providers/dreammachine.webp +0 -0
- package/icons/providers/elevenlabs.webp +0 -0
- package/icons/providers/elevenx.webp +0 -0
- package/icons/providers/essentialai.webp +0 -0
- package/icons/providers/exa.webp +0 -0
- package/icons/providers/fal.webp +0 -0
- package/icons/providers/fastgpt.webp +0 -0
- package/icons/providers/featherless.webp +0 -0
- package/icons/providers/figma.webp +0 -0
- package/icons/providers/fireworks.webp +0 -0
- package/icons/providers/fishaudio.webp +0 -0
- package/icons/providers/flora.webp +0 -0
- package/icons/providers/flowith.webp +0 -0
- package/icons/providers/flux.webp +0 -0
- package/icons/providers/friendli.webp +0 -0
- package/icons/providers/gemini.webp +0 -0
- package/icons/providers/geminicli.webp +0 -0
- package/icons/providers/gemma.webp +0 -0
- package/icons/providers/gitee-ai.webp +0 -0
- package/icons/providers/giteeai.webp +0 -0
- package/icons/providers/github.webp +0 -0
- package/icons/providers/githubcopilot.webp +0 -0
- package/icons/providers/glama.webp +0 -0
- package/icons/providers/glif.webp +0 -0
- package/icons/providers/glmv.webp +0 -0
- package/icons/providers/gmi.svg +5 -0
- package/icons/providers/google.webp +0 -0
- package/icons/providers/googlecloud.webp +0 -0
- package/icons/providers/goose.webp +0 -0
- package/icons/providers/gradio.webp +0 -0
- package/icons/providers/greptile.webp +0 -0
- package/icons/providers/grok.webp +0 -0
- package/icons/providers/groq.webp +0 -0
- package/icons/providers/hailuo.webp +0 -0
- package/icons/providers/haiper.webp +0 -0
- package/icons/providers/hedra.webp +0 -0
- package/icons/providers/hermesagent.webp +0 -0
- package/icons/providers/higress.webp +0 -0
- package/icons/providers/huawei.webp +0 -0
- package/icons/providers/huaweicloud.webp +0 -0
- package/icons/providers/huggingface.webp +0 -0
- package/icons/providers/hunyuan.webp +0 -0
- package/icons/providers/hyperbolic.webp +0 -0
- package/icons/providers/ibm.webp +0 -0
- package/icons/providers/ideogram.webp +0 -0
- package/icons/providers/iflytekcloud.webp +0 -0
- package/icons/providers/inception.webp +0 -0
- package/icons/providers/inference.webp +0 -0
- package/icons/providers/infermatic.webp +0 -0
- package/icons/providers/infini.webp +0 -0
- package/icons/providers/infinigence.webp +0 -0
- package/icons/providers/inflection.webp +0 -0
- package/icons/providers/internlm.webp +0 -0
- package/icons/providers/jimeng.webp +0 -0
- package/icons/providers/jina.webp +0 -0
- package/icons/providers/junie.webp +0 -0
- package/icons/providers/kilocode.webp +0 -0
- package/icons/providers/kimi.webp +0 -0
- package/icons/providers/kiro.webp +0 -0
- package/icons/providers/kling.webp +0 -0
- package/icons/providers/kluster.webp +0 -0
- package/icons/providers/kolors.webp +0 -0
- package/icons/providers/krea.webp +0 -0
- package/icons/providers/kwaikat.webp +0 -0
- package/icons/providers/kwaipilot.webp +0 -0
- package/icons/providers/lambda.webp +0 -0
- package/icons/providers/langchain.webp +0 -0
- package/icons/providers/langfuse.webp +0 -0
- package/icons/providers/langgraph.webp +0 -0
- package/icons/providers/langsmith.webp +0 -0
- package/icons/providers/leptonai.webp +0 -0
- package/icons/providers/lg.webp +0 -0
- package/icons/providers/lightricks.webp +0 -0
- package/icons/providers/liquid.webp +0 -0
- package/icons/providers/livekit.webp +0 -0
- package/icons/providers/llamaindex.webp +0 -0
- package/icons/providers/llava.webp +0 -0
- package/icons/providers/llmapi.webp +0 -0
- package/icons/providers/lmstudio.webp +0 -0
- package/icons/providers/lobehub.webp +0 -0
- package/icons/providers/longcat.webp +0 -0
- package/icons/providers/lovable.webp +0 -0
- package/icons/providers/lovart.webp +0 -0
- package/icons/providers/luma.webp +0 -0
- package/icons/providers/magic.webp +0 -0
- package/icons/providers/make.webp +0 -0
- package/icons/providers/manus.webp +0 -0
- package/icons/providers/mastra.webp +0 -0
- package/icons/providers/mcp.webp +0 -0
- package/icons/providers/mcpso.webp +0 -0
- package/icons/providers/menlo.webp +0 -0
- package/icons/providers/meshy.webp +0 -0
- package/icons/providers/meta.webp +0 -0
- package/icons/providers/metaai.webp +0 -0
- package/icons/providers/metagpt.webp +0 -0
- package/icons/providers/microsoft.webp +0 -0
- package/icons/providers/midjourney.webp +0 -0
- package/icons/providers/minimax.webp +0 -0
- package/icons/providers/mistral.webp +0 -0
- package/icons/providers/modelscope.webp +0 -0
- package/icons/providers/monica.webp +0 -0
- package/icons/providers/moonshot.webp +0 -0
- package/icons/providers/morph.webp +0 -0
- package/icons/providers/moxt.webp +0 -0
- package/icons/providers/myshell.webp +0 -0
- package/icons/providers/n8n.webp +0 -0
- package/icons/providers/nanobanana.webp +0 -0
- package/icons/providers/nebius.webp +0 -0
- package/icons/providers/newapi.webp +0 -0
- package/icons/providers/notebooklm.webp +0 -0
- package/icons/providers/notion.webp +0 -0
- package/icons/providers/nousresearch.webp +0 -0
- package/icons/providers/nova.webp +0 -0
- package/icons/providers/novelai.webp +0 -0
- package/icons/providers/novita.webp +0 -0
- package/icons/providers/nplcloud.webp +0 -0
- package/icons/providers/nvidia.webp +0 -0
- package/icons/providers/o3.webp +0 -0
- package/icons/providers/obsidian.webp +0 -0
- package/icons/providers/ollama.webp +0 -0
- package/icons/providers/openai.webp +0 -0
- package/icons/providers/openchat.webp +0 -0
- package/icons/providers/openclaw.webp +0 -0
- package/icons/providers/opencode.webp +0 -0
- package/icons/providers/openhands.webp +0 -0
- package/icons/providers/openhuman.webp +0 -0
- package/icons/providers/openrouter.webp +0 -0
- package/icons/providers/openwebui.webp +0 -0
- package/icons/providers/paddleocr.webp +0 -0
- package/icons/providers/palm.webp +0 -0
- package/icons/providers/parasail.webp +0 -0
- package/icons/providers/perplexity.webp +0 -0
- package/icons/providers/phidata.webp +0 -0
- package/icons/providers/phind.webp +0 -0
- package/icons/providers/pika.webp +0 -0
- package/icons/providers/pixverse.webp +0 -0
- package/icons/providers/player2.webp +0 -0
- package/icons/providers/poe.webp +0 -0
- package/icons/providers/pollinations.webp +0 -0
- package/icons/providers/ppio.webp +0 -0
- package/icons/providers/prunaai.webp +0 -0
- package/icons/providers/pydanticai.webp +0 -0
- package/icons/providers/qingyan.webp +0 -0
- package/icons/providers/qiniu.webp +0 -0
- package/icons/providers/qoder.webp +0 -0
- package/icons/providers/qwen.webp +0 -0
- package/icons/providers/railway.webp +0 -0
- package/icons/providers/recraft.webp +0 -0
- package/icons/providers/relace.webp +0 -0
- package/icons/providers/replicate.webp +0 -0
- package/icons/providers/replit.webp +0 -0
- package/icons/providers/reve.webp +0 -0
- package/icons/providers/roocode.webp +0 -0
- package/icons/providers/rsshub.webp +0 -0
- package/icons/providers/runway.webp +0 -0
- package/icons/providers/rwkv.webp +0 -0
- package/icons/providers/sambanova.webp +0 -0
- package/icons/providers/search1api.webp +0 -0
- package/icons/providers/searchapi.webp +0 -0
- package/icons/providers/sensenova.webp +0 -0
- package/icons/providers/silicon.webp +0 -0
- package/icons/providers/siliconcloud.webp +0 -0
- package/icons/providers/sillytavern.webp +0 -0
- package/icons/providers/skywork.webp +0 -0
- package/icons/providers/slock.webp +0 -0
- package/icons/providers/smithery.webp +0 -0
- package/icons/providers/snowflake.webp +0 -0
- package/icons/providers/sophnet.webp +0 -0
- package/icons/providers/sora.webp +0 -0
- package/icons/providers/spark.webp +0 -0
- package/icons/providers/speedai.webp +0 -0
- package/icons/providers/stability.webp +0 -0
- package/icons/providers/statecloud.webp +0 -0
- package/icons/providers/step.webp +0 -0
- package/icons/providers/stepfun.webp +0 -0
- package/icons/providers/straico.webp +0 -0
- package/icons/providers/streamlake.webp +0 -0
- package/icons/providers/submodel.webp +0 -0
- package/icons/providers/suno.webp +0 -0
- package/icons/providers/sync.webp +0 -0
- package/icons/providers/targon.webp +0 -0
- package/icons/providers/tavily.webp +0 -0
- package/icons/providers/tencent-cloud-ti.webp +0 -0
- package/icons/providers/tencent.webp +0 -0
- package/icons/providers/tencentcloud.webp +0 -0
- package/icons/providers/tiangong.webp +0 -0
- package/icons/providers/tii.webp +0 -0
- package/icons/providers/together.webp +0 -0
- package/icons/providers/tokenrouter.png +0 -0
- package/icons/providers/topazlabs.webp +0 -0
- package/icons/providers/trae.webp +0 -0
- package/icons/providers/tripo.webp +0 -0
- package/icons/providers/turix.webp +0 -0
- package/icons/providers/udio.webp +0 -0
- package/icons/providers/unstructured.webp +0 -0
- package/icons/providers/upstage.webp +0 -0
- package/icons/providers/v0.webp +0 -0
- package/icons/providers/vectorizerai.webp +0 -0
- package/icons/providers/venice.webp +0 -0
- package/icons/providers/vercel.webp +0 -0
- package/icons/providers/vertexai.webp +0 -0
- package/icons/providers/vidu.webp +0 -0
- package/icons/providers/viggle.webp +0 -0
- package/icons/providers/vllm.webp +0 -0
- package/icons/providers/volcengine.webp +0 -0
- package/icons/providers/voyage.webp +0 -0
- package/icons/providers/voyageai.webp +0 -0
- package/icons/providers/wenxin.webp +0 -0
- package/icons/providers/windsurf.webp +0 -0
- package/icons/providers/workersai.webp +0 -0
- package/icons/providers/worldrouter.webp +0 -0
- package/icons/providers/xai.webp +0 -0
- package/icons/providers/xiaomimimo.webp +0 -0
- package/icons/providers/xinference.webp +0 -0
- package/icons/providers/xirang.png +0 -0
- package/icons/providers/xpay.webp +0 -0
- package/icons/providers/xuanyuan.webp +0 -0
- package/icons/providers/yandex.webp +0 -0
- package/icons/providers/yi.webp +0 -0
- package/icons/providers/youmind.webp +0 -0
- package/icons/providers/yuanbao.webp +0 -0
- package/icons/providers/zai.webp +0 -0
- package/icons/providers/zapier.webp +0 -0
- package/icons/providers/zeabur.webp +0 -0
- package/icons/providers/zencoder.webp +0 -0
- package/icons/providers/zenmux.webp +0 -0
- package/icons/providers/zero-one.webp +0 -0
- package/icons/providers/zeroone.webp +0 -0
- package/icons/providers/zhipu.webp +0 -0
- package/package.json +36 -36
- package/styles/content.css +3 -1
- package/styles/yunui.css +346 -89
- package/dist/chunk-5E3O6ANF.js.map +0 -1
- package/dist/chunk-5TOGZTAO.js.map +0 -1
- package/dist/chunk-AV5TGEJS.js +0 -54
- package/dist/chunk-AV5TGEJS.js.map +0 -1
- package/dist/chunk-GSPJ5YI6.js.map +0 -1
- package/dist/chunk-QEIBYOG2.js +0 -188
- package/dist/chunk-QEIBYOG2.js.map +0 -1
- package/dist/chunk-UYYG4XDW.js.map +0 -1
package/dist/ai.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { copyToClipboard } from './chunk-
|
|
3
|
-
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-
|
|
4
|
-
import { ThemeToggle } from './chunk-
|
|
5
|
-
import { cn, useAnchoredPosition } from './chunk-
|
|
2
|
+
import { capabilityIconColor, copyToClipboard } from './chunk-LEBQPP4B.js';
|
|
3
|
+
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-LEBQPP4B.js';
|
|
4
|
+
import { TextShimmer, ThemeToggle } from './chunk-GAXVET76.js';
|
|
5
|
+
import { cn, useAnchoredPosition, useDismissOnOutside } from './chunk-V7VJKZ5Q.js';
|
|
6
6
|
import { useYunUI } from './chunk-3RT24MSH.js';
|
|
7
|
-
import { memo, useState, useRef, useMemo
|
|
7
|
+
import { memo, useState, useEffect, useRef, useMemo } from 'react';
|
|
8
8
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
9
|
-
import { Pin, MessageSquare, Waves, Code, Eye, Brain, Pencil, Ban, Fingerprint, Layers, SlidersHorizontal, Mic, Video, Music, Box, Radio, ChevronUp, ChevronDown, Check, Copy, Image, PauseCircle, Search, X, Sparkles, Bot, Globe, Menu, Shield, Shuffle, Volume2, Headphones, Palette, Hash
|
|
9
|
+
import { Pin, MessageSquare, Waves, Code, Eye, Brain, Pencil, Ban, Fingerprint, Layers, SlidersHorizontal, Mic, Video, Music, Box, Radio, ChevronUp, ChevronDown, Check, Copy, Image, PauseCircle, Search, X, Sparkles, Bot, Globe, Menu, CircleUserRound, LogOut, ShieldAlert, Wrench, FileText, Terminal, Loader2, Shield, Shuffle, Volume2, Headphones, Palette, Hash } from 'lucide-react';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
|
|
@@ -53,9 +53,270 @@ function ThinkingBlock({ content, isStreaming, defaultOpen = false, renderConten
|
|
|
53
53
|
) })
|
|
54
54
|
] });
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
var ICONS = {
|
|
57
|
+
terminal: Terminal,
|
|
58
|
+
search: Search,
|
|
59
|
+
globe: Globe,
|
|
60
|
+
image: Image,
|
|
61
|
+
file: FileText,
|
|
62
|
+
tool: Wrench
|
|
63
|
+
};
|
|
64
|
+
function Rail({ children, tone = "muted", isLast }) {
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center self-stretch", children: [
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
className: cn(
|
|
70
|
+
"relative z-10 mt-0.5 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full bg-background ring-1 transition-colors",
|
|
71
|
+
tone === "muted" && "text-muted-foreground ring-border",
|
|
72
|
+
tone === "running" && "text-primary ring-primary/40",
|
|
73
|
+
tone === "error" && "text-(--error) ring-(--error)/40",
|
|
74
|
+
tone === "warn" && "text-(--warning) ring-(--warning)/40"
|
|
75
|
+
),
|
|
76
|
+
children
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
!isLast && /* @__PURE__ */ jsx("span", { className: "my-1 w-0.5 flex-1 rounded-full bg-border" })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
function Collapse({ open, children }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: cn(
|
|
87
|
+
"grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none",
|
|
88
|
+
open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
|
89
|
+
),
|
|
90
|
+
children: /* @__PURE__ */ jsx("div", { className: "min-h-0 overflow-hidden", children })
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function Chevron({ open }) {
|
|
95
|
+
return /* @__PURE__ */ jsx(ChevronDown, { size: 14, className: cn("shrink-0 text-muted-foreground/50 transition-transform duration-200", open && "rotate-180") });
|
|
96
|
+
}
|
|
97
|
+
function ReasoningRow({ block, isLast, renderContent }) {
|
|
98
|
+
const [open, setOpen] = useState(block.defaultOpen ?? false);
|
|
99
|
+
const expandable = Boolean(block.content.trim());
|
|
100
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2.5", children: [
|
|
101
|
+
/* @__PURE__ */ jsx(Rail, { tone: block.active ? "running" : "muted", isLast, children: /* @__PURE__ */ jsxs("span", { className: "relative flex items-center justify-center", children: [
|
|
102
|
+
block.active ? /* @__PURE__ */ jsx(
|
|
103
|
+
"span",
|
|
104
|
+
{
|
|
105
|
+
"aria-hidden": "true",
|
|
106
|
+
className: "absolute h-4 w-4 animate-ping rounded-full bg-primary/15 motion-reduce:hidden"
|
|
107
|
+
}
|
|
108
|
+
) : null,
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
110
|
+
Brain,
|
|
111
|
+
{
|
|
112
|
+
size: 13,
|
|
113
|
+
strokeWidth: 1.75,
|
|
114
|
+
className: cn(block.active && "animate-pulse motion-reduce:animate-none")
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] }) }),
|
|
118
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 pb-2", children: /* @__PURE__ */ jsxs(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
"data-yunui": "agent-timeline-reasoning-disclosure",
|
|
122
|
+
className: cn(
|
|
123
|
+
"overflow-hidden rounded-lg",
|
|
124
|
+
expandable && "border border-border/60 bg-muted/20"
|
|
125
|
+
),
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsxs(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
type: "button",
|
|
131
|
+
onClick: () => expandable && setOpen(!open),
|
|
132
|
+
"aria-expanded": expandable ? open : void 0,
|
|
133
|
+
className: cn(
|
|
134
|
+
"flex h-[30px] w-full items-center gap-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
135
|
+
expandable ? "cursor-pointer rounded-none px-2.5 hover:bg-muted/40" : "cursor-default rounded-md px-1.5"
|
|
136
|
+
),
|
|
137
|
+
children: [
|
|
138
|
+
block.active ? /* @__PURE__ */ jsx(
|
|
139
|
+
TextShimmer,
|
|
140
|
+
{
|
|
141
|
+
text: block.label,
|
|
142
|
+
className: "min-w-0 flex-1 truncate text-[13px]",
|
|
143
|
+
"data-agent-timeline-active": "true"
|
|
144
|
+
}
|
|
145
|
+
) : /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-[13px] text-muted-foreground", children: block.label }),
|
|
146
|
+
expandable ? /* @__PURE__ */ jsx(Chevron, { open }) : null
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
expandable ? /* @__PURE__ */ jsx(Collapse, { open, children: /* @__PURE__ */ jsx(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
"data-yunui": "agent-timeline-reasoning-content",
|
|
154
|
+
className: "border-t border-border/50 px-2.5 pb-2.5 pt-2 text-[12.5px] leading-relaxed text-muted-foreground",
|
|
155
|
+
children: renderContent ? renderContent(block.content) : /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap", children: block.content })
|
|
156
|
+
}
|
|
157
|
+
) }) : null
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
) })
|
|
161
|
+
] });
|
|
162
|
+
}
|
|
163
|
+
function ToolRow({ block, isLast }) {
|
|
164
|
+
const [open, setOpen] = useState(false);
|
|
165
|
+
const Icon = ICONS[block.icon ?? "tool"];
|
|
166
|
+
const error = block.status === "error";
|
|
167
|
+
const expandable = !!block.output || !!block.command;
|
|
168
|
+
const tone = block.status === "running" ? "running" : error ? "error" : "muted";
|
|
169
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex gap-2.5", block.indent && "pl-6"), children: [
|
|
170
|
+
/* @__PURE__ */ jsx(Rail, { tone, isLast, children: block.status === "running" ? /* @__PURE__ */ jsx(Loader2, { size: 13, className: "animate-spin" }) : /* @__PURE__ */ jsx(Icon, { size: 13, strokeWidth: 1.75 }) }),
|
|
171
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 pb-2", children: [
|
|
172
|
+
/* @__PURE__ */ jsxs(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "button",
|
|
176
|
+
onClick: () => expandable && setOpen(!open),
|
|
177
|
+
"aria-expanded": open,
|
|
178
|
+
className: cn(
|
|
179
|
+
"flex h-[30px] w-full items-center gap-2 rounded-md px-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
180
|
+
expandable ? "hover:bg-muted/50 cursor-pointer" : "cursor-default"
|
|
181
|
+
),
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[13px] font-medium text-foreground", children: block.verb }),
|
|
184
|
+
block.summary && /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-mono text-[11.5px] text-muted-foreground", children: block.summary }),
|
|
185
|
+
/* @__PURE__ */ jsxs("span", { className: cn("flex shrink-0 items-center gap-2", !block.summary && "ml-auto"), children: [
|
|
186
|
+
block.status === "done" && /* @__PURE__ */ jsx(Check, { size: 14, className: "text-(--success)" }),
|
|
187
|
+
error && /* @__PURE__ */ jsx("span", { className: "rounded bg-(--error)/10 px-1.5 py-0.5 font-mono text-[10.5px] font-semibold uppercase tracking-wide text-(--error)", children: "error" }),
|
|
188
|
+
expandable && /* @__PURE__ */ jsx(Chevron, { open })
|
|
189
|
+
] })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ jsx(Collapse, { open, children: /* @__PURE__ */ jsxs("div", { className: cn("mt-1.5 overflow-hidden rounded-lg border font-mono text-xs", error ? "border-(--error)/20 bg-(--error)/5" : "border-border bg-muted/40"), children: [
|
|
194
|
+
block.command && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1.5 border-b px-3 py-1.5 text-muted-foreground", error ? "border-(--error)/20" : "border-border/60"), children: [
|
|
195
|
+
/* @__PURE__ */ jsx("span", { className: "select-none text-muted-foreground/40", children: "$" }),
|
|
196
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: block.command })
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
"div",
|
|
200
|
+
{
|
|
201
|
+
tabIndex: 0,
|
|
202
|
+
role: "region",
|
|
203
|
+
"aria-label": `${block.verb} output`,
|
|
204
|
+
className: cn("max-h-72 overflow-auto whitespace-pre-wrap break-words px-3 py-2.5 leading-relaxed outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset", error ? "text-(--error)" : "text-foreground/80"),
|
|
205
|
+
children: block.output || "\u2014"
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
] }) })
|
|
209
|
+
] })
|
|
210
|
+
] });
|
|
211
|
+
}
|
|
212
|
+
function ApprovalRow({ block, isLast, onApprove, onReject }) {
|
|
213
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2.5", children: [
|
|
214
|
+
/* @__PURE__ */ jsx(Rail, { tone: "warn", isLast, children: /* @__PURE__ */ jsx(ShieldAlert, { size: 13, strokeWidth: 1.75 }) }),
|
|
215
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 pb-2", children: /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-(--warning)/25 bg-(--warning)/[0.06] px-3 py-2.5", children: [
|
|
216
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[13px] font-medium text-foreground", children: [
|
|
217
|
+
/* @__PURE__ */ jsx("span", { children: block.title }),
|
|
218
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: block.verb })
|
|
219
|
+
] }),
|
|
220
|
+
block.message && /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-[12.5px] text-muted-foreground", children: block.message }),
|
|
221
|
+
block.argsText && /* @__PURE__ */ jsx(
|
|
222
|
+
"pre",
|
|
223
|
+
{
|
|
224
|
+
tabIndex: 0,
|
|
225
|
+
role: "region",
|
|
226
|
+
"aria-label": `${block.title}: ${block.verb}`,
|
|
227
|
+
className: "mt-1.5 max-h-40 overflow-auto rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-[11.5px] text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
228
|
+
children: block.argsText
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2.5 flex items-center gap-2", children: block.decision ? /* @__PURE__ */ jsx("span", { className: cn("text-xs font-medium", block.decision === "approved" ? "text-(--success)" : "text-(--error)"), children: block.decidedLabel }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
232
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onApprove?.(block.id), className: "rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground outline-none transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring", children: block.allowLabel }),
|
|
233
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onReject?.(block.id), className: "rounded-md border border-border px-3 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring", children: block.denyLabel })
|
|
234
|
+
] }) })
|
|
235
|
+
] }) })
|
|
236
|
+
] });
|
|
237
|
+
}
|
|
238
|
+
function AgentTimeline({ blocks, renderContent, onApprove, onReject, className }) {
|
|
239
|
+
const visible = blocks.filter((b) => !(b.kind === "reasoning" && !b.content.trim() && !b.active));
|
|
240
|
+
if (!visible.length) return null;
|
|
241
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", className), children: visible.map((b, i) => {
|
|
242
|
+
const isLast = i === visible.length - 1;
|
|
243
|
+
switch (b.kind) {
|
|
244
|
+
case "reasoning":
|
|
245
|
+
return /* @__PURE__ */ jsx(ReasoningRow, { block: b, isLast, renderContent }, b.id);
|
|
246
|
+
case "tool":
|
|
247
|
+
return /* @__PURE__ */ jsx(ToolRow, { block: b, isLast }, b.id);
|
|
248
|
+
case "approval":
|
|
249
|
+
return /* @__PURE__ */ jsx(ApprovalRow, { block: b, isLast, onApprove, onReject }, b.id);
|
|
250
|
+
default:
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
}) });
|
|
254
|
+
}
|
|
255
|
+
function AgentRunStatus({
|
|
256
|
+
label,
|
|
257
|
+
phase = "thinking",
|
|
258
|
+
active = phase !== "waiting",
|
|
259
|
+
className,
|
|
260
|
+
...props
|
|
261
|
+
}) {
|
|
262
|
+
return /* @__PURE__ */ jsxs(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
role: "status",
|
|
266
|
+
"aria-live": "polite",
|
|
267
|
+
"aria-atomic": "true",
|
|
268
|
+
"data-yunui": "agent-run-status",
|
|
269
|
+
"data-phase": phase,
|
|
270
|
+
"data-active": active || void 0,
|
|
271
|
+
className: cn(
|
|
272
|
+
"flex min-h-9 w-fit max-w-full min-w-0 items-center gap-2 py-1 text-[13.5px] text-muted-foreground",
|
|
273
|
+
className
|
|
274
|
+
),
|
|
275
|
+
...props,
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ jsx(
|
|
278
|
+
TextShimmer,
|
|
279
|
+
{
|
|
280
|
+
text: label,
|
|
281
|
+
active,
|
|
282
|
+
"data-run-status-label": true,
|
|
283
|
+
className: "min-w-0 max-w-xl truncate font-medium"
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
/* @__PURE__ */ jsx(
|
|
287
|
+
"span",
|
|
288
|
+
{
|
|
289
|
+
"data-run-status-pulse": true,
|
|
290
|
+
"aria-hidden": "true",
|
|
291
|
+
className: cn(
|
|
292
|
+
"flex shrink-0 items-center gap-0.5 transition-opacity",
|
|
293
|
+
active ? "opacity-80" : "opacity-0"
|
|
294
|
+
),
|
|
295
|
+
children: [0, 1, 2].map((index) => /* @__PURE__ */ jsx(
|
|
296
|
+
"span",
|
|
297
|
+
{
|
|
298
|
+
className: "h-1 w-1 rounded-full bg-primary/60 motion-safe:animate-pulse",
|
|
299
|
+
style: {
|
|
300
|
+
animationDelay: `${index * 180}ms`,
|
|
301
|
+
animationDuration: "1.1s"
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
index
|
|
305
|
+
))
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
function IDBadge({
|
|
313
|
+
text,
|
|
314
|
+
truncate = true,
|
|
315
|
+
size = "sm"
|
|
316
|
+
}) {
|
|
57
317
|
const [copied, setCopied] = useState(false);
|
|
58
318
|
const t = useYunUI().useT("common.badge");
|
|
319
|
+
const sm = size === "sm";
|
|
59
320
|
const handleCopy = async (e) => {
|
|
60
321
|
e.preventDefault();
|
|
61
322
|
e.stopPropagation();
|
|
@@ -72,24 +333,24 @@ function IDBadge({ text, truncate = true }) {
|
|
|
72
333
|
title: t("clickToCopy", { text }),
|
|
73
334
|
"aria-label": t("clickToCopy", { text }),
|
|
74
335
|
children: [
|
|
75
|
-
/* @__PURE__ */ jsx("span", { className: `px-2 py-0.5 text-xs
|
|
76
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
336
|
+
/* @__PURE__ */ jsx("span", { className: `font-mono block ${sm ? "px-1.5 py-0 text-[11px] leading-5 text-muted-foreground" : "px-2 py-0.5 text-xs"} ${truncate ? "truncate max-w-full min-w-0" : "whitespace-nowrap"}`, children: text }),
|
|
337
|
+
/* @__PURE__ */ jsx("span", { className: `opacity-0 group-hover/badge:opacity-100 absolute right-0 inset-y-0 flex items-center justify-center rounded-r-md bg-muted/90 backdrop-blur-sm transition-opacity duration-200 ${sm ? "w-4" : "w-5"}`, children: copied ? /* @__PURE__ */ jsx(Check, { size: sm ? 9 : 10 }) : /* @__PURE__ */ jsx(Copy, { size: sm ? 9 : 10 }) })
|
|
77
338
|
]
|
|
78
339
|
}
|
|
79
340
|
);
|
|
80
341
|
}
|
|
81
342
|
var CAPABILITY_ICONS = {
|
|
82
|
-
streaming: {
|
|
83
|
-
vision: {
|
|
84
|
-
thinking: {
|
|
85
|
-
function_calling: {
|
|
86
|
-
image_edit: {
|
|
87
|
-
negative_prompt: {
|
|
88
|
-
seed_control: {
|
|
89
|
-
lora: {
|
|
90
|
-
guidance_scale: {
|
|
91
|
-
strength: {
|
|
92
|
-
batch: {
|
|
343
|
+
streaming: { color: capabilityIconColor("streaming"), icon: Waves },
|
|
344
|
+
vision: { color: capabilityIconColor("vision"), icon: Eye },
|
|
345
|
+
thinking: { color: capabilityIconColor("thinking"), icon: Brain },
|
|
346
|
+
function_calling: { color: capabilityIconColor("function_calling"), icon: Code },
|
|
347
|
+
image_edit: { color: capabilityIconColor("image_edit"), icon: Image },
|
|
348
|
+
negative_prompt: { color: capabilityIconColor("negative_prompt"), icon: Ban },
|
|
349
|
+
seed_control: { color: capabilityIconColor("seed_control"), icon: Fingerprint },
|
|
350
|
+
lora: { color: capabilityIconColor("lora"), icon: Layers },
|
|
351
|
+
guidance_scale: { color: capabilityIconColor("guidance_scale"), icon: SlidersHorizontal },
|
|
352
|
+
strength: { color: capabilityIconColor("strength"), icon: SlidersHorizontal },
|
|
353
|
+
batch: { color: capabilityIconColor("batch"), icon: Waves }
|
|
93
354
|
};
|
|
94
355
|
function ModelCard({
|
|
95
356
|
name,
|
|
@@ -147,7 +408,7 @@ function ModelCard({
|
|
|
147
408
|
] }),
|
|
148
409
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
149
410
|
context && /* @__PURE__ */ jsx("span", { className: "bg-muted px-1.5 py-0.5 rounded-sm font-medium", children: context }),
|
|
150
|
-
tier && tier !== "free" && /* @__PURE__ */ jsx("span", { className: "bg-
|
|
411
|
+
tier && tier !== "free" && /* @__PURE__ */ jsx("span", { className: "bg-warning-soft text-warning px-1.5 py-0.5 rounded-sm font-medium", children: tier }),
|
|
151
412
|
price && /* @__PURE__ */ jsx("span", { className: "font-mono", children: price })
|
|
152
413
|
] })
|
|
153
414
|
] })
|
|
@@ -155,6 +416,81 @@ function ModelCard({
|
|
|
155
416
|
}
|
|
156
417
|
);
|
|
157
418
|
}
|
|
419
|
+
function HScrollRow({ children, className }) {
|
|
420
|
+
const scrollRef = useRef(null);
|
|
421
|
+
const [thumb, setThumb] = useState({ w: 0, x: 0, show: false });
|
|
422
|
+
const sync = () => {
|
|
423
|
+
const el = scrollRef.current;
|
|
424
|
+
if (!el) return;
|
|
425
|
+
const { scrollWidth, clientWidth, scrollLeft } = el;
|
|
426
|
+
const overflow = scrollWidth - clientWidth;
|
|
427
|
+
if (overflow <= 1) {
|
|
428
|
+
setThumb((t) => t.show ? { w: 0, x: 0, show: false } : t);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const w = Math.max(clientWidth / scrollWidth * clientWidth, 28);
|
|
432
|
+
const x = scrollLeft / overflow * (clientWidth - w);
|
|
433
|
+
setThumb({ w, x, show: true });
|
|
434
|
+
};
|
|
435
|
+
useEffect(() => {
|
|
436
|
+
const el = scrollRef.current;
|
|
437
|
+
if (!el) return;
|
|
438
|
+
sync();
|
|
439
|
+
el.addEventListener("scroll", sync, { passive: true });
|
|
440
|
+
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(sync) : null;
|
|
441
|
+
ro?.observe(el);
|
|
442
|
+
if (el.firstElementChild) ro?.observe(el.firstElementChild);
|
|
443
|
+
return () => {
|
|
444
|
+
el.removeEventListener("scroll", sync);
|
|
445
|
+
ro?.disconnect();
|
|
446
|
+
};
|
|
447
|
+
}, []);
|
|
448
|
+
const onThumbDown = (e) => {
|
|
449
|
+
const el = scrollRef.current;
|
|
450
|
+
if (!el) return;
|
|
451
|
+
e.preventDefault();
|
|
452
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
453
|
+
const startX = e.clientX;
|
|
454
|
+
const startScroll = el.scrollLeft;
|
|
455
|
+
const move = (ev) => {
|
|
456
|
+
const { scrollWidth, clientWidth } = el;
|
|
457
|
+
const w = Math.max(clientWidth / scrollWidth * clientWidth, 28);
|
|
458
|
+
const travel = clientWidth - w;
|
|
459
|
+
if (travel <= 0) return;
|
|
460
|
+
el.scrollLeft = startScroll + (ev.clientX - startX) / travel * (scrollWidth - clientWidth);
|
|
461
|
+
};
|
|
462
|
+
const up = () => {
|
|
463
|
+
window.removeEventListener("pointermove", move);
|
|
464
|
+
window.removeEventListener("pointerup", up);
|
|
465
|
+
};
|
|
466
|
+
window.addEventListener("pointermove", move);
|
|
467
|
+
window.addEventListener("pointerup", up);
|
|
468
|
+
};
|
|
469
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
470
|
+
/* @__PURE__ */ jsx(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
ref: scrollRef,
|
|
474
|
+
className: cn(
|
|
475
|
+
"overflow-x-auto overflow-y-hidden overscroll-x-contain touch-pan-x [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
476
|
+
className
|
|
477
|
+
),
|
|
478
|
+
children
|
|
479
|
+
}
|
|
480
|
+
),
|
|
481
|
+
thumb.show && /* @__PURE__ */ jsx(
|
|
482
|
+
"div",
|
|
483
|
+
{
|
|
484
|
+
onPointerDown: onThumbDown,
|
|
485
|
+
role: "scrollbar",
|
|
486
|
+
"aria-orientation": "horizontal",
|
|
487
|
+
"aria-hidden": true,
|
|
488
|
+
className: "absolute bottom-0 left-0 h-1.5 rounded-full bg-muted-foreground/40 hover:bg-muted-foreground/60 active:bg-muted-foreground/70 cursor-grab active:cursor-grabbing touch-none transition-colors",
|
|
489
|
+
style: { width: `${thumb.w}px`, transform: `translateX(${thumb.x}px)` }
|
|
490
|
+
}
|
|
491
|
+
)
|
|
492
|
+
] });
|
|
493
|
+
}
|
|
158
494
|
function ModelSelect({
|
|
159
495
|
options,
|
|
160
496
|
value,
|
|
@@ -164,7 +500,9 @@ function ModelSelect({
|
|
|
164
500
|
pinned,
|
|
165
501
|
onTogglePin,
|
|
166
502
|
filters,
|
|
167
|
-
renderFooter
|
|
503
|
+
renderFooter,
|
|
504
|
+
renderHeader,
|
|
505
|
+
filterResetKey
|
|
168
506
|
}) {
|
|
169
507
|
const L = {
|
|
170
508
|
placeholder: "Select a model",
|
|
@@ -180,30 +518,25 @@ function ModelSelect({
|
|
|
180
518
|
const [search, setSearch] = useState("");
|
|
181
519
|
const [activeGroup, setActiveGroup] = useState(null);
|
|
182
520
|
const [activeFilters, setActiveFilters] = useState([]);
|
|
521
|
+
useEffect(() => {
|
|
522
|
+
setSearch("");
|
|
523
|
+
setActiveFilters([]);
|
|
524
|
+
setActiveGroup(null);
|
|
525
|
+
}, [filterResetKey]);
|
|
183
526
|
const rootRef = useRef(null);
|
|
184
527
|
const inputRef = useRef(null);
|
|
185
528
|
const listRef = useRef(null);
|
|
186
529
|
const panelRef = useRef(null);
|
|
187
|
-
const { shift, maxHeight } = useAnchoredPosition(isOpen, panelRef);
|
|
530
|
+
const { shift, maxHeight, placement } = useAnchoredPosition(isOpen, panelRef);
|
|
188
531
|
const pinnedSet = useMemo(() => new Set(pinned ?? []), [pinned]);
|
|
189
|
-
|
|
190
|
-
const onDown = (e) => {
|
|
191
|
-
if (rootRef.current && !rootRef.current.contains(e.target)) setIsOpen(false);
|
|
192
|
-
};
|
|
193
|
-
document.addEventListener("mousedown", onDown);
|
|
194
|
-
document.addEventListener("touchstart", onDown);
|
|
195
|
-
return () => {
|
|
196
|
-
document.removeEventListener("mousedown", onDown);
|
|
197
|
-
document.removeEventListener("touchstart", onDown);
|
|
198
|
-
};
|
|
199
|
-
}, []);
|
|
532
|
+
useDismissOnOutside(isOpen, () => setIsOpen(false), rootRef, { escape: false });
|
|
200
533
|
useEffect(() => {
|
|
201
534
|
if (!isOpen) return;
|
|
202
535
|
const t = setTimeout(() => {
|
|
203
536
|
inputRef.current?.focus();
|
|
204
537
|
if (value && listRef.current) {
|
|
205
538
|
const el = listRef.current.querySelector(`[data-model-id="${CSS.escape(value)}"]`);
|
|
206
|
-
el?.scrollIntoView({ block: "
|
|
539
|
+
el?.scrollIntoView({ block: "nearest" });
|
|
207
540
|
}
|
|
208
541
|
}, 50);
|
|
209
542
|
return () => clearTimeout(t);
|
|
@@ -258,6 +591,7 @@ function ModelSelect({
|
|
|
258
591
|
onChange(id);
|
|
259
592
|
setIsOpen(false);
|
|
260
593
|
};
|
|
594
|
+
const panelMaxHeight = maxHeight == null ? "min(32rem, calc(100dvh - 7rem))" : `min(${maxHeight}px, 32rem, calc(100dvh - 7rem))`;
|
|
261
595
|
const flatOptions = useMemo(() => {
|
|
262
596
|
const out = [...pinnedList];
|
|
263
597
|
for (const opts of Object.values(grouped)) out.push(...opts);
|
|
@@ -303,7 +637,7 @@ function ModelSelect({
|
|
|
303
637
|
"aria-expanded": isOpen,
|
|
304
638
|
"aria-haspopup": "listbox",
|
|
305
639
|
className: cn(
|
|
306
|
-
"flex items-center gap-2 px-3 py-2 bg-card border rounded-xl text-left group transition-all w-full shadow-sm hover:shadow-md outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
640
|
+
"flex items-center gap-2 px-3 py-2 bg-card border border-border rounded-xl text-left group transition-all w-full shadow-sm hover:shadow-md outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
307
641
|
isOpen ? "border-ring/60 ring-2 ring-ring/25" : "border-border hover:border-ring"
|
|
308
642
|
),
|
|
309
643
|
children: [
|
|
@@ -322,9 +656,11 @@ function ModelSelect({
|
|
|
322
656
|
initial: { opacity: 0, y: -8, scale: 0.96 },
|
|
323
657
|
animate: { opacity: 1, y: 0, scale: 1 },
|
|
324
658
|
transition: { duration: 0.16, ease: "easeOut" },
|
|
325
|
-
|
|
326
|
-
|
|
659
|
+
"data-yunui": "model-select-panel",
|
|
660
|
+
style: { maxWidth: "calc(100vw - 1rem)", marginLeft: shift, maxHeight: panelMaxHeight },
|
|
661
|
+
className: `absolute z-50 left-0 ${placement === "top" ? "bottom-full mb-2 origin-bottom" : "top-full mt-2 origin-top"} w-96 max-w-[calc(100vw-1rem)] flex flex-col bg-popover border border-border rounded-2xl shadow-lg shadow-black/5 text-popover-foreground overflow-hidden`,
|
|
327
662
|
children: [
|
|
663
|
+
renderHeader && /* @__PURE__ */ jsx("div", { className: "p-2.5 border-b border-border/50", children: renderHeader() }),
|
|
328
664
|
/* @__PURE__ */ jsxs("div", { className: "p-2.5 border-b border-border/50", children: [
|
|
329
665
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
330
666
|
/* @__PURE__ */ jsx(Search, { size: 15, className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }),
|
|
@@ -341,20 +677,20 @@ function ModelSelect({
|
|
|
341
677
|
"aria-expanded": isOpen,
|
|
342
678
|
"aria-controls": "yunui-ms-listbox",
|
|
343
679
|
"aria-activedescendant": activeId ? rowDomId(activeId) : void 0,
|
|
344
|
-
className: "w-full pl-9 pr-8 py-2 text-sm bg-muted/50 border border-transparent rounded-xl outline-none focus:border-ring focus:bg-background transition-colors"
|
|
680
|
+
className: "w-full pl-9 pr-8 py-2 text-base md:text-sm bg-muted/50 border border-transparent rounded-xl outline-none focus:border-ring focus:bg-background transition-colors"
|
|
345
681
|
}
|
|
346
682
|
),
|
|
347
683
|
search && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setSearch(""), title: L.clearSearch, "aria-label": L.clearSearch, className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded-md hover:bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { size: 13 }) })
|
|
348
684
|
] }),
|
|
349
|
-
filters && filters.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1
|
|
685
|
+
filters && filters.length > 0 && /* @__PURE__ */ jsx(HScrollRow, { className: "mt-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 px-2.5 pb-2 w-max", children: [
|
|
350
686
|
filters.map((f) => {
|
|
351
687
|
const on = activeFilters.includes(f.key);
|
|
352
|
-
return /* @__PURE__ */ jsx("button", { type: "button", title: f.title, "aria-label": f.title, "aria-pressed": on, onClick: () => setActiveFilters((p) => p.includes(f.key) ? p.filter((k) => k !== f.key) : [...p, f.key]), className: cn("p-1 rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", on ? "bg-foreground/10" : "hover:bg-muted"), children: f.node }, f.key);
|
|
688
|
+
return /* @__PURE__ */ jsx("button", { type: "button", title: f.title, "aria-label": f.title, "aria-pressed": on, onClick: () => setActiveFilters((p) => p.includes(f.key) ? p.filter((k) => k !== f.key) : [...p, f.key]), className: cn("shrink-0 p-1 rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", on ? "bg-foreground/10" : "hover:bg-muted"), children: f.node }, f.key);
|
|
353
689
|
}),
|
|
354
|
-
activeFilters.length > 0 && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setActiveFilters([]), title: L.clearFilters, "aria-label": L.clearFilters, className: "p-1 rounded-md text-muted-foreground hover:bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { size: 14 }) })
|
|
355
|
-
] })
|
|
690
|
+
activeFilters.length > 0 && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setActiveFilters([]), title: L.clearFilters, "aria-label": L.clearFilters, className: "shrink-0 p-1 rounded-md text-muted-foreground hover:bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { size: 14 }) })
|
|
691
|
+
] }) })
|
|
356
692
|
] }),
|
|
357
|
-
groups.length > 1 && /* @__PURE__ */ jsx("div", { className: "
|
|
693
|
+
groups.length > 1 && /* @__PURE__ */ jsx("div", { className: "border-b border-border/50", children: /* @__PURE__ */ jsx(HScrollRow, { children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 px-2.5 pt-2 pb-2.5 w-max", children: [
|
|
358
694
|
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup(null), "aria-pressed": !activeGroup, className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring", !activeGroup ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
|
|
359
695
|
L.all,
|
|
360
696
|
" (",
|
|
@@ -365,7 +701,7 @@ function ModelSelect({
|
|
|
365
701
|
groupIcon[g],
|
|
366
702
|
groupLabel[g] ?? g
|
|
367
703
|
] }, g))
|
|
368
|
-
] }) }),
|
|
704
|
+
] }) }) }),
|
|
369
705
|
/* @__PURE__ */ jsxs("div", { ref: listRef, onWheel, onMouseMove: clearActiveOnPointer, id: "yunui-ms-listbox", role: "listbox", className: "flex-1 min-h-0 max-h-96 overflow-y-auto overscroll-contain", children: [
|
|
370
706
|
pinnedList.length > 0 && /* @__PURE__ */ jsxs("div", { className: "px-1.5 py-1.5 border-b border-border/40", children: [
|
|
371
707
|
/* @__PURE__ */ jsxs("div", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide px-2 mb-1 flex items-center gap-1", children: [
|
|
@@ -425,8 +761,9 @@ var ModelRow = memo(function ModelRow2({
|
|
|
425
761
|
/* @__PURE__ */ jsx(
|
|
426
762
|
"div",
|
|
427
763
|
{
|
|
764
|
+
style: { left: "5px" },
|
|
428
765
|
className: cn(
|
|
429
|
-
"absolute
|
|
766
|
+
"absolute top-1/2 w-1 h-6 rounded-full bg-primary transition-all duration-150 -translate-y-1/2",
|
|
430
767
|
selected ? "opacity-100 translate-x-0" : "opacity-0 -translate-x-1.5 group-hover:opacity-50 group-hover:translate-x-0"
|
|
431
768
|
)
|
|
432
769
|
}
|
|
@@ -511,37 +848,37 @@ function ModelManagerCard({
|
|
|
511
848
|
);
|
|
512
849
|
}
|
|
513
850
|
var llmCapabilityConfig = [
|
|
514
|
-
{ value: "chat", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-
|
|
515
|
-
{ value: "streaming", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-
|
|
516
|
-
{ value: "function_calling", icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-
|
|
517
|
-
{ value: "vision", icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-
|
|
518
|
-
{ value: "thinking", icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-
|
|
851
|
+
{ value: "chat", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
|
|
852
|
+
{ value: "streaming", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-700 dark:text-cyan-400 border-cyan-500/20 hover:bg-cyan-500/20" },
|
|
853
|
+
{ value: "function_calling", icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-700 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" },
|
|
854
|
+
{ value: "vision", icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-700 dark:text-amber-400 border-amber-500/20 hover:bg-amber-500/20" },
|
|
855
|
+
{ value: "thinking", icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-700 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
|
|
519
856
|
];
|
|
520
857
|
var imageCapabilityConfig = [
|
|
521
|
-
{ value: "image_edit", icon: Pencil, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-
|
|
522
|
-
{ value: "negative_prompt", icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-
|
|
523
|
-
{ value: "seed_control", icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-
|
|
524
|
-
{ value: "lora", icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-
|
|
525
|
-
{ value: "guidance_scale", icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-
|
|
526
|
-
{ value: "strength", icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-
|
|
527
|
-
{ value: "batch", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-
|
|
858
|
+
{ value: "image_edit", icon: Pencil, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
|
|
859
|
+
{ value: "negative_prompt", icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" },
|
|
860
|
+
{ value: "seed_control", icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-700 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" },
|
|
861
|
+
{ value: "lora", icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-700 dark:text-teal-400 border-teal-500/20 hover:bg-teal-500/20" },
|
|
862
|
+
{ value: "guidance_scale", icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" },
|
|
863
|
+
{ value: "strength", icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
|
|
864
|
+
{ value: "batch", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-700 dark:text-cyan-400 border-cyan-500/20 hover:bg-cyan-500/20" }
|
|
528
865
|
];
|
|
529
866
|
var audioCapabilityConfig = [
|
|
530
|
-
{ value: "tts", icon: Mic, iconColor: "text-green-500", color: "bg-green-500/10 text-green-
|
|
531
|
-
{ value: "stt", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-
|
|
532
|
-
{ value: "audio_translation", icon: Waves, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-
|
|
867
|
+
{ value: "tts", icon: Mic, iconColor: "text-green-500", color: "bg-green-500/10 text-green-700 dark:text-green-400 border-green-500/20 hover:bg-green-500/20" },
|
|
868
|
+
{ value: "stt", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
|
|
869
|
+
{ value: "audio_translation", icon: Waves, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-700 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" }
|
|
533
870
|
];
|
|
534
871
|
var videoCapabilityConfig = [
|
|
535
|
-
{ value: "video_generation", icon: Video, iconColor: "text-red-500", color: "bg-red-500/10 text-red-
|
|
872
|
+
{ value: "video_generation", icon: Video, iconColor: "text-red-500", color: "bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" }
|
|
536
873
|
];
|
|
537
874
|
var musicCapabilityConfig = [
|
|
538
|
-
{ value: "music_generation", icon: Music, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-
|
|
875
|
+
{ value: "music_generation", icon: Music, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-700 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
|
|
539
876
|
];
|
|
540
877
|
var threedCapabilityConfig = [
|
|
541
|
-
{ value: "threed_generation", icon: Box, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-
|
|
878
|
+
{ value: "threed_generation", icon: Box, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-700 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" }
|
|
542
879
|
];
|
|
543
880
|
var realtimeCapabilityConfig = [
|
|
544
|
-
{ value: "realtime_voice", icon: Radio, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-
|
|
881
|
+
{ value: "realtime_voice", icon: Radio, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" }
|
|
545
882
|
];
|
|
546
883
|
function CapabilitySelector({ selected, onChange, disabled = false, size = "md", columns = 4, modelType }) {
|
|
547
884
|
const t = useYunUI().useT("capabilities");
|
|
@@ -1035,6 +1372,41 @@ var developerIconMap = {
|
|
|
1035
1372
|
minicpm: "minicpm.webp",
|
|
1036
1373
|
nousresearch: "nousresearch.webp"
|
|
1037
1374
|
};
|
|
1375
|
+
var modelDeveloperPatterns = [
|
|
1376
|
+
[/claude|anthropic/, "claude"],
|
|
1377
|
+
[/gemini/, "gemini"],
|
|
1378
|
+
[/gemma/, "gemma"],
|
|
1379
|
+
[/palm|bison/, "palm"],
|
|
1380
|
+
[/gpt|openai|davinci|chatgpt|text-embedding|dall-?e|whisper|codex|o[134]-/, "openai"],
|
|
1381
|
+
[/glm|chatglm|zhipu|z\.?ai/, "zai"],
|
|
1382
|
+
[/minimax|hailuo|abab/, "minimax"],
|
|
1383
|
+
[/qwen|qwq|dashscope|alibaba|tongyi/, "qwen"],
|
|
1384
|
+
[/deepseek/, "deepseek"],
|
|
1385
|
+
[/llama|meta-/, "meta"],
|
|
1386
|
+
[/mistral|mixtral|codestral|pixtral|magistral|ministral/, "mistral"],
|
|
1387
|
+
[/grok|x-?ai/, "xai"],
|
|
1388
|
+
[/moonshot|kimi/, "moonshot"],
|
|
1389
|
+
[/doubao/, "doubao"],
|
|
1390
|
+
[/hunyuan/, "hunyuan"],
|
|
1391
|
+
[/ernie|wenxin|baidu/, "wenxin"],
|
|
1392
|
+
[/step-|stepfun/, "stepfun"],
|
|
1393
|
+
[/yi-|zero-one|01-ai/, "yi"],
|
|
1394
|
+
[/command|cohere/, "cohere"],
|
|
1395
|
+
[/phi-\d|microsoft/, "microsoft"],
|
|
1396
|
+
[/nemotron|nvidia/, "nvidia"],
|
|
1397
|
+
[/internlm|internvl/, "internlm"],
|
|
1398
|
+
[/flux/, "flux"]
|
|
1399
|
+
];
|
|
1400
|
+
function getModelDeveloperId(...identifiers) {
|
|
1401
|
+
const haystack = identifiers.filter(Boolean).join(" ").toLowerCase();
|
|
1402
|
+
for (const [pattern, developer] of modelDeveloperPatterns) {
|
|
1403
|
+
if (pattern.test(haystack)) return developer;
|
|
1404
|
+
}
|
|
1405
|
+
const first = identifiers.find((value) => Boolean(value));
|
|
1406
|
+
if (!first) return "";
|
|
1407
|
+
const parts = first.split("/").filter(Boolean);
|
|
1408
|
+
return parts.at(-1) || first;
|
|
1409
|
+
}
|
|
1038
1410
|
function getDeveloperIconPath(developer) {
|
|
1039
1411
|
if (!developer) return null;
|
|
1040
1412
|
const file = getDeveloperIconFile(developer);
|
|
@@ -1123,6 +1495,7 @@ var providerIconMap = {
|
|
|
1123
1495
|
ppio: "ppio.webp",
|
|
1124
1496
|
vertexai: "vertexai.webp",
|
|
1125
1497
|
gcp: "vertexai.webp",
|
|
1498
|
+
gmi: "gmi.svg",
|
|
1126
1499
|
"302ai": "302ai.webp",
|
|
1127
1500
|
aihubmix: "aihubmix.webp",
|
|
1128
1501
|
dmxapi: "DMXAPI.png",
|
|
@@ -1339,6 +1712,7 @@ var ProviderNames = {
|
|
|
1339
1712
|
ppio: "PPIO",
|
|
1340
1713
|
vertexai: "Vertex AI",
|
|
1341
1714
|
gcp: "Vertex AI",
|
|
1715
|
+
gmi: "GMI Cloud",
|
|
1342
1716
|
"302ai": "302.AI",
|
|
1343
1717
|
aihubmix: "AiHubMix",
|
|
1344
1718
|
dmxapi: "DMXAPI",
|
|
@@ -1482,20 +1856,20 @@ function ProviderIconImg({ provider, size = 16 }) {
|
|
|
1482
1856
|
return /* @__PURE__ */ jsx(ProviderIcon, { provider, size, rounded: true });
|
|
1483
1857
|
}
|
|
1484
1858
|
var MODEL_TYPE_ICONS = {
|
|
1485
|
-
chat: /* @__PURE__ */ jsx(MessageSquare, { size: 16, className: "text-blue-
|
|
1486
|
-
completion: /* @__PURE__ */ jsx(FileText, { size: 16, className: "text-gray-
|
|
1487
|
-
embedding: /* @__PURE__ */ jsx(Hash, { size: 16, className: "text-purple-
|
|
1488
|
-
image_generation: /* @__PURE__ */ jsx(Palette, { size: 16, className: "text-pink-
|
|
1489
|
-
audio: /* @__PURE__ */ jsx(Headphones, { size: 16, className: "text-orange-
|
|
1490
|
-
tts: /* @__PURE__ */ jsx(Volume2, { size: 16, className: "text-green-
|
|
1491
|
-
stt: /* @__PURE__ */ jsx(Mic, { size: 16, className: "text-red-
|
|
1492
|
-
video: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-
|
|
1493
|
-
video_generation: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-
|
|
1494
|
-
music_generation: /* @__PURE__ */ jsx(Music, { size: 16, className: "text-orange-
|
|
1495
|
-
rerank: /* @__PURE__ */ jsx(Shuffle, { size: 16, className: "text-indigo-
|
|
1496
|
-
moderation: /* @__PURE__ */ jsx(Shield, { size: 16, className: "text-yellow-
|
|
1497
|
-
"3d": /* @__PURE__ */ jsx(Box, { size: 16, className: "text-amber-
|
|
1498
|
-
realtime: /* @__PURE__ */ jsx(Radio, { size: 16, className: "text-yellow-
|
|
1859
|
+
chat: /* @__PURE__ */ jsx(MessageSquare, { size: 16, className: "text-blue-600" }),
|
|
1860
|
+
completion: /* @__PURE__ */ jsx(FileText, { size: 16, className: "text-gray-600" }),
|
|
1861
|
+
embedding: /* @__PURE__ */ jsx(Hash, { size: 16, className: "text-purple-600" }),
|
|
1862
|
+
image_generation: /* @__PURE__ */ jsx(Palette, { size: 16, className: "text-pink-600" }),
|
|
1863
|
+
audio: /* @__PURE__ */ jsx(Headphones, { size: 16, className: "text-orange-600" }),
|
|
1864
|
+
tts: /* @__PURE__ */ jsx(Volume2, { size: 16, className: "text-green-600" }),
|
|
1865
|
+
stt: /* @__PURE__ */ jsx(Mic, { size: 16, className: "text-red-600" }),
|
|
1866
|
+
video: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-600" }),
|
|
1867
|
+
video_generation: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-600" }),
|
|
1868
|
+
music_generation: /* @__PURE__ */ jsx(Music, { size: 16, className: "text-orange-600" }),
|
|
1869
|
+
rerank: /* @__PURE__ */ jsx(Shuffle, { size: 16, className: "text-indigo-600" }),
|
|
1870
|
+
moderation: /* @__PURE__ */ jsx(Shield, { size: 16, className: "text-yellow-600" }),
|
|
1871
|
+
"3d": /* @__PURE__ */ jsx(Box, { size: 16, className: "text-amber-600" }),
|
|
1872
|
+
realtime: /* @__PURE__ */ jsx(Radio, { size: 16, className: "text-yellow-600" })
|
|
1499
1873
|
};
|
|
1500
1874
|
function ModelTypeIcon({ type, size = 16 }) {
|
|
1501
1875
|
const icon = MODEL_TYPE_ICONS[type.toLowerCase()];
|
|
@@ -1505,13 +1879,13 @@ function ModelTypeIcon({ type, size = 16 }) {
|
|
|
1505
1879
|
return /* @__PURE__ */ jsx(Bot, { size, className: "text-muted-foreground" });
|
|
1506
1880
|
}
|
|
1507
1881
|
var variants = {
|
|
1508
|
-
primary: "bg-
|
|
1509
|
-
outline: "border hover:bg-
|
|
1510
|
-
ghost: "hover:bg-
|
|
1511
|
-
secondary: "border bg-
|
|
1882
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/80 disabled:bg-secondary disabled:text-secondary-foreground",
|
|
1883
|
+
outline: "border border-border hover:bg-accent hover:text-accent-foreground",
|
|
1884
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
1885
|
+
secondary: "border border-border bg-secondary text-secondary-foreground hover:bg-accent hover:text-accent-foreground"
|
|
1512
1886
|
};
|
|
1513
1887
|
var buttonVariants = cva(
|
|
1514
|
-
"inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
1888
|
+
"inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1515
1889
|
{
|
|
1516
1890
|
variants: {
|
|
1517
1891
|
variant: variants,
|
|
@@ -1540,16 +1914,8 @@ function LanguageSwitcher({
|
|
|
1540
1914
|
const containerRef = useRef(null);
|
|
1541
1915
|
const triggerRef = useRef(null);
|
|
1542
1916
|
const panelRef = useRef(null);
|
|
1543
|
-
const { shift, maxHeight } = useAnchoredPosition(isOpen, panelRef);
|
|
1544
|
-
|
|
1545
|
-
const handleClickOutside = (e) => {
|
|
1546
|
-
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1547
|
-
setIsOpen(false);
|
|
1548
|
-
}
|
|
1549
|
-
};
|
|
1550
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
1551
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1552
|
-
}, []);
|
|
1917
|
+
const { shift, maxHeight, placement } = useAnchoredPosition(isOpen, panelRef);
|
|
1918
|
+
useDismissOnOutside(isOpen, () => setIsOpen(false), containerRef, { escape: false });
|
|
1553
1919
|
useEffect(() => {
|
|
1554
1920
|
if (!isOpen) return;
|
|
1555
1921
|
const onKey = (e) => {
|
|
@@ -1567,53 +1933,57 @@ function LanguageSwitcher({
|
|
|
1567
1933
|
onChange(newLocale);
|
|
1568
1934
|
};
|
|
1569
1935
|
const currentLabel = locales.find((l) => l.value === currentLocale)?.label ?? currentLocale;
|
|
1570
|
-
return
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
{
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1936
|
+
return (
|
|
1937
|
+
// inline-flex so the root shrink-wraps the trigger; a block root filled the row and made the
|
|
1938
|
+
// right-0 dropdown anchor to the row's far edge instead of the trigger.
|
|
1939
|
+
/* @__PURE__ */ jsxs("div", { ref: containerRef, className: `relative inline-flex ${className}`, children: [
|
|
1940
|
+
variant === "pill" ? /* @__PURE__ */ jsxs(
|
|
1941
|
+
"button",
|
|
1942
|
+
{
|
|
1943
|
+
ref: triggerRef,
|
|
1944
|
+
onClick: () => setIsOpen(!isOpen),
|
|
1945
|
+
className: "flex items-center gap-1.5 h-9 px-2.5 sm:px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1946
|
+
disabled: pending,
|
|
1947
|
+
"aria-label": label,
|
|
1948
|
+
"aria-expanded": isOpen,
|
|
1949
|
+
"aria-haspopup": "listbox",
|
|
1950
|
+
children: [
|
|
1951
|
+
/* @__PURE__ */ jsx(Globe, { size: 14, className: "shrink-0" }),
|
|
1952
|
+
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: currentLabel })
|
|
1953
|
+
]
|
|
1954
|
+
}
|
|
1955
|
+
) : /* @__PURE__ */ jsx(
|
|
1956
|
+
"button",
|
|
1957
|
+
{
|
|
1958
|
+
ref: triggerRef,
|
|
1959
|
+
onClick: () => setIsOpen(!isOpen),
|
|
1960
|
+
className: "w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1961
|
+
disabled: pending,
|
|
1962
|
+
"aria-label": label,
|
|
1963
|
+
"aria-expanded": isOpen,
|
|
1964
|
+
"aria-haspopup": "listbox",
|
|
1965
|
+
children: /* @__PURE__ */ jsx(Globe, { className: "h-[1.2rem] w-[1.2rem]" })
|
|
1966
|
+
}
|
|
1967
|
+
),
|
|
1968
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
1969
|
+
"div",
|
|
1970
|
+
{
|
|
1971
|
+
ref: panelRef,
|
|
1972
|
+
style: { marginLeft: shift, maxHeight },
|
|
1973
|
+
className: `absolute ${align === "left" ? "left-0" : "right-0"} ${placement === "top" ? "bottom-full mb-2 origin-bottom" : "top-full mt-2 origin-top"} z-50 flex flex-col overflow-hidden rounded-2xl border border-border bg-popover/95 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 animate-in fade-in-0 zoom-in-95 duration-200`,
|
|
1974
|
+
children: /* @__PURE__ */ jsx("div", { className: "p-1 flex-1 min-h-0 overflow-y-auto", children: locales.map((lang) => /* @__PURE__ */ jsx(
|
|
1975
|
+
"button",
|
|
1976
|
+
{
|
|
1977
|
+
onClick: () => handleLocaleChange(lang.value),
|
|
1978
|
+
className: `dropdown-item w-full text-left ${currentLocale === lang.value ? "active" : ""}`,
|
|
1979
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: lang.label })
|
|
1980
|
+
},
|
|
1981
|
+
lang.value
|
|
1982
|
+
)) })
|
|
1983
|
+
}
|
|
1984
|
+
)
|
|
1985
|
+
] })
|
|
1986
|
+
);
|
|
1617
1987
|
}
|
|
1618
1988
|
function Navbar({
|
|
1619
1989
|
appName,
|
|
@@ -1626,7 +1996,14 @@ function Navbar({
|
|
|
1626
1996
|
themeToggle,
|
|
1627
1997
|
homeHref = "/",
|
|
1628
1998
|
loginHref = "/login",
|
|
1629
|
-
signupHref = "/signup"
|
|
1999
|
+
signupHref = "/signup",
|
|
2000
|
+
account,
|
|
2001
|
+
brand,
|
|
2002
|
+
actions,
|
|
2003
|
+
mobileMenuHeader,
|
|
2004
|
+
mobileMenuFooter,
|
|
2005
|
+
label,
|
|
2006
|
+
className
|
|
1630
2007
|
}) {
|
|
1631
2008
|
const { Link, Image } = useYunUI();
|
|
1632
2009
|
const [scrollSection, setScrollSection] = useState("");
|
|
@@ -1678,12 +2055,13 @@ function Navbar({
|
|
|
1678
2055
|
"nav",
|
|
1679
2056
|
{
|
|
1680
2057
|
style: { top: "max(1.5rem, env(safe-area-inset-top))" },
|
|
1681
|
-
|
|
2058
|
+
"aria-label": label,
|
|
2059
|
+
className: `fixed inset-x-0 mx-auto z-50 px-6 py-2.5 max-w-6xl w-[calc(100%-48px)] bg-background/80 backdrop-blur-xl border border-border rounded-full shadow-md flex items-center justify-between${className ? ` ${className}` : ""}`,
|
|
1682
2060
|
children: [
|
|
1683
|
-
/* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ jsx(Link, { href: homeHref, className: "flex items-center gap-2 min-w-0 rounded-lg px-2 py-1 -mx-2 hover:bg-foreground/5 transition-colors duration-200", children: brand ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1684
2062
|
/* @__PURE__ */ jsx(Image, { src: logoSrc, alt: appName, width: 28, height: 28, className: "w-7 h-7 shrink-0" }),
|
|
1685
2063
|
/* @__PURE__ */ jsx("span", { className: "font-semibold text-sm tracking-tight truncate", children: appName })
|
|
1686
|
-
] }),
|
|
2064
|
+
] }) }),
|
|
1687
2065
|
variant === "public" && /* @__PURE__ */ jsx("div", { className: "hidden md:flex items-center gap-6 lg:gap-8 absolute left-1/2 -translate-x-1/2", children: links.map((link) => /* @__PURE__ */ jsxs(
|
|
1688
2066
|
Link,
|
|
1689
2067
|
{
|
|
@@ -1697,9 +2075,11 @@ function Navbar({
|
|
|
1697
2075
|
link.href
|
|
1698
2076
|
)) }),
|
|
1699
2077
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
1700
|
-
/* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children:
|
|
2078
|
+
actions && /* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children: actions }),
|
|
2079
|
+
languageSwitcher && /* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children: languageSwitcher }),
|
|
1701
2080
|
themeToggle ?? /* @__PURE__ */ jsx(ThemeToggle, { variant: "pill" }),
|
|
1702
|
-
variant !== "minimal" &&
|
|
2081
|
+
variant !== "minimal" && account,
|
|
2082
|
+
variant !== "minimal" && !account && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1703
2083
|
/* @__PURE__ */ jsx(
|
|
1704
2084
|
Link,
|
|
1705
2085
|
{
|
|
@@ -1731,7 +2111,8 @@ function Navbar({
|
|
|
1731
2111
|
] }),
|
|
1732
2112
|
variant === "public" && menuOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1733
2113
|
/* @__PURE__ */ jsx("div", { className: "md:hidden fixed inset-0 -z-10", "aria-hidden": "true", onClick: () => setMenuOpen(false) }),
|
|
1734
|
-
/* @__PURE__ */ jsxs("div", { className: "md:hidden absolute top-full left-0 right-0 mt-3 p-2 bg-
|
|
2114
|
+
/* @__PURE__ */ jsxs("div", { className: "md:hidden absolute top-full left-0 right-0 mt-3 p-2 bg-popover border border-border rounded-2xl shadow-lg shadow-black/5 flex flex-col gap-0.5", children: [
|
|
2115
|
+
mobileMenuHeader,
|
|
1735
2116
|
links.map((link) => /* @__PURE__ */ jsx(
|
|
1736
2117
|
Link,
|
|
1737
2118
|
{
|
|
@@ -1743,32 +2124,145 @@ function Navbar({
|
|
|
1743
2124
|
link.href
|
|
1744
2125
|
)),
|
|
1745
2126
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1746
|
-
languageSwitcher && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5", children: languageSwitcher }),
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
2127
|
+
mobileMenuFooter ?? (languageSwitcher && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5", children: languageSwitcher })),
|
|
2128
|
+
!account && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2129
|
+
/* @__PURE__ */ jsx(
|
|
2130
|
+
Link,
|
|
2131
|
+
{
|
|
2132
|
+
href: loginHref,
|
|
2133
|
+
onClick: () => setMenuOpen(false),
|
|
2134
|
+
className: "px-4 py-2.5 rounded-xl text-sm text-muted-foreground transition-colors hover:bg-foreground/5",
|
|
2135
|
+
children: signIn
|
|
2136
|
+
}
|
|
2137
|
+
),
|
|
2138
|
+
/* @__PURE__ */ jsx(
|
|
2139
|
+
Link,
|
|
2140
|
+
{
|
|
2141
|
+
href: signupHref,
|
|
2142
|
+
onClick: () => setMenuOpen(false),
|
|
2143
|
+
className: "mt-0.5 px-4 py-2.5 rounded-xl text-sm font-medium text-center bg-foreground text-background hover:bg-foreground/90 transition-colors yunui-accent-bg yunui-accent-on",
|
|
2144
|
+
children: signUp
|
|
2145
|
+
}
|
|
2146
|
+
)
|
|
2147
|
+
] })
|
|
1765
2148
|
] })
|
|
1766
2149
|
] })
|
|
1767
2150
|
]
|
|
1768
2151
|
}
|
|
1769
2152
|
);
|
|
1770
2153
|
}
|
|
2154
|
+
function AccountMenu({
|
|
2155
|
+
user,
|
|
2156
|
+
items = [],
|
|
2157
|
+
signInHref,
|
|
2158
|
+
onSignOut,
|
|
2159
|
+
labels,
|
|
2160
|
+
className
|
|
2161
|
+
}) {
|
|
2162
|
+
const { Link } = useYunUI();
|
|
2163
|
+
const [open, setOpen] = useState(false);
|
|
2164
|
+
const ref = useRef(null);
|
|
2165
|
+
const signInLabel = labels?.signIn ?? "Sign in";
|
|
2166
|
+
const signOutLabel = labels?.signOut ?? "Sign out";
|
|
2167
|
+
const fallbackName = labels?.fallbackName ?? "Account";
|
|
2168
|
+
useDismissOnOutside(open, () => setOpen(false), ref);
|
|
2169
|
+
if (user === void 0) {
|
|
2170
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("block h-9 w-9", className) });
|
|
2171
|
+
}
|
|
2172
|
+
if (user === null) {
|
|
2173
|
+
return /* @__PURE__ */ jsx(
|
|
2174
|
+
Link,
|
|
2175
|
+
{
|
|
2176
|
+
href: signInHref,
|
|
2177
|
+
"aria-label": signInLabel,
|
|
2178
|
+
className: cn(
|
|
2179
|
+
"flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground",
|
|
2180
|
+
className
|
|
2181
|
+
),
|
|
2182
|
+
children: /* @__PURE__ */ jsx(CircleUserRound, { className: "h-4 w-4" })
|
|
2183
|
+
}
|
|
2184
|
+
);
|
|
2185
|
+
}
|
|
2186
|
+
const name = user.name || fallbackName;
|
|
2187
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn("relative", className), children: [
|
|
2188
|
+
/* @__PURE__ */ jsx(
|
|
2189
|
+
"button",
|
|
2190
|
+
{
|
|
2191
|
+
type: "button",
|
|
2192
|
+
onClick: () => setOpen((v) => !v),
|
|
2193
|
+
"aria-haspopup": "menu",
|
|
2194
|
+
"aria-expanded": open,
|
|
2195
|
+
"aria-label": labels?.menu ?? name,
|
|
2196
|
+
className: "flex h-9 w-9 items-center justify-center overflow-hidden rounded-full transition-colors hover:bg-foreground/5 outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2197
|
+
children: user.avatarUrl ? (
|
|
2198
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
2199
|
+
/* @__PURE__ */ jsx("img", { src: user.avatarUrl, alt: "", width: 28, height: 28, className: "h-7 w-7 rounded-full" })
|
|
2200
|
+
) : /* @__PURE__ */ jsx(CircleUserRound, { className: "h-4 w-4 text-muted-foreground" })
|
|
2201
|
+
}
|
|
2202
|
+
),
|
|
2203
|
+
open && /* @__PURE__ */ jsxs(
|
|
2204
|
+
"div",
|
|
2205
|
+
{
|
|
2206
|
+
role: "menu",
|
|
2207
|
+
className: "absolute right-0 top-full z-50 mt-2 w-56 rounded-2xl border border-border bg-popover/95 p-1.5 shadow-lg shadow-black/5 backdrop-blur-2xl",
|
|
2208
|
+
children: [
|
|
2209
|
+
/* @__PURE__ */ jsxs("div", { className: "border-b border-border px-3 py-2.5", children: [
|
|
2210
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: name }),
|
|
2211
|
+
user.email && /* @__PURE__ */ jsx("p", { className: "text-caption truncate", children: user.email })
|
|
2212
|
+
] }),
|
|
2213
|
+
items.map((item) => {
|
|
2214
|
+
const Icon = item.icon;
|
|
2215
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2216
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4", "aria-hidden": true }),
|
|
2217
|
+
item.label
|
|
2218
|
+
] });
|
|
2219
|
+
const rowClass = "mt-1 flex w-full items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
2220
|
+
return item.onSelect ? /* @__PURE__ */ jsx(
|
|
2221
|
+
"button",
|
|
2222
|
+
{
|
|
2223
|
+
type: "button",
|
|
2224
|
+
role: "menuitem",
|
|
2225
|
+
onClick: () => {
|
|
2226
|
+
item.onSelect?.();
|
|
2227
|
+
setOpen(false);
|
|
2228
|
+
},
|
|
2229
|
+
className: rowClass,
|
|
2230
|
+
children: body
|
|
2231
|
+
},
|
|
2232
|
+
item.key
|
|
2233
|
+
) : /* @__PURE__ */ jsx(
|
|
2234
|
+
Link,
|
|
2235
|
+
{
|
|
2236
|
+
href: item.href ?? "#",
|
|
2237
|
+
onClick: () => setOpen(false),
|
|
2238
|
+
className: rowClass,
|
|
2239
|
+
children: body
|
|
2240
|
+
},
|
|
2241
|
+
item.key
|
|
2242
|
+
);
|
|
2243
|
+
}),
|
|
2244
|
+
onSignOut && /* @__PURE__ */ jsxs(
|
|
2245
|
+
"button",
|
|
2246
|
+
{
|
|
2247
|
+
type: "button",
|
|
2248
|
+
role: "menuitem",
|
|
2249
|
+
onClick: () => {
|
|
2250
|
+
onSignOut();
|
|
2251
|
+
setOpen(false);
|
|
2252
|
+
},
|
|
2253
|
+
className: "mt-1 flex w-full items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2254
|
+
children: [
|
|
2255
|
+
/* @__PURE__ */ jsx(LogOut, { className: "h-4 w-4", "aria-hidden": true }),
|
|
2256
|
+
signOutLabel
|
|
2257
|
+
]
|
|
2258
|
+
}
|
|
2259
|
+
)
|
|
2260
|
+
]
|
|
2261
|
+
}
|
|
2262
|
+
)
|
|
2263
|
+
] });
|
|
2264
|
+
}
|
|
1771
2265
|
|
|
1772
|
-
export { CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelManagerCard, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
2266
|
+
export { AccountMenu, AgentRunStatus, AgentTimeline, CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelManagerCard, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getModelDeveloperId, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
1773
2267
|
//# sourceMappingURL=ai.js.map
|
|
1774
2268
|
//# sourceMappingURL=ai.js.map
|