Skip to content

chatMapper

@waldiez/react v0.4.8


const chatMapper: object

Defined in: src/waldiez/models/mappers/chat/chatMapper.ts:54

Imports and exports for chatMapper This module provides functions to import and export chat data, as well as convert chat data to and from edge format. It includes methods to import a chat from JSON, export a chat to JSON, and convert a WaldiezChat instance to a WaldiezEdge instance.

Type declarationΒΆ

asEdge()ΒΆ

asEdge: (chat) => WaldiezEdge

Converts a WaldiezChat instance to a WaldiezEdge instance.

ParametersΒΆ
chatΒΆ

WaldiezChat

ReturnsΒΆ

WaldiezEdge

A WaldiezEdge instance representing the chat.

exportChat()ΒΆ

exportChat: (edge, index) => any

Exports a chat to JSON.

ParametersΒΆ
edgeΒΆ

WaldiezEdge

indexΒΆ

number

ReturnsΒΆ

any

An object containing the exported chat data.

importChat()ΒΆ

importChat: (json, edges, nodes, index) => object

Imports a chat from JSON. If the JSON is invalid or missing, it creates a new chat with default values.

ParametersΒΆ
jsonΒΆ

unknown

edgesΒΆ

Edge[]

nodesΒΆ

Node[]

indexΒΆ

number

ReturnsΒΆ

object

An object containing the imported chat and its edge.

chatΒΆ

chat: WaldiezChat

edgeΒΆ

edge: Edge

SeeΒΆ