Skip to content

Refactor post state type #144

@bracesproul

Description

@bracesproul

We should modify the post state field to match the complex post type, or improve it to include images.

Now that we have two fields, one for post and complexPost, it's time to refactor into one single post interface which can handle single posts, threads, threads with images, etc.

This new state field should be an array of objects, something like this:

(Image is already defined here, reuse and move [ComplexPost](https://github.com/langchain-ai/social-media-agent/blob/main/src/agents/shared/nodes/generate-post/types.ts#L6) to this shared types.ts file.

export type Image = { imageUrl: string; mimeType: string };

export interface ComplexPost2 {
  /**
   * The index the post should be in the series.
   */
  index: number;
  /**
   * The text content of the post.
   */
  text: string;
  /**
   * The image which will be attached to the post.
   */
  image?: Image;
}

The logic for LinkedIn should be as follows, as we do not want to post threads there:

  • join all post text fields into a single string
  • use only the image from the first post

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions