feat(wizard): add scenario templates and EBA release gate

This commit is contained in:
huanghuoguoguo
2026-07-11 12:37:07 +08:00
parent 24322836ce
commit 11bd5c6fd7
9 changed files with 603 additions and 23 deletions
+23 -15
View File
@@ -14,7 +14,6 @@ import {
Loader2,
MessageSquare,
ShieldCheck,
UserCheck,
UserMinus,
UserPlus,
X,
@@ -34,7 +33,10 @@ import {
Pipeline,
WizardProgress,
} from '@/app/infra/entities/api';
import { IDynamicFormItemSchema } from '@/app/infra/entities/form/dynamic';
import {
DynamicFormItemType,
IDynamicFormItemSchema,
} from '@/app/infra/entities/form/dynamic';
import {
PipelineConfigTab,
PipelineConfigStage,
@@ -84,9 +86,14 @@ type WizardScenarioId =
| 'message_reply'
| 'welcome_members'
| 'handle_departures'
| 'review_friend_requests'
| 'handle_moderation';
const WIZARD_SCENARIO_PROMPT_KEYS: Partial<Record<WizardScenarioId, string>> = {
welcome_members: 'wizard.scenario.welcomeMembersPrompt',
handle_departures: 'wizard.scenario.handleDeparturesPrompt',
handle_moderation: 'wizard.scenario.handleModerationPrompt',
};
const WIZARD_SCENARIOS = [
{
id: 'message_reply' as const,
@@ -115,15 +122,6 @@ const WIZARD_SCENARIOS = [
icon: UserMinus,
emoji: '👤',
},
{
id: 'review_friend_requests' as const,
eventType: 'friend.request_received',
processorKind: 'agent' as const,
labelKey: 'wizard.scenario.reviewFriendRequests',
descriptionKey: 'wizard.scenario.reviewFriendRequestsDescription',
icon: UserCheck,
emoji: '✅',
},
{
id: 'handle_moderation' as const,
eventType: 'group.member_banned',
@@ -363,10 +361,20 @@ export default function WizardPage() {
(runner: string) => {
setSelectedRunner(runner);
const configStage = aiConfigTab?.stages.find((s) => s.name === runner);
setRunnerConfig(configStage ? getDefaultValues(configStage.config) : {});
const defaults = configStage ? getDefaultValues(configStage.config) : {};
const promptKey = selectedScenario
? WIZARD_SCENARIO_PROMPT_KEYS[selectedScenario]
: undefined;
const supportsPromptEditor = configStage?.config.some(
(item) => item.type === DynamicFormItemType.PROMPT_EDITOR,
);
if (promptKey && supportsPromptEditor) {
defaults.prompt = [{ role: 'system', content: t(promptKey) }];
}
setRunnerConfig(defaults);
saveProgress({ step: 2, selected_runner: runner });
},
[aiConfigTab, saveProgress],
[aiConfigTab, saveProgress, selectedScenario, t],
);
// ---- Navigation helpers ----
@@ -981,7 +989,7 @@ function StepPlatform({
{t('wizard.scenario.description')}
</p>
</div>
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
<div className="grid gap-3 sm:grid-cols-2">
{WIZARD_SCENARIOS.map((scenario) => {
const Icon = scenario.icon;
const isSelected = selectedScenario === scenario.id;
+6 -3
View File
@@ -1936,15 +1936,18 @@ const enUS = {
'Answer incoming private or group messages with an AI Pipeline.',
welcomeMembers: 'Welcome new members',
welcomeMembersDescription: 'Run an Agent when someone joins a group.',
welcomeMembersPrompt:
'Welcome new group members with a short, friendly message. Use the available member and group context when present. Do not mention internal event names or system details.',
handleDepartures: 'Handle member departures',
handleDeparturesDescription:
'Run an Agent when someone leaves or is removed.',
reviewFriendRequests: 'Review friend requests',
reviewFriendRequestsDescription:
'Let an Agent decide how to handle new friend requests.',
handleDeparturesPrompt:
'Respond to group member departures with a brief, respectful message when a public response is appropriate. Do not speculate about why the member left or mention internal event names.',
handleModeration: 'Handle moderation events',
handleModerationDescription:
'Run an Agent when a group member is restricted.',
handleModerationPrompt:
'Write a concise, neutral group notice about the member restriction using only the available context. Do not invent details or mention internal event names.',
pipelineBadge: 'Pipeline',
agentBadge: 'Agent',
},
+6 -3
View File
@@ -1858,15 +1858,18 @@ const jaJP = {
welcomeMembers: '新しいメンバーを歓迎',
welcomeMembersDescription:
'メンバーがグループに参加したときに Agent を実行します。',
welcomeMembersPrompt:
'新しいグループメンバーを短く親しみやすいメッセージで歓迎してください。利用可能なメンバーとグループの情報を活用し、内部イベント名やシステムの詳細には言及しないでください。',
handleDepartures: 'メンバーの退出を処理',
handleDeparturesDescription:
'メンバーが退出または削除されたときに Agent を実行します。',
reviewFriendRequests: '友だち申請を確認',
reviewFriendRequestsDescription:
'新しい申請の処理方法を Agent に判断させます。',
handleDeparturesPrompt:
'公開の応答が適切な場合に、メンバーの退出へ短く敬意のあるメッセージで対応してください。退出理由を推測したり、内部イベント名に言及したりしないでください。',
handleModeration: 'モデレーションイベントを処理',
handleModerationDescription:
'グループメンバーが制限されたときに Agent を実行します。',
handleModerationPrompt:
'利用可能な情報だけを使い、メンバーへの制限について簡潔で中立的なグループ通知を書いてください。詳細を作り上げたり、内部イベント名に言及したりしないでください。',
pipelineBadge: 'Pipeline',
agentBadge: 'Agent',
},
+6 -2
View File
@@ -1855,12 +1855,16 @@ const zhHans = {
messageReplyDescription: '使用 AI Pipeline 回复私聊或群聊消息。',
welcomeMembers: '欢迎新成员',
welcomeMembersDescription: '有人加入群组时运行 Agent。',
welcomeMembersPrompt:
'用简短、友好的消息欢迎新群成员。有成员和群组上下文时请合理使用,不要提及内部事件名称或系统细节。',
handleDepartures: '处理成员离群',
handleDeparturesDescription: '有人离开或被移出群组时运行 Agent。',
reviewFriendRequests: '审核好友请求',
reviewFriendRequestsDescription: '让 Agent 决定如何处理新的好友请求。',
handleDeparturesPrompt:
'当适合公开回应时,用简短、尊重的消息处理群成员离开。不要猜测成员离开的原因,也不要提及内部事件名称。',
handleModeration: '处理群管理事件',
handleModerationDescription: '群成员受到限制时运行 Agent。',
handleModerationPrompt:
'仅根据现有上下文,写一条简洁、中立的群管理通知,说明成员受到的限制。不要编造细节或提及内部事件名称。',
pipelineBadge: 'Pipeline',
agentBadge: 'Agent',
},