From 57090d9964be85a7fd41d4ea16679cbf200eeb4b Mon Sep 17 00:00:00 2001 From: James Date: Wed, 25 Dec 2024 23:50:51 +0700 Subject: [PATCH] update --- engine/services/assistant_service.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/services/assistant_service.cc b/engine/services/assistant_service.cc index 2938787c6..cb5a7ad69 100644 --- a/engine/services/assistant_service.cc +++ b/engine/services/assistant_service.cc @@ -1,5 +1,6 @@ #include "assistant_service.h" #include "utils/logging_utils.h" +#include "utils/ulid_generator.h" cpp::result AssistantService::CreateAssistant(const std::string& thread_id, @@ -39,6 +40,7 @@ cpp::result AssistantService::CreateAssistantV2( const dto::CreateAssistantDto& create_dto) { OpenAi::Assistant assistant; + assistant.id = "asst_" + ulid::GenerateUlid(); assistant.model = create_dto.model; if (create_dto.name) { assistant.name = *create_dto.name; @@ -61,6 +63,11 @@ cpp::result AssistantService::CreateAssistantV2( if (create_dto.response_format) { assistant.response_format = *create_dto.response_format; } + auto seconds_since_epoch = + std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count(); + assistant.created_at = seconds_since_epoch; return assistant_repository_->CreateAssistant(assistant); }