mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 05:14:25 +00:00
feat(embedding): add compose tiers, docs, and regenerate-embeddings CLI (#480)
* feat(embedding): update compose tiers, docs, and add regenerate-embeddings CLI - Add Lite, Embedding, and Full Docker Compose configurations (and Aliyun mirrors) - Set CONCURRENCY_AGENT to 1 for compose files containing embedding-server - Update README and README_CN with compose options, recommended RAM, and semantic search links - Add LiteRT-LM Embedding Server setup guide in docs/using-shumai/embedding-server.mdx - Add shumai regenerate-embeddings CLI command and EmbeddingService to regenerate embeddings across teams - Add comprehensive test coverage for EmbeddingService * fix(docker): remove basic auth for turntable-renderer in full compose * fix(agent): lock and disable embedding agent when ENABLE_EMBEDDING_AGENT is false Ensure that when ENABLE_EMBEDDING_AGENT is set to 'false', existing embedding agents are automatically disabled on startup, marked as read-only, and blocked from manual API modifications or creations. Additionally guard background task creation and semantic search when the environment variable disables embedding agents. * test(upload): remove flaky status assertion on workflow tasks
This commit is contained in:
@@ -462,7 +462,10 @@ export class AgentService {
|
||||
*/
|
||||
async toAgentInfo(agent: AgentInfoSource): Promise<AgentInfo> {
|
||||
const config = agent.config as unknown as PrismaJson.AgentConfig
|
||||
const isReadOnly = agent.type === 'embedding' && process.env.ENABLE_EMBEDDING_AGENT === 'true'
|
||||
const isManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
const isReadOnly = agent.type === 'embedding' && isManagedByEnv
|
||||
|
||||
return {
|
||||
id: agent.id,
|
||||
@@ -723,7 +726,8 @@ export class AgentService {
|
||||
}
|
||||
|
||||
async ensureSystemEmbeddingAgents(): Promise<void> {
|
||||
if (process.env.ENABLE_EMBEDDING_AGENT !== 'true') {
|
||||
const envVal = process.env.ENABLE_EMBEDDING_AGENT
|
||||
if (envVal !== 'true' && envVal !== 'false') {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -737,7 +741,8 @@ export class AgentService {
|
||||
}
|
||||
|
||||
async ensureEmbeddingAgentForTeam(teamId: string): Promise<void> {
|
||||
if (process.env.ENABLE_EMBEDDING_AGENT !== 'true') {
|
||||
const envVal = process.env.ENABLE_EMBEDDING_AGENT
|
||||
if (envVal !== 'true' && envVal !== 'false') {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -748,20 +753,29 @@ export class AgentService {
|
||||
},
|
||||
})
|
||||
|
||||
if (!existing) {
|
||||
await this.createAgent({
|
||||
teamId,
|
||||
name: 'embedding-agent',
|
||||
type: 'embedding',
|
||||
avatar: 'avatar-1',
|
||||
thinkingLevel: 'off',
|
||||
enabled: true,
|
||||
})
|
||||
} else if (!existing.enabled) {
|
||||
await this.prismaClient.agent.update({
|
||||
where: { id: existing.id },
|
||||
data: { enabled: true },
|
||||
})
|
||||
if (envVal === 'true') {
|
||||
if (!existing) {
|
||||
await this.createAgent({
|
||||
teamId,
|
||||
name: 'embedding-agent',
|
||||
type: 'embedding',
|
||||
avatar: 'avatar-1',
|
||||
thinkingLevel: 'off',
|
||||
enabled: true,
|
||||
})
|
||||
} else if (!existing.enabled) {
|
||||
await this.prismaClient.agent.update({
|
||||
where: { id: existing.id },
|
||||
data: { enabled: true },
|
||||
})
|
||||
}
|
||||
} else if (envVal === 'false') {
|
||||
if (existing && existing.enabled) {
|
||||
await this.prismaClient.agent.update({
|
||||
where: { id: existing.id },
|
||||
data: { enabled: false },
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user