mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-23 07:33:53 +08:00
Merge branch 'main' into main
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import logging
|
||||
from aiohttp import web
|
||||
from config.settings import update_config
|
||||
from ruamel.yaml.scalarstring import PreservedScalarString
|
||||
from manager.api.auth import verify_token
|
||||
from manager.api.response import response_unauthorized, response_success, response_error
|
||||
|
||||
@@ -28,10 +30,13 @@ class PromptApi:
|
||||
if 'prompt' not in data:
|
||||
return response_success()
|
||||
|
||||
self.config['prompt'] = data['prompt']
|
||||
# TODO 保存到配置文件
|
||||
return response_success()
|
||||
# 使用PreservedScalarString保留多行文本格式
|
||||
self.config['prompt'] = PreservedScalarString(data['prompt'])
|
||||
|
||||
# 保存到配置文件
|
||||
update_config(self.config)
|
||||
|
||||
return response_success()
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to update prompt: {e}")
|
||||
return response_error(str(e))
|
||||
|
||||
Reference in New Issue
Block a user