This commit is contained in:
seb
2026-10-12 18:09:54 +02:00
parent 88ff9e08a9
commit 10b1d53f9d
5 changed files with 17 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ export default function get(provider) {
* @param {number} googleAuthId - The id of the Google auth user.
* @param {number} conversationId - The conversation id.
* @param {object} [tx] - Optional transaction to run within.
* @returns {Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string, started_by: number|null}>}
* @returns {Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string, started_by: number|null, first_user_message: string|null}>} `first_user_message` is the stored `message` payload of the first `user` message (null if none yet).
* @throws {Error} 'Conversation not found'.
*/
return async (googleAuthId, conversationId, tx) => {
@@ -28,6 +28,6 @@ export default function get(provider) {
const result = await runner.query(sql, { id, companyuserId });
if (!result.rows[0]) throw new Error('Conversation not found');
return shape(result.rows[0]);
return { ...shape(result.rows[0]), first_user_message: result.rows[0].first_user_message ?? null };
};
}