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

Problem with linebreak #344

Closed
NathanNeves opened this issue Dec 27, 2024 · 1 comment
Closed

Problem with linebreak #344

NathanNeves opened this issue Dec 27, 2024 · 1 comment

Comments

@NathanNeves
Copy link

NathanNeves commented Dec 27, 2024

I Have been trying to fix that in my code but for some reason the prochat component is not rendering the line breaks

image

Here is my backend code as well:

messages.pop()
let systemTemplate = ChatPromptTemplate.fromMessages([
    ['system', "Você é um assistente chamado cortex sua principal função é responder os usuários com base apenas nas informações abaixo: \n {information} "],
    ...messages,
    ['user', "{text}"],
]);

let systemMessage = await systemTemplate.invoke({
    information: data[0].raw_value,
    text: lastMessage.content
});

const completion = await chat.invoke(systemMessage);

return NextResponse.json(completion.content);

Here is my proChat component in the frontend:

{showComponent && (
        <ProChat
          displayMode={"docs"}
          style={{
            height: "85vh",
            color: theme.colorText,
          }}
          
          locale="en-US"  
          actions={{
            render(defaultDoms) {
              return [
                ...defaultDoms,
                <Button key="custom" >
                  Generate Notes
                </Button>,
              ];
            },
       
          }}
          helloMessage={"Hello! How can I help you today?"}
          placeholder="Digite aqui..."
          request={'/api/processChat'}
          config={{params:{
            conversationId:record?.id,

          }}}
        />
@NathanNeves
Copy link
Author

Already discovered how to solve it just for anyone with the same doubt and does not speak chinese you can solve that using the line below:

request={async (messages) => {
            let response = await axios.post('/api/processChat',{messages,conversationId:record?.id},{withCredentials:true});
            return new Response(response.data);
          }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant