From 276248d5dd891283912783e5d8ba168c6d14c1a5 Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Thu, 4 Jan 2024 12:05:59 -0500 Subject: [PATCH] Couple of bugs found in Object::Pad and Future::AsyncAwait. see the role changes going on here for what i have to do right now but will report these upstream later. --- .vstags | 1 + lib/OpenAIAsync/Server.pm | 2 +- lib/OpenAIAsync/Server/API/v1/ChatCompletion.pm | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.vstags b/.vstags index 304c4c7..f5755a9 100644 --- a/.vstags +++ b/.vstags @@ -9934,6 +9934,7 @@ OpenAIAsync::Server .build/previous/lib/OpenAIAsync/Server.pm 1;" p OpenAIAsync::Server .build/s8al1KxdoG/blib/lib/OpenAIAsync/Server.pm 1;" p OpenAIAsync::Server .build/s8al1KxdoG/lib/OpenAIAsync/Server.pm 1;" p OpenAIAsync::Server lib/OpenAIAsync/Server.pm 1;" p +OpenAIAsync::Server::API::Test::ChatCompletion t/lib/OpenAIAsync/Server/API/Test/ChatCompletion.pm 1;" p OpenAIAsync::Server::API::v1::Audio .build/6o4PVL1DX3/blib/lib/OpenAIAsync/Server/API/v1/Audio.pm 1;" p OpenAIAsync::Server::API::v1::Audio .build/6o4PVL1DX3/lib/OpenAIAsync/Server/API/v1/Audio.pm 1;" p OpenAIAsync::Server::API::v1::Audio .build/8vRKKpniYC/blib/lib/OpenAIAsync/Server/API/v1/Audio.pm 1;" p diff --git a/lib/OpenAIAsync/Server.pm b/lib/OpenAIAsync/Server.pm index 1f04628..fd81620 100644 --- a/lib/OpenAIAsync/Server.pm +++ b/lib/OpenAIAsync/Server.pm @@ -239,7 +239,7 @@ class OpenAIAsync::Server :repr(HASH) :strict(params) { method __make_http_server() { # TODO args? # TODO make this work during a reload - my $server_id = sprintf("%d\0%d", $listen, $port); + my $server_id = sprintf("%s\0%d", $listen, $port); $ctx->{server_id} = $server_id; $http_server = Net::Async::HTTP::Server->new( diff --git a/lib/OpenAIAsync/Server/API/v1/ChatCompletion.pm b/lib/OpenAIAsync/Server/API/v1/ChatCompletion.pm index f87494b..af3d2fa 100644 --- a/lib/OpenAIAsync/Server/API/v1/ChatCompletion.pm +++ b/lib/OpenAIAsync/Server/API/v1/ChatCompletion.pm @@ -26,6 +26,8 @@ OpenAIAsync::Server::API::ChatCompletion - Basic chat api role, consumed to impl =cut role OpenAIAsync::Server::API::v1::ChatCompletion :strict(params) { + use Future::AsyncAwait; + ADJUST { $self->register_url( method => 'POST', @@ -37,5 +39,5 @@ role OpenAIAsync::Server::API::v1::ChatCompletion :strict(params) { ); } - async method chat($obj, $http_req, $ctx) {...} + method chat($obj, $http_req, $ctx); } \ No newline at end of file