feat: expand model icons, guard uploads, and handle seach env better
This commit is contained in:
@@ -179,6 +179,10 @@ watch(() => props.agent?.defaultModelId, (newModelId) => {
|
||||
})
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (isUploading.value || hasFailedUploads.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (props.loading) {
|
||||
emit('cancel');
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<script setup lang="ts">
|
||||
import { useId } from "vue";
|
||||
|
||||
withDefaults(defineProps<{
|
||||
size?: string | number;
|
||||
color?: boolean;
|
||||
avatar?: boolean;
|
||||
}>(), {
|
||||
size: 24,
|
||||
});
|
||||
|
||||
const titleId = useId();
|
||||
const BACKGROUND_COLOR = "#a3e6d9";
|
||||
const AVATAR_SCALE = 0.7;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="inline-flex items-center justify-center"
|
||||
:style="{ width: `${size}px`, height: `${size}px`, backgroundColor: avatar ? BACKGROUND_COLOR : undefined, borderRadius: avatar ? '0.375rem' : undefined }">
|
||||
<!-- Artwork from https://github.com/lobehub/lobe-icons/pull/396 (MIT; see LICENSE). -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" :width="size" :height="size"
|
||||
viewBox="0 0 24 24" :fill="avatar ? '#000' : 'currentColor'" fill-rule="evenodd"
|
||||
role="img" :aria-labelledby="titleId" style="flex: none; line-height: 1;"
|
||||
:style="{ transform: avatar ? `scale(${AVATAR_SCALE})` : undefined }">
|
||||
<title :id="titleId">Dots Studio</title>
|
||||
<path d="M8.429 23.18a67 67 0 0 1-.423-2.074c0-.024 2.298-.042 5.106-.042 4.836 0 5.104.005 5.077.098a19 19 0 0 0-.148.714c-.066.34-.158.787-.204.996l-.084.378h-4.651c-3.671 0-4.656-.015-4.673-.07m1.89-6.37-6.351-1.1-.054-.195c-.05-.177-.025-.247.286-.836 1.975-3.727 5.2-7.438 8.824-10.153 1.898-1.422 4.002-2.647 6.013-3.502.733-.311.744-.314.897-.218l.17.106c.01.005-.728 3.81-1.64 8.457-.91 4.645-1.655 8.47-1.655 8.5s-.032.052-.07.048-2.928-.502-6.42-1.107m4.799-1.675c.293-1.376 2.09-10.679 2.067-10.701-.017-.017-.354.172-.75.418-2.186 1.362-3.772 2.637-5.599 4.501a27.4 27.4 0 0 0-3.302 4.03c-.367.545-.419.648-.331.668.25.056 7.628 1.337 7.737 1.343.101.006.13-.037.178-.26z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
import { useId } from "vue";
|
||||
|
||||
withDefaults(defineProps<{
|
||||
size?: string | number;
|
||||
color?: boolean;
|
||||
avatar?: boolean;
|
||||
}>(), {
|
||||
size: 24,
|
||||
});
|
||||
|
||||
const titleId = useId();
|
||||
const BACKGROUND_COLOR = "#fff";
|
||||
const AVATAR_SCALE = 0.75;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="inline-flex items-center justify-center"
|
||||
:style="{ width: `${size}px`, height: `${size}px`, backgroundColor: avatar ? BACKGROUND_COLOR : undefined, borderRadius: avatar ? '0.375rem' : undefined }">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" :width="size" :height="size"
|
||||
viewBox="0 0 24 24" :fill="avatar || color ? '#000' : 'currentColor'" role="img" :aria-labelledby="titleId"
|
||||
style="flex: none; line-height: 1;"
|
||||
:style="{ transform: avatar ? `scale(${AVATAR_SCALE})` : undefined }">
|
||||
<title :id="titleId">Nex AGI</title>
|
||||
<g transform="matrix(.02777778 0 0 .02777778 -2.222222 -2.222222)">
|
||||
<path d="M634.153 529.915C634.153 536.056 631.023 541.773 625.849 545.081C620.674 548.388 614.17 548.83 608.597 546.251L367.982 434.957L367.983 749.839C367.983 755.934 364.899 761.615 359.787 764.935L137.804 909.096C132.269 912.69 125.211 912.968 119.411 909.819C113.611 906.67 110 900.599 110 894V156.359C110 150.25 113.099 144.558 118.229 141.242C123.361 137.926 129.823 137.438 135.394 139.948L623.547 359.872C630.002 362.78 634.153 369.203 634.153 376.284V529.915Z"></path>
|
||||
<path d="M389.847 493.085C389.847 486.944 392.977 481.227 398.151 477.919C403.326 474.612 409.83 474.17 415.403 476.749L656.018 588.043L656.017 273.161C656.017 267.066 659.101 261.385 664.213 258.065L886.196 113.904C891.731 110.31 898.789 110.032 904.589 113.181C910.389 116.33 914 122.401 914 129L914 866.641C914 872.75 910.901 878.442 905.771 881.758C900.639 885.074 894.177 885.562 888.606 883.052L400.453 663.128C393.998 660.22 389.847 653.797 389.847 646.716V493.085Z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
@@ -16,17 +16,16 @@ const [a, b, c, d] = useFillIds(TITLE, 4);
|
||||
<template>
|
||||
<div class="inline-flex items-center justify-center"
|
||||
:style="[`width: ${size}px; height: ${size}px;`, avatar ? `background-color: ${BACKGROUND_COLOR}; border-radius: 0.375rem;` : '']">
|
||||
<!-- TODO: scale to 24px -->
|
||||
<svg :style="[`width: ${size}px; height: ${size}px; flex: none; line-height: 1;`, avatar ? `transform: scale(${AVATAR_SCALE});` : '']"
|
||||
style="flex: none; line-height: 1;" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
style="flex: none; line-height: 1;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>{{ TITLE }}</title>
|
||||
<mask :id="d!.id" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="32" height="32">
|
||||
<rect width="32" height="32" :fill="a!.fill" style="" />
|
||||
<rect width="32" height="32" :fill="b!.fill" style="" />
|
||||
<rect width="32" height="32" :fill="c!.fill" style="" />
|
||||
</mask>
|
||||
<g :mask="d!.fill">
|
||||
<path
|
||||
<g transform="scale(0.75)">
|
||||
<path :mask="d!.fill"
|
||||
d="M8.98976 30.3815C6.02045 28.9329 3.60852 26.6447 2.01266 23.7643C0.453682 20.9498 -0.219858 17.775 0.0629571 14.5827C0.126988 13.8674 0.757216 13.3392 1.47289 13.4024C2.18722 13.466 2.71622 14.0968 2.65309 14.8126C2.41613 17.4865 2.98128 20.1467 4.28757 22.5053C5.41219 24.536 7.023 26.2153 8.9891 27.4192L15.1043 14.8784C12.7106 14.0812 10.7169 14.4282 10.5375 14.4631C10.5112 14.4692 10.4858 14.4735 10.4599 14.4786C9.86386 14.5784 9.28735 14.2527 9.05527 13.7111C8.73499 13.1131 7.77341 11.6515 6.60959 11.0837C5.44577 10.516 3.65213 10.6991 3.07471 10.8246C2.58789 10.931 2.08122 10.7494 1.77371 10.358C1.4662 9.9665 1.40726 9.43259 1.62554 8.98496C5.48998 1.05529 15.087 -2.24965 23.0153 1.61816C30.9437 5.48598 34.2453 15.0756 30.3875 23.003C30.3836 23.0111 30.3796 23.0192 30.3752 23.0282C26.504 30.949 16.9145 34.2476 8.98976 30.3815ZM17.44 16.0179L11.3253 28.5578C17.4968 30.8631 24.5196 28.3019 27.731 22.4803C27.2796 21.7817 26.4875 20.78 25.5709 20.3328C24.3864 19.7549 22.6509 19.9442 22.0547 20.0695C21.9566 20.0928 21.8588 20.1041 21.7604 20.105C21.5842 20.1059 21.4054 20.071 21.2339 19.9962C21.056 19.9183 20.8952 19.8009 20.7654 19.6497C20.6912 19.5623 20.6299 19.4667 20.5806 19.3648C20.5422 19.2882 19.5939 17.4481 17.4391 16.0175L17.44 16.0179ZM7.74737 8.74582C8.74313 9.2316 9.5548 10.0037 10.1608 10.7321C12.0348 7.86545 14.578 5.70023 16.5425 4.3042C17.2726 3.78579 18.0284 3.30111 18.7563 2.88291C13.6429 1.80923 8.28375 3.83577 5.1764 8.10245C5.99889 8.15876 6.90528 8.33501 7.74737 8.74582ZM24.6415 5.75507C24.7602 6.58628 24.8441 7.47954 24.8847 8.37503C24.9943 10.7762 24.8555 14.1022 23.7588 17.3369C24.6735 17.3614 25.7372 17.5232 26.7105 17.998C27.5795 18.4219 28.3081 19.0633 28.8814 19.7035C30.3453 14.6184 28.6441 9.13194 24.6411 5.75597L24.6415 5.75507ZM17.4489 13.0336C19.2472 13.9109 20.5471 15.078 21.4282 16.0842C22.8614 11.427 22.2366 6.21527 21.7149 4.28506C19.873 5.06221 15.3815 7.77795 12.5957 11.7753C13.9322 11.8499 15.6515 12.1568 17.4489 13.0336Z"
|
||||
:fill="!avatar && color ? '#4137FF' : 'currentColor'" style="fill-opacity:1;" />
|
||||
</g>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import { useId } from "vue";
|
||||
|
||||
withDefaults(defineProps<{
|
||||
size?: string | number;
|
||||
color?: boolean;
|
||||
avatar?: boolean;
|
||||
}>(), {
|
||||
size: 24,
|
||||
});
|
||||
|
||||
const titleId = useId();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="inline-flex items-center justify-center"
|
||||
:style="{ width: `${size}px`, height: `${size}px` }">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" :width="size" :height="size"
|
||||
viewBox="0 0 24 24" role="img" :aria-labelledby="titleId"
|
||||
style="flex: none; line-height: 1;">
|
||||
<title :id="titleId">Thinking Machines Lab</title>
|
||||
<rect width="24" height="24" rx="2.6666666666666665"
|
||||
:fill="color ? '#e6e7e8' : 'currentColor'" :fill-opacity="color ? 1 : 0.15"></rect>
|
||||
<rect x="4" y="4" width="16" height="16" rx="1.3333333333333333"
|
||||
:fill="color ? '#31373d' : 'currentColor'"></rect>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
@@ -54,6 +54,9 @@ import {
|
||||
LogoClosedRouter,
|
||||
LogoPoolside,
|
||||
LogoTencent,
|
||||
LogoThinkingMachines,
|
||||
LogoDotsStudio,
|
||||
LogoNexAgi,
|
||||
LogoHuggingFace,
|
||||
} from '#components';
|
||||
import { markRaw } from 'vue';
|
||||
@@ -65,6 +68,18 @@ interface ModelConfig {
|
||||
}
|
||||
|
||||
const MODEL_MAPPINGS: ModelConfig[] = [
|
||||
{
|
||||
Icon: markRaw(LogoNexAgi),
|
||||
keywords: [/nex-agi\//, /\/nex-/],
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoDotsStudio),
|
||||
keywords: [/dots-studio/, /^dots/, /\/dots/],
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoThinkingMachines),
|
||||
keywords: [/^thinkingmachines\//, /\/linkling/],
|
||||
},
|
||||
{ Icon: markRaw(LogoOpenAI), keywords: [/gpt-3/], props: { type: 'gpt3' } },
|
||||
{ Icon: markRaw(LogoOpenAI), keywords: [/gpt-4/], props: { type: 'gpt4' } },
|
||||
{ Icon: markRaw(LogoOpenAI), keywords: [/gpt-5/], props: { type: 'gpt5' } },
|
||||
@@ -99,7 +114,7 @@ const MODEL_MAPPINGS: ModelConfig[] = [
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoGrok),
|
||||
keywords: [/^grok-/, /^x-ai\//],
|
||||
keywords: [/^grok-/, /^x-ai\//, /^~x-ai\/grok-latest$/],
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoGemini),
|
||||
@@ -164,7 +179,7 @@ const MODEL_MAPPINGS: ModelConfig[] = [
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoZAI),
|
||||
keywords: [/zai-/, /(^|\/|-)?glm-?\d/]
|
||||
keywords: [/zai-/, /(^|\/|-)?glm-?\d/, /^~z-ai\/glm-(flash-)?latest$/]
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoGLMV),
|
||||
@@ -196,7 +211,7 @@ const MODEL_MAPPINGS: ModelConfig[] = [
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoMeta),
|
||||
keywords: [/llama/, /\/l3/, /meta-llama\//]
|
||||
keywords: [/llama/, /\/l3/, /meta-llama\//, /(^|\/)muse-spark($|-)/, /^meta\//]
|
||||
},
|
||||
{
|
||||
Icon: markRaw(LogoPerplexity),
|
||||
|
||||
@@ -431,13 +431,16 @@ type SearchTheWebConfig = SearchTheWebRerankedConfig | SearchTheWebUnrankedConfi
|
||||
|
||||
export const searchTheWeb = (config: SearchTheWebConfig) => {
|
||||
return async (query: string) => {
|
||||
const searchUrl = new URL(process.env.SEARCH_API_URL ?? process.env.SEARXNG_URL ?? "");
|
||||
searchUrl.pathname = `${searchUrl.pathname.replace(/\/+$/, "")}/search`;
|
||||
|
||||
const results = await $fetch<{
|
||||
results: Array<{
|
||||
title: string;
|
||||
url: string;
|
||||
content: string;
|
||||
}>;
|
||||
}>(`${process.env.SEARXNG_URL}/search`, {
|
||||
}>(searchUrl.toString(), {
|
||||
query: {
|
||||
q: query,
|
||||
format: 'json',
|
||||
|
||||
Reference in New Issue
Block a user