diff --git a/api/core/model_runtime/model_providers/tongyi/llm/llm.py b/api/core/model_runtime/model_providers/tongyi/llm/llm.py index 4e1bb0a5a4fa2b..adc5fee37b78b6 100644 --- a/api/core/model_runtime/model_providers/tongyi/llm/llm.py +++ b/api/core/model_runtime/model_providers/tongyi/llm/llm.py @@ -1,5 +1,6 @@ import base64 import os +import re import tempfile import uuid from collections.abc import Generator @@ -483,9 +484,15 @@ def _convert_prompt_messages_to_tongyi_messages(self, prompt_messages: list[Prom # convert image base64 data to file in /tmp image_url = self._save_base64_image_to_file(message_content.data) - sub_message_dict = { - "image": image_url - } + is_video_url = re.search(r'\.(mp4|webm|ogg|mov|avi|mkv|flv|wmv)$', image_url, re.IGNORECASE) + if is_video_url: + sub_message_dict = { + "video": image_url + } + else: + sub_message_dict = { + "image": image_url + } sub_messages.append(sub_message_dict) # resort sub_messages to ensure text is always at last diff --git a/api/core/model_runtime/model_providers/tongyi/llm/qwen-vl-max-0809.yaml b/api/core/model_runtime/model_providers/tongyi/llm/qwen-vl-max-0809.yaml new file mode 100644 index 00000000000000..af8742b9810599 --- /dev/null +++ b/api/core/model_runtime/model_providers/tongyi/llm/qwen-vl-max-0809.yaml @@ -0,0 +1,47 @@ +model: qwen-vl-max-0809 +label: + en_US: qwen-vl-max-0809 +model_type: llm +features: + - vision + - agent-thought +model_properties: + mode: chat + context_size: 32768 +parameter_rules: + - name: top_p + use_template: top_p + type: float + default: 0.8 + min: 0.1 + max: 0.9 + help: + zh_Hans: 生成过程中核采样方法概率阈值,例如,取值为0.8时,仅保留概率加起来大于等于0.8的最可能token的最小集合作为候选集。取值范围为(0,1.0),取值越大,生成的随机性越高;取值越低,生成的确定性越高。 + en_US: The probability threshold of the kernel sampling method during the generation process. For example, when the value is 0.8, only the smallest set of the most likely tokens with a sum of probabilities greater than or equal to 0.8 is retained as the candidate set. The value range is (0,1.0). The larger the value, the higher the randomness generated; the lower the value, the higher the certainty generated. + - name: top_k + type: int + min: 0 + max: 99 + label: + zh_Hans: 取样数量 + en_US: Top k + help: + zh_Hans: 生成时,采样候选集的大小。例如,取值为50时,仅将单次生成中得分最高的50个token组成随机采样的候选集。取值越大,生成的随机性越高;取值越小,生成的确定性越高。 + en_US: The size of the sample candidate set when generated. For example, when the value is 50, only the 50 highest-scoring tokens in a single generation form a randomly sampled candidate set. The larger the value, the higher the randomness generated; the smaller the value, the higher the certainty generated. + - name: seed + required: false + type: int + default: 1234 + label: + zh_Hans: 随机种子 + en_US: Random seed + help: + zh_Hans: 生成时使用的随机数种子,用户控制模型生成内容的随机性。支持无符号64位整数,默认值为 1234。在使用seed时,模型将尽可能生成相同或相似的结果,但目前不保证每次生成的结果完全相同。 + en_US: The random number seed used when generating, the user controls the randomness of the content generated by the model. Supports unsigned 64-bit integers, default value is 1234. When using seed, the model will try its best to generate the same or similar results, but there is currently no guarantee that the results will be exactly the same every time. + - name: response_format + use_template: response_format +pricing: + input: '0.02' + output: '0.02' + unit: '0.001' + currency: RMB diff --git a/web/app/components/base/image-gallery/index.tsx b/web/app/components/base/image-gallery/index.tsx index dc52251df934f5..7fd880a0809bc4 100644 --- a/web/app/components/base/image-gallery/index.tsx +++ b/web/app/components/base/image-gallery/index.tsx @@ -4,6 +4,7 @@ import React, { useState } from 'react' import s from './style.module.css' import cn from '@/utils/classnames' import ImagePreview from '@/app/components/base/image-uploader/image-preview' +import { isVideoLink } from '@/app/components/base/image-uploader/utils' type Props = { srcs: string[] @@ -38,16 +39,18 @@ const ImageGallery: FC = ({
{/* TODO: support preview */} {srcs.map((src, index) => ( - // eslint-disable-next-line @next/next/no-img-element - setImagePreviewUrl(src)} - onError={e => e.currentTarget.remove()} - /> + + isVideoLink(src) + ?