feat(embedding): 接入阿里云多模态向量端点

This commit is contained in:
Entropy.Xu
2026-05-28 16:05:36 +08:00
parent 535039c29e
commit 0f6d4b9146
56 changed files with 1605 additions and 42 deletions
@@ -34,6 +34,21 @@ describe('buildDefaultModelTestRequestBody', () => {
expect(body.stream).toBeUndefined()
})
it('uses multimodal input and qwen3-vl defaults for Aliyun embedding tests', () => {
const body = JSON.parse(buildDefaultModelTestRequestBody('qwen3-vl-embedding', 'aliyun:multimodal_embedding'))
expect(body).toEqual({
model: 'qwen3-vl-embedding',
input: [
{ text: 'White running shoes, lightweight and breathable.' },
{ image: 'https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png' },
],
parameters: {
enable_fusion: true,
},
})
})
it.each([
'openai:rerank',
'jina:rerank',
@@ -151,6 +151,19 @@ export function buildDefaultModelTestRequestBody(
): string {
const normalizedApiFormat = normalizeApiFormatAlias(apiFormat ?? '')
if (normalizedApiFormat === 'aliyun:multimodal_embedding') {
return JSON.stringify({
model: modelName,
input: [
{ text: 'White running shoes, lightweight and breathable.' },
{ image: 'https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png' },
],
parameters: {
enable_fusion: true,
},
}, null, 2)
}
if (normalizedApiFormat.endsWith(':embedding')) {
return JSON.stringify({
model: modelName,
@@ -273,4 +286,4 @@ export function parseModelTestRequestHeadersDraft(
emptyError: null,
invalidTypeError: '测试请求头必须是 JSON 对象',
})
}
}