11use std:: fmt:: Display ;
2- use std:: hash:: { Hash , Hasher } ;
32
43use warp_multi_agent_api as api;
54
65/// A citation listed in an AI response.
7- #[ derive( Debug , Clone ) ]
6+ #[ derive( Debug , Clone , Hash , Eq , PartialEq ) ]
87pub enum AIAgentCitation {
98 WarpDriveObject {
109 uid : String ,
@@ -16,67 +15,14 @@ pub enum AIAgentCitation {
1615 url : String ,
1716 } ,
1817 /// A memory from an attached memory store. `content` is the raw memory
19- /// text shown as a preview in the chip; `Hash`/`Eq` use only the IDs .
18+ /// text shown as a preview in the chip.
2019 AgentMemory {
2120 memory_store_id : String ,
2221 memory_id : String ,
2322 content : String ,
2423 } ,
2524}
2625
27- impl PartialEq for AIAgentCitation {
28- fn eq ( & self , other : & Self ) -> bool {
29- match ( self , other) {
30- ( Self :: WarpDriveObject { uid : a } , Self :: WarpDriveObject { uid : b } ) => a == b,
31- ( Self :: WarpDocumentation { path : a } , Self :: WarpDocumentation { path : b } ) => a == b,
32- ( Self :: WebPage { url : a } , Self :: WebPage { url : b } ) => a == b,
33- (
34- Self :: AgentMemory {
35- memory_store_id : s1,
36- memory_id : i1,
37- ..
38- } ,
39- Self :: AgentMemory {
40- memory_store_id : s2,
41- memory_id : i2,
42- ..
43- } ,
44- ) => s1 == s2 && i1 == i2,
45- _ => false ,
46- }
47- }
48- }
49-
50- impl Eq for AIAgentCitation { }
51-
52- impl Hash for AIAgentCitation {
53- fn hash < H : Hasher > ( & self , state : & mut H ) {
54- match self {
55- Self :: WarpDriveObject { uid } => {
56- 0u8 . hash ( state) ;
57- uid. hash ( state) ;
58- }
59- Self :: WarpDocumentation { path } => {
60- 1u8 . hash ( state) ;
61- path. hash ( state) ;
62- }
63- Self :: WebPage { url } => {
64- 2u8 . hash ( state) ;
65- url. hash ( state) ;
66- }
67- Self :: AgentMemory {
68- memory_store_id,
69- memory_id,
70- ..
71- } => {
72- 3u8 . hash ( state) ;
73- memory_store_id. hash ( state) ;
74- memory_id. hash ( state) ;
75- }
76- }
77- }
78- }
79-
8026impl Display for AIAgentCitation {
8127 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
8228 match self {
0 commit comments