feat(agent): support gemma-embedding-2-openai provider (#475)

* feat(agent): support gemma-embedding-2-openai provider

Add support for local LiteRT-LM Gemma Embedding 2 provider with 768-dimensional vector embeddings, environment-configured read-only embedding agents, 16-frame uniform sampling for video chunks, and automatic WebP-to-JPEG conversion.

* refactor(agent): remove unused legacy generateEmbeddingActivity

* chore(agent): align sharp version to 0.35.4

* refactor(agent): rename embedding server env to GEMMA_EMBEDDING_OPENAI_BASE_URL

* refactor(agent,transcode): use native Bun.Archive for video chunk frames

* fix(transcode,agent): populate buffer entries in Bun.Archive and validate frame sizes
This commit is contained in:
Yiling-J
2026-10-15 15:49:24 +08:00
committed by GitHub
parent c302c162a0
commit b7271777e0
28 changed files with 1270 additions and 238 deletions
+20
View File
@@ -1,4 +1,5 @@
import { Hono } from 'hono'
import { HTTPException } from 'hono/http-exception'
import { zValidator } from '@hono/zod-validator'
import { agentService } from '@shumai/core/src/agent/agent'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
@@ -92,6 +93,13 @@ const route = new Hono<{ Variables: { user: User } }>()
id: agentId,
})
const existingAgent = await agentService.getAgent({ agentId })
if (existingAgent?.type === 'embedding' && process.env.ENABLE_EMBEDDING_AGENT === 'true') {
throw new HTTPException(403, {
message: 'Embedding agent is managed by environment configuration and cannot be modified',
})
}
const agent = await agentService.updateAgent({
agentId,
...req,
@@ -123,6 +131,13 @@ const route = new Hono<{ Variables: { user: User } }>()
id: agentId,
})
const existingAgent = await agentService.getAgent({ agentId })
if (existingAgent?.type === 'embedding' && process.env.ENABLE_EMBEDDING_AGENT === 'true') {
throw new HTTPException(403, {
message: 'Embedding agent is managed by environment configuration and cannot be modified',
})
}
const agent = await agentService.updateAgentPermission(agentId, req.permission)
await auditLogService.logAction({
@@ -149,6 +164,11 @@ const route = new Hono<{ Variables: { user: User } }>()
})
const existingAgent = await agentService.getAgent({ agentId })
if (existingAgent?.type === 'embedding' && process.env.ENABLE_EMBEDDING_AGENT === 'true') {
throw new HTTPException(403, {
message: 'Embedding agent is managed by environment configuration and cannot be deleted',
})
}
await agentService.deleteAgent({
agentId,