From 6afbc71b132a24ea4d724d7df75541a452efc5ff Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 8 May 2026 10:54:33 +0800 Subject: [PATCH] bugfix --- wwwroot/upload_asset/index.dspy | 23 +++++++++++++++++++++++ wwwroot/v1/chat/completions/index.dspy | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/wwwroot/upload_asset/index.dspy b/wwwroot/upload_asset/index.dspy index aaffcb4..a2ec19d 100644 --- a/wwwroot/upload_asset/index.dspy +++ b/wwwroot/upload_asset/index.dspy @@ -18,6 +18,29 @@ if userid is None: 'error': f'sor_get_callerid() error' } try: + name = params_kw.name + if name is None: + return { + "status": "FAILED", + "error": "name is None" + } + if media_file is None: + return { + "status": "FAILED", + "error": "media_file is None" + } + assetType = params_kw.assetType + if assetType is None: + typ = media_file.split('.')[-1] + if typ in ['png', 'webp', 'jpg', 'gif']: + assetType = 'Image' + elif typ in ['mp4', 'mov', 'avi']: + assetType = 'Video' + elif type in ['mp3', 'wav', 'aac']: + assetType = 'Audio' + else: + assetType = None + params_kw.assetType = assetType b = await uapi.call(upappid, apiname, userid, params=params_kw) if isinstance(b, bytes): b = b.decode('utf-8') diff --git a/wwwroot/v1/chat/completions/index.dspy b/wwwroot/v1/chat/completions/index.dspy index 407433b..25d1818 100644 --- a/wwwroot/v1/chat/completions/index.dspy +++ b/wwwroot/v1/chat/completions/index.dspy @@ -48,5 +48,5 @@ if not f: debug(f'{userid=} balance not enough') return openai_429() # debug(f'{tools=}, {request._run_ns.tools=}') -return await env.stream_response(request, gen) +return await env.stream_response(request, gen, context_type='application/json')