refactor(easy-admin): improve AI optimization feature and enhance user experience
- Remove line-height style from AI optimization content div - Add smooth scrolling to the end of the content when streaming output Move input validation to the beginning of the aiOptimization function
This commit is contained in:
@@ -79,6 +79,9 @@ class Goods extends AdminController
|
||||
#[NodeAnnotation(title: 'AI优化', auth: true)]
|
||||
public function aiOptimization(Request $request): void
|
||||
{
|
||||
$message = $request->post('message');
|
||||
if (empty($message)) $this->error('请输入内容');
|
||||
|
||||
// 演示环境下 默认返回的内容
|
||||
if ($this->isDemo) {
|
||||
$content = <<<EOF
|
||||
@@ -104,8 +107,6 @@ EOF;
|
||||
$this->success('success', compact('choices'));
|
||||
}
|
||||
|
||||
$message = $request->post('message');
|
||||
if (empty($message)) $this->error('请输入内容');
|
||||
try {
|
||||
$result = AiChatService::instance()
|
||||
// 当使用推理模型时,可能存在超时的情况,所以需要设置超时时间为 0
|
||||
|
||||
Reference in New Issue
Block a user