fix huoshan key
All checks were successful
Build and Deploy Backend / build-and-deploy (push) Successful in 13m18s

This commit is contained in:
repair-agent 2026-03-26 09:53:02 +08:00
parent f6d1559c90
commit 784115ce58
3 changed files with 31 additions and 4 deletions

View File

@ -132,9 +132,18 @@ class DeviceViewSet(viewsets.ViewSet):
if existing and existing.user != request.user: if existing and existing.user != request.user:
return error(code=ErrorCode.DEVICE_ALREADY_BOUND, message='设备已被其他用户绑定') return error(code=ErrorCode.DEVICE_ALREADY_BOUND, message='设备已被其他用户绑定')
# 创建角色记忆(始终创建新的) # 检查是否已有绑定关系(重复绑定时复用已有的角色记忆)
role_memory = None existing_binding = UserDevice.objects.filter(
if device.device_type: user=request.user, device=device
).select_related('role_memory').first()
if existing_binding and existing_binding.role_memory:
# 已有绑定且有角色记忆 → 复用,不重复创建
role_memory = existing_binding.role_memory
role_memory.is_bound = True
role_memory.save(update_fields=['is_bound', 'updated_at'])
elif device.device_type:
# 首次绑定 → 创建新角色记忆
role_memory = RoleMemory.objects.create( role_memory = RoleMemory.objects.create(
user=request.user, user=request.user,
device_type=device.device_type, device_type=device.device_type,
@ -142,8 +151,10 @@ class DeviceViewSet(viewsets.ViewSet):
prompt=device.device_type.default_prompt, prompt=device.device_type.default_prompt,
voice_id=device.device_type.default_voice_id, voice_id=device.device_type.default_voice_id,
) )
else:
role_memory = None
# 创建绑定关系 # 创建或更新绑定关系
user_device, created = UserDevice.objects.update_or_create( user_device, created = UserDevice.objects.update_or_create(
user=request.user, user=request.user,
device=device, device=device,

View File

@ -61,6 +61,14 @@ spec:
- name: ALIYUN_LOG_ACCESS_KEY_SECRET - name: ALIYUN_LOG_ACCESS_KEY_SECRET
value: "U1z3d0p5saPRD5sCxVooJYSjxSAmKB" value: "U1z3d0p5saPRD5sCxVooJYSjxSAmKB"
# Volcengine / 火山引擎豆包 (AI Generation)
- name: VOLCENGINE_API_KEY
value: "846b6981-9954-4c58-bb39-63079393bdb8"
# MiniMax (Music Generation)
- name: MINIMAX_API_KEY
value: "sk-api-MG0xNIYWDOnMVVus1nHbVS_PQleDh9-aJOCiVJLpAyzqWwUfYcMrbiWcHrV4Ri1HFsYgycSZSMirUEI_1L5wzcvAnu8ijoMDmGBkoGEBAKAl8MCzMpj8XRk"
# Log Center # Log Center
- name: ENVIRONMENT - name: ENVIRONMENT
value: "development" value: "development"

View File

@ -69,6 +69,14 @@ spec:
- name: CSRF_TRUSTED_ORIGINS - name: CSRF_TRUSTED_ORIGINS
value: "https://qiyuan-rtc-web.airlabs.art,https://qiyuan-rtc-dev-web.airlabs.art,https://qiyuan-rtc-api.airlabs.art" value: "https://qiyuan-rtc-web.airlabs.art,https://qiyuan-rtc-dev-web.airlabs.art,https://qiyuan-rtc-api.airlabs.art"
# Volcengine / 火山引擎豆包 (AI Generation)
- name: VOLCENGINE_API_KEY
value: "846b6981-9954-4c58-bb39-63079393bdb8"
# MiniMax (Music Generation)
- name: MINIMAX_API_KEY
value: "sk-api-MG0xNIYWDOnMVVus1nHbVS_PQleDh9-aJOCiVJLpAyzqWwUfYcMrbiWcHrV4Ri1HFsYgycSZSMirUEI_1L5wzcvAnu8ijoMDmGBkoGEBAKAl8MCzMpj8XRk"
# Log Center # Log Center
- name: ENVIRONMENT - name: ENVIRONMENT
value: "production" value: "production"