Skip to content

Maintain data over multiple sessions. #976

Closed
@mrmps

Description

@mrmps

Feature Description

Currently, handling additional data for the chat is extremely difficult, especially when this data needs to be persisted over multiple sessions. Maybe I'm missing something here, but my current issue is that I need to do some gymnastics to persist the data.

Some of the main issues are:
a) Data is not accessible from the backend. There is no getData function in experimental_Streamdata, only an append function. This makes it very difficult to save data to a kv db along with the rest of our conversation.
b) There is no initial_Data prop, only initial_messages. This makes it difficult to set the initial data when recovering a chat from history.
c) Currently, I have to do some pretty shady stuff to attach data to a message, such as pass sendExtraMessageFields and then filter out the ids when making a request to OpenAI.
d) Of course, I know that there is work being done to add individual data to each message. But as a user, it's frustrating that I'll likely have to refactor my code once this is implemented. I suspect many other devs are avoiding this lib for this reason, which is a shame because otherwise, it is extremely useful.

If anyone has a better solution for persisted data/attach data to individual messages, please let me know!

for a) I propose the following as a temporary measure:

export class experimental_StreamData {
    // ... existing code ...

    // Public method to get current state of data
    public getCurrentDataState(): JSONValue[] {
        return [...this.data];
    }

    // ... existing code ...
}

Use Case

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions