chore: Wave 1 complete — fix merge conflicts, update task status (#296)
Some checks failed
ci/woodpecker/push/ci Pipeline failed
Some checks failed
ci/woodpecker/push/ci Pipeline failed
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #296.
This commit is contained in:
@@ -127,14 +127,17 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
|
||||
// Persist the user message
|
||||
if (userId) {
|
||||
try {
|
||||
await this.brain.conversations.addMessage({
|
||||
conversationId,
|
||||
role: 'user',
|
||||
content: data.content,
|
||||
metadata: {
|
||||
timestamp: new Date().toISOString(),
|
||||
await this.brain.conversations.addMessage(
|
||||
{
|
||||
conversationId,
|
||||
role: 'user',
|
||||
content: data.content,
|
||||
metadata: {
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
},
|
||||
});
|
||||
userId,
|
||||
);
|
||||
} catch (err) {
|
||||
this.logger.error(
|
||||
`Failed to persist user message for conversation=${conversationId}`,
|
||||
@@ -257,7 +260,7 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
|
||||
*/
|
||||
private async ensureConversation(conversationId: string, userId: string): Promise<void> {
|
||||
try {
|
||||
const existing = await this.brain.conversations.findById(conversationId);
|
||||
const existing = await this.brain.conversations.findById(conversationId, userId);
|
||||
if (!existing) {
|
||||
await this.brain.conversations.create({
|
||||
id: conversationId,
|
||||
@@ -341,12 +344,15 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
|
||||
}
|
||||
|
||||
this.brain.conversations
|
||||
.addMessage({
|
||||
conversationId,
|
||||
role: 'assistant',
|
||||
content: cs.assistantText,
|
||||
metadata,
|
||||
})
|
||||
.addMessage(
|
||||
{
|
||||
conversationId,
|
||||
role: 'assistant',
|
||||
content: cs.assistantText,
|
||||
metadata,
|
||||
},
|
||||
userId,
|
||||
)
|
||||
.catch((err: unknown) => {
|
||||
this.logger.error(
|
||||
`Failed to persist assistant message for conversation=${conversationId}`,
|
||||
|
||||
Reference in New Issue
Block a user