Spaces:
Sleeping
Sleeping
ds
Browse files
mysite/interpreter/google_chat.py
CHANGED
@@ -5,7 +5,7 @@ def convert_newlines_to_google_chat_format(text):
|
|
5 |
# 改行文字を <br> タグに置き換える
|
6 |
return text.replace('\\n', '\\\n')
|
7 |
|
8 |
-
def send_google_chat_card(webhook_url, title, subtitle, link_text, link_url):
|
9 |
headers = {
|
10 |
'Content-Type': 'application/json; charset=UTF-8'
|
11 |
}
|
@@ -21,6 +21,16 @@ def send_google_chat_card(webhook_url, title, subtitle, link_text, link_url):
|
|
21 |
"sections": [
|
22 |
{
|
23 |
"widgets": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
{
|
25 |
"textParagraph": {
|
26 |
"text": subtitle
|
|
|
5 |
# 改行文字を <br> タグに置き換える
|
6 |
return text.replace('\\n', '\\\n')
|
7 |
|
8 |
+
def send_google_chat_card(webhook_url, title, subtitle, link_text, link_url,image_url=None):
|
9 |
headers = {
|
10 |
'Content-Type': 'application/json; charset=UTF-8'
|
11 |
}
|
|
|
21 |
"sections": [
|
22 |
{
|
23 |
"widgets": [
|
24 |
+
{
|
25 |
+
"image": {
|
26 |
+
"imageUrl": image_url,
|
27 |
+
"onClick": {
|
28 |
+
"openLink": {
|
29 |
+
"url": image_url
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
},
|
34 |
{
|
35 |
"textParagraph": {
|
36 |
"text": subtitle
|
mysite/routers/fastapi.py
CHANGED
@@ -232,11 +232,11 @@ def setup_webhook_routes(app: FastAPI):
|
|
232 |
#########################################################################
|
233 |
#user_name,thmbnail
|
234 |
title = f""" {user_name}様{thmbnail}から下記の質問があります"""
|
235 |
-
subtitle = f"""ユーザーID {user_id} \r\n 質問内容 {text}"""
|
236 |
link_text = "データを確認する"
|
237 |
link_url = "https://kenken999-php.hf.space/diamondprice_list.php"
|
238 |
#test_set_lide(subtitle, text)
|
239 |
-
thread_name = send_google_chat_card(webhook_url, title, subtitle, link_text, link_url)
|
240 |
|
241 |
#########################################################################
|
242 |
title = f""" プロンプト作成 {promps}userid{thread_name}chatid{thread_name}"""
|
|
|
232 |
#########################################################################
|
233 |
#user_name,thmbnail
|
234 |
title = f""" {user_name}様{thmbnail}から下記の質問があります"""
|
235 |
+
subtitle = f"""ユーザーID {user_id}サムネイル {thmbnail}\r\n 質問内容 {text}"""
|
236 |
link_text = "データを確認する"
|
237 |
link_url = "https://kenken999-php.hf.space/diamondprice_list.php"
|
238 |
#test_set_lide(subtitle, text)
|
239 |
+
thread_name = send_google_chat_card(webhook_url, title, subtitle, link_text, link_url,thmbnail)
|
240 |
|
241 |
#########################################################################
|
242 |
title = f""" プロンプト作成 {promps}userid{thread_name}chatid{thread_name}"""
|