Skip to content

Commit

Permalink
make auth copyable
Browse files Browse the repository at this point in the history
  • Loading branch information
sunjiayu committed Jul 26, 2024
1 parent da777f0 commit 5703cc7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion liboai/include/components/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ namespace liboai {
void UpdateOpenAIRoot(const std::string& new_openai_root) {
Network::UpdateOpenAIRoot(new_openai_root);
}
void SetAuth(const Authorization& auth) {
auth_ = auth;
}
/*
@brief Transcribes audio into the input language.
Expand Down Expand Up @@ -197,6 +200,7 @@ namespace liboai {
) const& noexcept(false);

private:
Authorization& auth_ = Authorization::Authorizer();
// Authorization& auth_ = Authorization::Authorizer();
Authorization auth_;
};
}
6 changes: 5 additions & 1 deletion liboai/include/components/chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ namespace liboai {
void UpdateOpenAIRoot(const std::string& new_openai_root) {
Network::UpdateOpenAIRoot(new_openai_root);
}
void SetAuth(const Authorization& auth) {
auth_ = auth;
}

using ChatStreamCallback = std::function<bool(std::string, intptr_t, Conversation&)>;

Expand Down Expand Up @@ -941,7 +944,8 @@ namespace liboai {
) const & noexcept(false);

private:
Authorization& auth_ = Authorization::Authorizer();
// Authorization& auth_ = Authorization::Authorizer();
Authorization auth_;
using StrippedStreamCallback = std::function<bool(std::string, intptr_t)>;
};
}
4 changes: 2 additions & 2 deletions liboai/include/core/authorization.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace liboai {
class Authorization final {
public: // cons/des, operator deletions
Authorization() = default;
NON_COPYABLE(Authorization)
NON_MOVABLE(Authorization)
// NON_COPYABLE(Authorization)
// NON_MOVABLE(Authorization)
~Authorization();

public: // member methods
Expand Down

0 comments on commit 5703cc7

Please sign in to comment.