From a2cac6d92b64ebcef39beffa12785e20664a3081 Mon Sep 17 00:00:00 2001 From: linghaihui <75124771@qq.com> Date: Thu, 23 Mar 2023 21:40:07 +0800 Subject: [PATCH] Fix some issues --- bingchat/components/chatbox/index.wxml | 2 +- bingchat/components/chatbox/index.wxss | 13 +++++++++---- new-bing/app.py | 9 +++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bingchat/components/chatbox/index.wxml b/bingchat/components/chatbox/index.wxml index a0c6355..915b906 100644 --- a/bingchat/components/chatbox/index.wxml +++ b/bingchat/components/chatbox/index.wxml @@ -14,7 +14,7 @@ - {{suggest}} + {{suggest}} diff --git a/bingchat/components/chatbox/index.wxss b/bingchat/components/chatbox/index.wxss index 7ddccf3..7638fe4 100644 --- a/bingchat/components/chatbox/index.wxss +++ b/bingchat/components/chatbox/index.wxss @@ -59,13 +59,14 @@ .suggest-item{ background-color: #f4f6f8; display: inline-block; - padding: 5rpx 10rpx 5rpx 10rpx; - border-radius: 10rpx; + padding: 5rpx 8rpx 5rpx 8rpx; + border-radius: 8rpx; margin-right: 16rpx; - color: rgb(180, 187, 196); + color: #b4bbc4; margin-bottom: 10rpx; - font-size: 25rpx; + font-size: 24rpx; } + @keyframes blink { from { display: 1.0; } to { opacity: 0.0; } @@ -74,4 +75,8 @@ .blinking { animation: blink 1.5s ease-in-out infinite; display: block; +} + +.suggest-item-hover { + color: #ff502c; } \ No newline at end of file diff --git a/new-bing/app.py b/new-bing/app.py index 6a79f84..77cb3e5 100644 --- a/new-bing/app.py +++ b/new-bing/app.py @@ -70,12 +70,13 @@ async def chat(request): text = '' suggests = [] if status == 'Success': - if len(res['item']['messages']) >= 2: - text = res['item']['messages'][1]['text'] + item = res['item']['messages'] + if len(item) >= 2: + text = item[1]['text'] if re.search(r'\[\^\d+\^\]', text): - text = res['item']['messages'][1]['adaptiveCards'][0]['body'][0]['text'] + text = item[1]['adaptiveCards'][0]['body'][0]['text'] text = re.sub(r'\[\^\d+\^\]', '', text) - suggests = [x['text'] for x in res['item']['messages'][1]['suggestedResponses']] + suggests = [x['text'] for x in item[1]['suggestedResponses']] if 'suggestedResponses' in item[1] else [] else: text = '抱歉,未搜索到结果,请重试。' suggests = [request.json.get('q')]