♻️ (chatView, flowStore): refactor message handling for consistency
This commit is contained in:
parent
5a64bb2678
commit
84a87a3c39
3 changed files with 4 additions and 6 deletions
|
|
@ -62,14 +62,11 @@ export default function ChatView({
|
|||
const chatMessages: ChatMessageType[] = chatOutputResponses
|
||||
.sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp))
|
||||
//
|
||||
.filter(
|
||||
(output) =>
|
||||
output?.data?.messages && output?.data?.messages?.length > 0,
|
||||
)
|
||||
.filter((output) => output.data.message)
|
||||
.map((output, index) => {
|
||||
try {
|
||||
const { sender, message, sender_name, stream_url, files } = output
|
||||
?.data?.messages[0] as ChatOutputType;
|
||||
.data.message as ChatOutputType;
|
||||
|
||||
const is_ai = sender === "Machine" || sender === null;
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
}
|
||||
//update data results
|
||||
else {
|
||||
newFlowPool[nodeId][index].data.messages[0] = data as
|
||||
newFlowPool[nodeId][index].data.message = data as
|
||||
| ChatOutputType
|
||||
| ChatInputType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ export type VertexDataTypeAPI = {
|
|||
timedelta?: number;
|
||||
duration?: string;
|
||||
artifacts?: any;
|
||||
message: ChatOutputType | ChatInputType;
|
||||
};
|
||||
|
||||
export type CodeErrorDataTypeAPI = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue