MCPcopy
hub / github.com/zai-org/GLM-4 / get_message

Method get_message

demo/composite_demo/src/conversation.py:73–89  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

71
72 # Get the message block for the given role
73 def get_message(self):
74 # Compare by value here, because the enum object in the session state
75 # is not the same as the enum cases here, due to streamlit's rerunning
76 # behavior.
77 match self.value:
78 case Role.SYSTEM.value:
79 return
80 case Role.USER.value:
81 return st.chat_message(name="user", avatar="user")
82 case Role.ASSISTANT.value:
83 return st.chat_message(name="assistant", avatar="assistant")
84 case Role.TOOL.value:
85 return st.chat_message(name="tool", avatar="assistant")
86 case Role.OBSERVATION.value:
87 return st.chat_message(name="observation", avatar="assistant")
88 case _:
89 st.error(f"Unexpected role: {self}")
90
91
92@dataclass

Callers 1

showMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected