pieces-app / example-typescript

A React example project showing how to get started with Pieces TS SDK.
MIT License
31 stars 39 forks source link

Copilot Response Formatting Issue #62

Open Sophyia7 opened 6 months ago

Sophyia7 commented 6 months ago

Problem statement

Copilot's responses are not properly displayed, and there is a lack of formatting in the responses. When you ask a question, the response is displayed as one paragraph, which makes it difficult to read.

Expected Behavior: Copilot responses should be displayed with proper formatting, making them easily readable and understandable.

Here is a visual of the problem statement image

shivay-at-pieces commented 6 months ago

Do you mind adding a screenshot here as well @Sophyia7 for context

Sophyia7 commented 6 months ago

Added! Thanks.

RohanMishra315 commented 6 months ago

Hey @Sophyia7 Let me take a look?

jwafu commented 5 months ago

@RohanMishra315 if you are currently not in process of working on an issue, would love to have you explore this issue a bit more. let me know what your availability is

RohanMishra315 commented 5 months ago

Hey @jordan-pieces It's fine , I'll work on it ? I don't think it is major issue .

jwafu commented 5 months ago

should be good to take a look and let us know how it goes! 👍

RohanMishra315 commented 4 months ago

// You can use this here to set and send a conversation message. function sendConversationMessage(prompt: string, conversationID: string = GlobalConversationID) { // 1. Seed a message // 2. Get the conversation ID from somewhere - likely the createNewConversation above ^^ // 3. Send the new message over // 4. Use the message contents in the (not yet created) message stream/list

askQuestion({query: prompt, relevant: ''}).then((r) => { return r.result; }).then((value) => { // Format the response for better readability const formattedResponse = formatResponse(value); // Display the formatted response console.log(formattedResponse); }); }

// Function to format Copilot's response for better readability function formatResponse(response: string): string { // Split the response into sentences const sentences = response.split('. '); // Join the sentences with a newline character for better formatting const formattedResponse = sentences.join('.\n'); return formattedResponse; } @jordan-pieces can you review the code for better formatting of the Copilot response

VishalPawar1010 commented 1 month ago

Hello @jwafu @Sophyia7 @shivay-at-pieces , I have resolved the response fomatting issue using marked library,

Here is proof recording of formatted response : https://github.com/pieces-app/example-typescript/assets/118156462/ff60057e-4ff1-4118-8386-ea734eca7089 OR link : https://www.awesomescreenshot.com/video/27551169?key=d8748427e4823d2e17ad03261d5a6499

If above formatting resolution is acceptable , please allow me to raise the PR. Please let me know for any changes or suggestions.

Thanks

shivay-at-pieces commented 1 month ago

Hey @VishalPawar1010 feel free to make a PR, thanks for the contribution!

VishalPawar1010 commented 1 month ago

Hey @VishalPawar1010 feel free to make a PR, thanks for the contribution!

Hey @shivay-at-pieces , I have raised a PR with required changes, could you please review it.

Thanks