From dafe05f8d7cb104f5c29615f73a9c154fc31dd22 Mon Sep 17 00:00:00 2001 From: Chenjianyu Date: Tue, 15 Aug 2023 15:37:57 +0800 Subject: [PATCH] * fix ai test for azure vendor. --- module/ai/control.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/module/ai/control.php b/module/ai/control.php index ca4a31d7ad..c04c35d5b2 100644 --- a/module/ai/control.php +++ b/module/ai/control.php @@ -145,7 +145,18 @@ class ai extends control $this->ai->setConfig($modelConfig); - $result = $this->ai->complete('test', 1); // Test completing 'test' with length of 1. + if($currentVendor == 'azure') + { + $messages = array( + (object)array('role' => 'user', 'content' => 'Hello?') + ); + $result = $this->ai->converse($messages); + } + else + { + $result = $this->ai->complete('test', 1); // Test completing 'test' with length of 1. + } + if($result === false) { return $this->send(array('result' => 'fail', 'message' => empty($this->ai->errors) ? $this->lang->ai->models->testConnectionResult->fail : sprintf($this->lang->ai->models->testConnectionResult->failFormat, implode(', ', $this->ai->errors))));