Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copilot Response Formatting Issue #62

Open
Sophyia7 opened this issue Jan 5, 2024 · 10 comments · May be fixed by #111
Open

Copilot Response Formatting Issue #62

Sophyia7 opened this issue Jan 5, 2024 · 10 comments · May be fixed by #111
Assignees
Labels
bug Something isn't working good first issue Good for newcomers in the OSP Community.

Comments

@Sophyia7
Copy link
Collaborator

Sophyia7 commented Jan 5, 2024

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

@Sophyia7 Sophyia7 added the bug Something isn't working label Jan 5, 2024
@shivay-at-pieces
Copy link
Contributor

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

@Sophyia7
Copy link
Collaborator Author

Sophyia7 commented Jan 5, 2024

Added! Thanks.

@RohanMishra315
Copy link
Contributor

Hey @Sophyia7 Let me take a look?

@jwafu jwafu added the good first issue Good for newcomers in the OSP Community. label Jan 10, 2024
@jwafu
Copy link
Contributor

jwafu commented Jan 11, 2024

@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
Copy link
Contributor

RohanMishra315 commented Jan 13, 2024

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

@jwafu
Copy link
Contributor

jwafu commented Jan 17, 2024

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

@RohanMishra315
Copy link
Contributor

// 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
Copy link

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
Copy link
Contributor

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

@VishalPawar1010
Copy link

VishalPawar1010 commented May 13, 2024

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

VishalPawar1010 added a commit to VishalPawar1010/example-typescript that referenced this issue May 27, 2024
VishalPawar1010 added a commit to VishalPawar1010/example-typescript that referenced this issue May 27, 2024
VishalPawar1010 added a commit to VishalPawar1010/example-typescript that referenced this issue Jun 2, 2024
VishalPawar1010 added a commit to VishalPawar1010/example-typescript that referenced this issue Jun 2, 2024
VishalPawar1010 added a commit to VishalPawar1010/example-typescript that referenced this issue Jun 3, 2024
VishalPawar1010 added a commit to VishalPawar1010/example-typescript that referenced this issue Jun 3, 2024
VishalPawar1010 added a commit to VishalPawar1010/example-typescript that referenced this issue Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers in the OSP Community.
Projects
None yet
5 participants