artifactVersioningExample 工件版本管理示例
(ctx context.Context, service *postgres.Service, sessionID string)
| 194 | |
| 195 | // artifactVersioningExample 工件版本管理示例 |
| 196 | func artifactVersioningExample(ctx context.Context, service *postgres.Service, sessionID string) { |
| 197 | // 模拟生成报告的多个版本 |
| 198 | for version := 1; version <= 3; version++ { |
| 199 | event := &session.Event{ |
| 200 | ID: "evt-" + generateID(), |
| 201 | Timestamp: time.Now(), |
| 202 | InvocationID: fmt.Sprintf("inv-artifact-%d", version), |
| 203 | AgentID: "agent-customer-support", |
| 204 | Branch: "root", |
| 205 | Author: "assistant", |
| 206 | Content: types.Message{ |
| 207 | Role: types.RoleAssistant, |
| 208 | Content: fmt.Sprintf("生成报告版本 %d", version), |
| 209 | }, |
| 210 | Actions: session.EventActions{ |
| 211 | ArtifactDelta: map[string]int64{ |
| 212 | "customer_report.pdf": int64(version), |
| 213 | }, |
| 214 | }, |
| 215 | } |
| 216 | |
| 217 | if err := service.AppendEvent(ctx, sessionID, event); err != nil { |
| 218 | log.Fatalf("Failed to append artifact event: %v", err) |
| 219 | } |
| 220 | |
| 221 | time.Sleep(100 * time.Millisecond) |
| 222 | } |
| 223 | |
| 224 | fmt.Println("✅ Created 3 artifact versions") |
| 225 | } |
| 226 | |
| 227 | // queryExample 查询和过滤示例 |
| 228 | func queryExample(ctx context.Context, service *postgres.Service, userID string) { |
no test coverage detected