Skip to content

Commit bd45b62

Browse files
authored
Merge pull request #87 from Recoupable-com/test
Test
2 parents efc3e6e + dbfcbc6 commit bd45b62

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

lib/emails/inbound/generateEmailResponse.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { marked } from "marked";
12
import { ChatRequestBody } from "@/lib/chat/validateChatRequest";
23
import getGeneralAgent from "@/lib/agents/generalAgent/getGeneralAgent";
34
import { getEmailRoomMessages } from "@/lib/emails/inbound/getEmailRoomMessages";
@@ -27,6 +28,8 @@ export async function generateEmailResponse(
2728
const chatResponse = await agent.generate({ messages });
2829
const text = chatResponse.text;
2930

31+
const bodyHtml = marked(text);
32+
3033
const footerHtml = `
3134
<hr style="margin-top:24px;margin-bottom:16px;border:none;border-top:1px solid #e5e7eb;" />
3235
<p style="font-size:12px;color:#6b7280;margin:0 0 4px;">
@@ -40,7 +43,7 @@ export async function generateEmailResponse(
4043
</p>
4144
`.trim();
4245

43-
const html = `${text}\n\n${footerHtml}`;
46+
const html = `${bodyHtml}\n\n${footerHtml}`;
4447

4548
return { text, html };
4649
}

lib/emails/inbound/respondToInboundEmail.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export async function respondToInboundEmail(
2626
const to = original.from;
2727
const toArray = [to];
2828
const from = getFromWithName(original.to, original.cc);
29+
const cc = original.cc?.length ? original.cc : undefined;
2930

3031
// Validate new memory and get chat request body (or early return if duplicate)
3132
const validationResult = await validateNewEmailMemory(event);
@@ -48,6 +49,7 @@ export async function respondToInboundEmail(
4849
const payload = {
4950
from,
5051
to: toArray,
52+
...(cc && { cc }),
5153
subject,
5254
html,
5355
headers: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"bullmq": "^5.65.1",
3131
"googleapis": "^168.0.0",
3232
"ioredis": "^5.8.2",
33+
"marked": "^15.0.12",
3334
"mcp-handler": "^1.0.4",
3435
"multiformats": "^13.4.1",
3536
"next": "^16.0.7",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)