mdwiltfong / doc-inspector

1 stars 0 forks source link

Request and response values for Template & PDF to be generated #9

Open Jamesllllllllll opened 9 months ago

Jamesllllllllll commented 9 months ago

Hey Michael,

IIRC last night we were saying that we could get a JSON object back with each line of the generated document. It would be useful to get a string that is manipulated / updated by OpenAI.

This single value can do two things at once:

  1. Interpreted by react-markdown to display the template and changes on the front-end.
  2. Interpreted by react-pdf which generates the PDF. (I wrote a function that turns the string into the document model required by this package)

Then we get JSON Assistant responses that with two key/value pairs like this:

{
  "message": "Sure! I'll update the #Statement of Facts section for you now.",
  "document": "# Legal Brief Template ##Title Page **IN THE [Court Name]** [...]" // the rest of the file contents with updates
}

The FE takes message and adds it to chat history, and updates the FE state with document to render the updated PDF.

Does this negate the need to add the markdown file to the assistant?

Here's the example I'm working with:

const response = `
# Legal Brief Template

## Title Page

**IN THE [Court Name]**

**Case No.:** [Insert Case Number]

**[Plaintiff's Name], Plaintiff,**

**v.**

**[Defendant's Name], Defendant.**

**BRIEF OF [Plaintiff/Defendant]**

**[Your Law Firm Name]**

**[Your Address]**

**[City, State, Zip Code]**

**[Phone Number]**

**[Email Address]**

**Attorneys for [Plaintiff/Defendant]**

---

## Table of Contents

1. [Introduction](#introduction)
4. [Statement of Facts](#statement-of-facts)
5. [Argument](#argument)
   1. [Issue 1](#issue-1)
   2. [Issue 2](#issue-2)
6. [Conclusion](#conclusion)

---

## Introduction

[Provide a brief introduction to the case and the key issues that will be addressed in the brief.]

---

## Statement of Facts

[Present a concise statement of facts relevant to the case. Ensure to present them in a logical, chronological order.]

---
`

// etc