Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
namchuai committed Dec 25, 2024
1 parent 0e15b3e commit 57090d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions engine/services/assistant_service.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "assistant_service.h"
#include "utils/logging_utils.h"
#include "utils/ulid_generator.h"

cpp::result<OpenAi::JanAssistant, std::string>
AssistantService::CreateAssistant(const std::string& thread_id,
Expand Down Expand Up @@ -39,6 +40,7 @@ cpp::result<OpenAi::Assistant, std::string> 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;
Expand All @@ -61,6 +63,11 @@ cpp::result<OpenAi::Assistant, std::string> AssistantService::CreateAssistantV2(
if (create_dto.response_format) {
assistant.response_format = *create_dto.response_format;
}
auto seconds_since_epoch =
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
assistant.created_at = seconds_since_epoch;
return assistant_repository_->CreateAssistant(assistant);
}

Expand Down

0 comments on commit 57090d9

Please sign in to comment.