From 3e6a6bf396f0a493715ded04c08ee6cc2b705f64 Mon Sep 17 00:00:00 2001
From: "teruo OSHIDA(JP_SMN)" <37995617+monstaruos@users.noreply.github.com>
Date: Fri, 23 Aug 2024 09:21:31 +0900
Subject: [PATCH 01/24] fix: wrong usage of created_at on the modal for API Key
(#7548)
---
web/app/components/develop/secret-key/secret-key-modal.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/app/components/develop/secret-key/secret-key-modal.tsx b/web/app/components/develop/secret-key/secret-key-modal.tsx
index 01973ff028..fc780be05d 100644
--- a/web/app/components/develop/secret-key/secret-key-modal.tsx
+++ b/web/app/components/develop/secret-key/secret-key-modal.tsx
@@ -115,7 +115,7 @@ const SecretKeyModal = ({
{generateToken(api.token)}
{formatTime(Number(api.created_at), t('appLog.dateTimeFormat') as string)}
-
{api.last_used_at ? formatTime(Number(api.created_at), t('appLog.dateTimeFormat') as string) : t('appApi.never')}
+
{api.last_used_at ? formatTime(Number(api.last_used_at), t('appLog.dateTimeFormat') as string) : t('appApi.never')}
Date: Fri, 23 Aug 2024 08:33:41 +0800
Subject: [PATCH 02/24] fix: correct response structure in openapi
documentation of app (#7556)
---
.../components/develop/template/template_advanced_chat.en.mdx | 2 +-
.../components/develop/template/template_advanced_chat.zh.mdx | 2 +-
web/app/components/develop/template/template_chat.en.mdx | 4 ++--
web/app/components/develop/template/template_chat.zh.mdx | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/web/app/components/develop/template/template_advanced_chat.en.mdx b/web/app/components/develop/template/template_advanced_chat.en.mdx
index cec42a4e32..6487ac79d7 100644
--- a/web/app/components/develop/template/template_advanced_chat.en.mdx
+++ b/web/app/components/develop/template/template_advanced_chat.en.mdx
@@ -285,7 +285,7 @@ Chat applications support session persistence, allowing previous chat history to
data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
- data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}}
+ data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
```
diff --git a/web/app/components/develop/template/template_advanced_chat.zh.mdx b/web/app/components/develop/template/template_advanced_chat.zh.mdx
index 97a2df01a6..33551509e5 100755
--- a/web/app/components/develop/template/template_advanced_chat.zh.mdx
+++ b/web/app/components/develop/template/template_advanced_chat.zh.mdx
@@ -296,7 +296,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
- data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}}
+ data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
```
diff --git a/web/app/components/develop/template/template_chat.en.mdx b/web/app/components/develop/template/template_chat.en.mdx
index 00c02936a6..07840640f4 100644
--- a/web/app/components/develop/template/template_chat.en.mdx
+++ b/web/app/components/develop/template/template_chat.en.mdx
@@ -242,7 +242,7 @@ Chat applications support session persistence, allowing previous chat history to
data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
- data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}}
+ data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
```
@@ -256,7 +256,7 @@ Chat applications support session persistence, allowing previous chat history to
data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
- data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}}
+ data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
```
diff --git a/web/app/components/develop/template/template_chat.zh.mdx b/web/app/components/develop/template/template_chat.zh.mdx
index 9323313d9f..727d884c1a 100644
--- a/web/app/components/develop/template/template_chat.zh.mdx
+++ b/web/app/components/develop/template/template_chat.zh.mdx
@@ -255,7 +255,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
- data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}}
+ data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
```
@@ -274,7 +274,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
data: {"event": "agent_message", "id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "answer": " eyes wearing a bunny girl" ,"created_at": 1705639511, "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
data: {"event": "agent_message", "id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "answer": " suit .", "created_at": 1705639511, "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
data: {"event": "agent_thought", "id": "67a99dc1-4f82-42d3-b354-18d4594840c8", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "position": 2, "thought": "I have created an image of a cute Japanese anime girl with white hair and blue eyes wearing a bunny girl suit.", "observation": "", "tool": "", "tool_input": "", "created_at": 1705639511, "message_files": [], "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
- data: {"event": "message_end", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142", "metadata": {"usage": {"prompt_tokens": 305, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0003050", "completion_tokens": 97, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0001940", "total_tokens": 184, "total_price": "0.0002290", "currency": "USD", "latency": 1.771092874929309}}}
+ data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
```
From a40073afa446b4bb6bcd90477177baa6829949f1 Mon Sep 17 00:00:00 2001
From: Hanqing Zhao
Date: Fri, 23 Aug 2024 08:34:22 +0800
Subject: [PATCH 03/24] Add N-to-1 warning translation for JP (#7553)
---
web/i18n/ja-JP/dataset.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/web/i18n/ja-JP/dataset.ts b/web/i18n/ja-JP/dataset.ts
index 2cdc819cd5..5df8aaea7f 100644
--- a/web/i18n/ja-JP/dataset.ts
+++ b/web/i18n/ja-JP/dataset.ts
@@ -67,7 +67,9 @@ const translation = {
semantic: 'セマンティクス',
keyword: 'キーワード',
},
- nTo1RetrievalLegacy: '製品計画によると、N To 1 Retrievalは9月に正式に廃止される予定です。それまでは通常通り使用できます。',
+ nTo1RetrievalLegacy: '製品計画によると、N-to-1 Retrievalは9月に正式に廃止される予定です。それまでは通常通り使用できます。',
+ nTo1RetrievalLegacyLink: '詳細を見る',
+ nTo1RetrievalLegacyLinkText: ' N-to-1 retrievalは9月に正式に廃止されます。',
}
export default translation
From a24717765e5dd63519549a893230ae24fe6a4269 Mon Sep 17 00:00:00 2001
From: orangeclk
Date: Fri, 23 Aug 2024 11:15:38 +0800
Subject: [PATCH 04/24] feat: forward zhipu finish_reason (#7560)
---
api/core/model_runtime/model_providers/zhipuai/llm/llm.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/api/core/model_runtime/model_providers/zhipuai/llm/llm.py b/api/core/model_runtime/model_providers/zhipuai/llm/llm.py
index ff971964a8..13d8f5e5c3 100644
--- a/api/core/model_runtime/model_providers/zhipuai/llm/llm.py
+++ b/api/core/model_runtime/model_providers/zhipuai/llm/llm.py
@@ -444,6 +444,7 @@ class ZhipuAILargeLanguageModel(_CommonZhipuaiAI, LargeLanguageModel):
delta=LLMResultChunkDelta(
index=delta.index,
message=assistant_prompt_message,
+ finish_reason=delta.finish_reason
)
)
From 3ac8a2871e2ea88d46f90ccd4fdc3f1d71c527af Mon Sep 17 00:00:00 2001
From: Nam Vu
Date: Fri, 23 Aug 2024 10:16:37 +0700
Subject: [PATCH 05/24] chore: #6554 i18n (#7562)
---
web/i18n/de-DE/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/es-ES/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/fr-FR/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/hi-IN/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/it-IT/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/ko-KR/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/pl-PL/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/pt-BR/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/ro-RO/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/tr-TR/dataset.ts | 2 ++
web/i18n/uk-UA/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/vi-VN/dataset.ts | 26 ++++++++++++++++++++++++++
web/i18n/zh-Hant/dataset.ts | 26 ++++++++++++++++++++++++++
13 files changed, 314 insertions(+)
diff --git a/web/i18n/de-DE/dataset.ts b/web/i18n/de-DE/dataset.ts
index 53e8cdd447..c6586ceee8 100644
--- a/web/i18n/de-DE/dataset.ts
+++ b/web/i18n/de-DE/dataset.ts
@@ -45,6 +45,32 @@ const translation = {
},
docsFailedNotice: 'Dokumente konnten nicht indiziert werden',
retry: 'Wiederholen',
+ indexingTechnique: {
+ high_quality: 'HQ',
+ economy: 'ECO',
+ },
+ indexingMethod: {
+ semantic_search: 'VEKTOR',
+ full_text_search: 'VOLLTEXT',
+ hybrid_search: 'HYBRID',
+ invertedIndex: 'INVERTIERT',
+ },
+ mixtureHighQualityAndEconomicTip: 'Für die Mischung von hochwertigen und wirtschaftlichen Wissensbasen ist das Rerank-Modell erforderlich.',
+ inconsistentEmbeddingModelTip: 'Das Rerank-Modell ist erforderlich, wenn die Embedding-Modelle der ausgewählten Wissensbasen inkonsistent sind.',
+ retrievalSettings: 'Abrufeinstellungen',
+ rerankSettings: 'Rerank-Einstellungen',
+ weightedScore: {
+ title: 'Gewichtete Bewertung',
+ description: 'Durch Anpassung der zugewiesenen Gewichte bestimmt diese Rerank-Strategie, ob semantische oder Schlüsselwort-Übereinstimmung priorisiert werden soll.',
+ semanticFirst: 'Semantik zuerst',
+ keywordFirst: 'Schlüsselwort zuerst',
+ customized: 'Angepasst',
+ semantic: 'Semantisch',
+ keyword: 'Schlüsselwort',
+ },
+ nTo1RetrievalLegacy: 'N-zu-1-Abruf wird ab September offiziell eingestellt. Es wird empfohlen, den neuesten Multi-Pfad-Abruf zu verwenden, um bessere Ergebnisse zu erzielen.',
+ nTo1RetrievalLegacyLink: 'Mehr erfahren',
+ nTo1RetrievalLegacyLinkText: 'N-zu-1-Abruf wird im September offiziell eingestellt.',
}
export default translation
diff --git a/web/i18n/es-ES/dataset.ts b/web/i18n/es-ES/dataset.ts
index 307187b605..e4fc362efa 100644
--- a/web/i18n/es-ES/dataset.ts
+++ b/web/i18n/es-ES/dataset.ts
@@ -45,6 +45,32 @@ const translation = {
},
docsFailedNotice: 'no se pudieron indexar los documentos',
retry: 'Reintentar',
+ indexingTechnique: {
+ high_quality: 'AC',
+ economy: 'ECO',
+ },
+ indexingMethod: {
+ semantic_search: 'VECTOR',
+ full_text_search: 'TEXTO COMPLETO',
+ hybrid_search: 'HÍBRIDO',
+ invertedIndex: 'INVERTIDO',
+ },
+ mixtureHighQualityAndEconomicTip: 'Se requiere el modelo de reclasificación para la mezcla de bases de conocimiento de alta calidad y económicas.',
+ inconsistentEmbeddingModelTip: 'Se requiere el modelo de reclasificación si los modelos de incrustación de las bases de conocimiento seleccionadas son inconsistentes.',
+ retrievalSettings: 'Configuración de recuperación',
+ rerankSettings: 'Configuración de reclasificación',
+ weightedScore: {
+ title: 'Puntuación ponderada',
+ description: 'Al ajustar los pesos asignados, esta estrategia de reclasificación determina si se debe priorizar la coincidencia semántica o de palabras clave.',
+ semanticFirst: 'Semántica primero',
+ keywordFirst: 'Palabra clave primero',
+ customized: 'Personalizado',
+ semantic: 'Semántico',
+ keyword: 'Palabra clave',
+ },
+ nTo1RetrievalLegacy: 'La recuperación N-a-1 será oficialmente obsoleta a partir de septiembre. Se recomienda utilizar la última recuperación de múltiples rutas para obtener mejores resultados.',
+ nTo1RetrievalLegacyLink: 'Más información',
+ nTo1RetrievalLegacyLinkText: 'La recuperación N-a-1 será oficialmente obsoleta en septiembre.',
}
export default translation
diff --git a/web/i18n/fr-FR/dataset.ts b/web/i18n/fr-FR/dataset.ts
index 2ba5819c24..014168e006 100644
--- a/web/i18n/fr-FR/dataset.ts
+++ b/web/i18n/fr-FR/dataset.ts
@@ -45,6 +45,32 @@ const translation = {
},
docsFailedNotice: 'Les documents n\'ont pas pu être indexés',
retry: 'Réessayer',
+ indexingTechnique: {
+ high_quality: 'HQ',
+ economy: 'ÉCO',
+ },
+ indexingMethod: {
+ semantic_search: 'VECTEUR',
+ full_text_search: 'TEXTE INTÉGRAL',
+ hybrid_search: 'HYBRIDE',
+ invertedIndex: 'INVERSÉ',
+ },
+ mixtureHighQualityAndEconomicTip: 'Le modèle de reclassement est nécessaire pour le mélange de bases de connaissances de haute qualité et économiques.',
+ inconsistentEmbeddingModelTip: 'Le modèle de reclassement est nécessaire si les modèles d\'incorporation des bases de connaissances sélectionnées sont incohérents.',
+ retrievalSettings: 'Paramètres de récupération',
+ rerankSettings: 'Paramètres de reclassement',
+ weightedScore: {
+ title: 'Score pondéré',
+ description: 'En ajustant les poids attribués, cette stratégie de reclassement détermine s\'il faut prioriser la correspondance sémantique ou par mots-clés.',
+ semanticFirst: 'Sémantique d\'abord',
+ keywordFirst: 'Mot-clé d\'abord',
+ customized: 'Personnalisé',
+ semantic: 'Sémantique',
+ keyword: 'Mot-clé',
+ },
+ nTo1RetrievalLegacy: 'La récupération N-à-1 sera officiellement obsolète à partir de septembre. Il est recommandé d\'utiliser la dernière récupération multi-chemins pour obtenir de meilleurs résultats.',
+ nTo1RetrievalLegacyLink: 'En savoir plus',
+ nTo1RetrievalLegacyLinkText: 'La récupération N-à-1 sera officiellement obsolète en septembre.',
}
export default translation
diff --git a/web/i18n/hi-IN/dataset.ts b/web/i18n/hi-IN/dataset.ts
index 859887a54d..de33113d2b 100644
--- a/web/i18n/hi-IN/dataset.ts
+++ b/web/i18n/hi-IN/dataset.ts
@@ -52,6 +52,32 @@ const translation = {
},
docsFailedNotice: 'दस्तावेज़ों को अनुक्रमित करने में विफल',
retry: 'पुनः प्रयास करें',
+ indexingTechnique: {
+ high_quality: 'उच्च गुणवत्ता',
+ economy: 'किफायती',
+ },
+ indexingMethod: {
+ semantic_search: 'वेक्टर',
+ full_text_search: 'पूर्ण पाठ',
+ hybrid_search: 'हाइब्रिड',
+ invertedIndex: 'उल्टा',
+ },
+ mixtureHighQualityAndEconomicTip: 'उच्च गुणवत्ता और किफायती ज्ञान आधारों के मिश्रण के लिए पुनः रैंकिंग मॉडल आवश्यक है।',
+ inconsistentEmbeddingModelTip: 'यदि चयनित ज्ञान आधारों के एम्बेडिंग मॉडल असंगत हैं, तो पुनः रैंकिंग मॉडल आवश्यक है।',
+ retrievalSettings: 'पुनर्प्राप्ति सेटिंग्स',
+ rerankSettings: 'पुनः रैंकिंग सेटिंग्स',
+ weightedScore: {
+ title: 'भारित स्कोर',
+ description: 'आवंटित भारों को समायोजित करके, यह पुनः रैंकिंग रणनीति निर्धारित करती है कि शब्दार्थ या कीवर्ड मिलान को प्राथमिकता दी जाए।',
+ semanticFirst: 'शब्दार्थ पहले',
+ keywordFirst: 'कीवर्ड पहले',
+ customized: 'अनुकूलित',
+ semantic: 'शब्दार्थ',
+ keyword: 'कीवर्ड',
+ },
+ nTo1RetrievalLegacy: 'N-से-1 पुनर्प्राप्ति सितंबर से आधिकारिक तौर पर बंद कर दी जाएगी। बेहतर परिणाम प्राप्त करने के लिए नवीनतम बहु-मार्ग पुनर्प्राप्ति का उपयोग करने की सिफारिश की जाती है।',
+ nTo1RetrievalLegacyLink: 'और जानें',
+ nTo1RetrievalLegacyLinkText: 'N-से-1 पुनर्प्राप्ति सितंबर में आधिकारिक तौर पर बंद कर दी जाएगी।',
}
export default translation
diff --git a/web/i18n/it-IT/dataset.ts b/web/i18n/it-IT/dataset.ts
index f191f6f2a6..9223a3a96d 100644
--- a/web/i18n/it-IT/dataset.ts
+++ b/web/i18n/it-IT/dataset.ts
@@ -52,6 +52,32 @@ const translation = {
},
docsFailedNotice: 'documenti non riusciti a essere indicizzati',
retry: 'Riprova',
+ indexingTechnique: {
+ high_quality: 'AQ',
+ economy: 'ECO',
+ },
+ indexingMethod: {
+ semantic_search: 'VETTORE',
+ full_text_search: 'TESTO COMPLETO',
+ hybrid_search: 'IBRIDO',
+ invertedIndex: 'INVERTITO',
+ },
+ mixtureHighQualityAndEconomicTip: 'Il modello di riclassificazione è necessario per la miscela di basi di conoscenza di alta qualità ed economiche.',
+ inconsistentEmbeddingModelTip: 'Il modello di riclassificazione è necessario se i modelli di embedding delle basi di conoscenza selezionate sono incoerenti.',
+ retrievalSettings: 'Impostazioni di recupero',
+ rerankSettings: 'Impostazioni di riclassificazione',
+ weightedScore: {
+ title: 'Punteggio ponderato',
+ description: 'Regolando i pesi assegnati, questa strategia di riclassificazione determina se dare priorità alla corrispondenza semantica o per parole chiave.',
+ semanticFirst: 'Semantica prima',
+ keywordFirst: 'Parola chiave prima',
+ customized: 'Personalizzato',
+ semantic: 'Semantico',
+ keyword: 'Parola chiave',
+ },
+ nTo1RetrievalLegacy: 'Il recupero N-a-1 sarà ufficialmente deprecato da settembre. Si consiglia di utilizzare il più recente recupero multi-percorso per ottenere risultati migliori.',
+ nTo1RetrievalLegacyLink: 'Scopri di più',
+ nTo1RetrievalLegacyLinkText: 'Il recupero N-a-1 sarà ufficialmente deprecato a settembre.',
}
export default translation
diff --git a/web/i18n/ko-KR/dataset.ts b/web/i18n/ko-KR/dataset.ts
index 27a5d7320e..907a1f21b6 100644
--- a/web/i18n/ko-KR/dataset.ts
+++ b/web/i18n/ko-KR/dataset.ts
@@ -44,6 +44,32 @@ const translation = {
},
docsFailedNotice: '문서 인덱스에 실패했습니다',
retry: '재시도',
+ indexingTechnique: {
+ high_quality: 'HQ',
+ economy: '이코노미',
+ },
+ indexingMethod: {
+ semantic_search: '벡터',
+ full_text_search: '전체 텍스트',
+ hybrid_search: '하이브리드',
+ invertedIndex: '역인덱스',
+ },
+ mixtureHighQualityAndEconomicTip: '고품질과 경제적 지식 베이스의 혼합을 위해서는 재순위 모델이 필요합니다.',
+ inconsistentEmbeddingModelTip: '선택된 지식 베이스의 임베딩 모델이 일관되지 않은 경우 재순위 모델이 필요합니다.',
+ retrievalSettings: '검색 설정',
+ rerankSettings: '재순위 설정',
+ weightedScore: {
+ title: '가중 점수',
+ description: '할당된 가중치를 조정함으로써, 이 재순위 전략은 의미론적 일치 또는 키워드 일치 중 어느 것을 우선시할지 결정합니다.',
+ semanticFirst: '의미론 우선',
+ keywordFirst: '키워드 우선',
+ customized: '사용자 정의',
+ semantic: '의미론적',
+ keyword: '키워드',
+ },
+ nTo1RetrievalLegacy: 'N-대-1 검색은 9월부터 공식적으로 더 이상 사용되지 않습니다. 더 나은 결과를 얻으려면 최신 다중 경로 검색을 사용하는 것이 좋습니다.',
+ nTo1RetrievalLegacyLink: '자세히 알아보기',
+ nTo1RetrievalLegacyLinkText: 'N-대-1 검색은 9월에 공식적으로 더 이상 사용되지 않습니다.',
}
export default translation
diff --git a/web/i18n/pl-PL/dataset.ts b/web/i18n/pl-PL/dataset.ts
index 5351b3c739..14de4eaf40 100644
--- a/web/i18n/pl-PL/dataset.ts
+++ b/web/i18n/pl-PL/dataset.ts
@@ -51,6 +51,32 @@ const translation = {
},
docsFailedNotice: 'nie udało się zindeksować dokumentów',
retry: 'Ponów',
+ indexingTechnique: {
+ high_quality: 'WJ',
+ economy: 'EKO',
+ },
+ indexingMethod: {
+ semantic_search: 'WEKTOR',
+ full_text_search: 'PEŁNY TEKST',
+ hybrid_search: 'HYBRYDOWY',
+ invertedIndex: 'ODWRÓCONY',
+ },
+ mixtureHighQualityAndEconomicTip: 'Model ponownego rankingu jest wymagany dla mieszanki wysokiej jakości i ekonomicznych baz wiedzy.',
+ inconsistentEmbeddingModelTip: 'Model ponownego rankingu jest wymagany, jeśli modele osadzania wybranych baz wiedzy są niespójne.',
+ retrievalSettings: 'Ustawienia wyszukiwania',
+ rerankSettings: 'Ustawienia ponownego rankingu',
+ weightedScore: {
+ title: 'Ważona ocena',
+ description: 'Poprzez dostosowanie przypisanych wag, ta strategia ponownego rankingu określa, czy priorytetowo traktować dopasowanie semantyczne czy słów kluczowych.',
+ semanticFirst: 'Najpierw semantyczne',
+ keywordFirst: 'Najpierw słowa kluczowe',
+ customized: 'Dostosowane',
+ semantic: 'Semantyczne',
+ keyword: 'Słowo kluczowe',
+ },
+ nTo1RetrievalLegacy: 'Wyszukiwanie N-do-1 zostanie oficjalnie wycofane od września. Zaleca się korzystanie z najnowszego wyszukiwania wielościeżkowego, aby uzyskać lepsze wyniki.',
+ nTo1RetrievalLegacyLink: 'Dowiedz się więcej',
+ nTo1RetrievalLegacyLinkText: 'Wyszukiwanie N-do-1 zostanie oficjalnie wycofane we wrześniu.',
}
export default translation
diff --git a/web/i18n/pt-BR/dataset.ts b/web/i18n/pt-BR/dataset.ts
index f6f76e4626..8710879149 100644
--- a/web/i18n/pt-BR/dataset.ts
+++ b/web/i18n/pt-BR/dataset.ts
@@ -44,6 +44,32 @@ const translation = {
},
docsFailedNotice: 'documentos falharam ao serem indexados',
retry: 'Tentar novamente',
+ indexingTechnique: {
+ high_quality: 'AQ',
+ economy: 'ECO',
+ },
+ indexingMethod: {
+ semantic_search: 'VETOR',
+ full_text_search: 'TEXTO COMPLETO',
+ hybrid_search: 'HÍBRIDO',
+ invertedIndex: 'INVERTIDO',
+ },
+ mixtureHighQualityAndEconomicTip: 'O modelo de reclassificação é necessário para a mistura de bases de conhecimento de alta qualidade e econômicas.',
+ inconsistentEmbeddingModelTip: 'O modelo de reclassificação é necessário se os modelos de incorporação das bases de conhecimento selecionadas forem inconsistentes.',
+ retrievalSettings: 'Configurações de Recuperação',
+ rerankSettings: 'Configurações de Reclassificação',
+ weightedScore: {
+ title: 'Pontuação Ponderada',
+ description: 'Ao ajustar os pesos atribuídos, esta estratégia de reclassificação determina se deve priorizar a correspondência semântica ou por palavras-chave.',
+ semanticFirst: 'Semântica primeiro',
+ keywordFirst: 'Palavra-chave primeiro',
+ customized: 'Personalizado',
+ semantic: 'Semântico',
+ keyword: 'Palavra-chave',
+ },
+ nTo1RetrievalLegacy: 'A recuperação N-para-1 será oficialmente descontinuada a partir de setembro. Recomenda-se usar a recuperação de múltiplos caminhos mais recente para obter melhores resultados.',
+ nTo1RetrievalLegacyLink: 'Saiba mais',
+ nTo1RetrievalLegacyLinkText: 'A recuperação N-para-1 será oficialmente descontinuada em setembro.',
}
export default translation
diff --git a/web/i18n/ro-RO/dataset.ts b/web/i18n/ro-RO/dataset.ts
index 363d882b09..3e605baf92 100644
--- a/web/i18n/ro-RO/dataset.ts
+++ b/web/i18n/ro-RO/dataset.ts
@@ -45,6 +45,32 @@ const translation = {
},
docsFailedNotice: 'documentele nu au putut fi indexate',
retry: 'Reîncercați',
+ indexingTechnique: {
+ high_quality: 'IC',
+ economy: 'ECO',
+ },
+ indexingMethod: {
+ semantic_search: 'VECTOR',
+ full_text_search: 'TEXT COMPLET',
+ hybrid_search: 'HIBRID',
+ invertedIndex: 'INVERSAT',
+ },
+ mixtureHighQualityAndEconomicTip: 'Modelul de reclasificare este necesar pentru amestecul de baze de cunoștințe de înaltă calitate și economice.',
+ inconsistentEmbeddingModelTip: 'Modelul de reclasificare este necesar dacă modelele de încorporare ale bazelor de cunoștințe selectate sunt inconsistente.',
+ retrievalSettings: 'Setări de recuperare',
+ rerankSettings: 'Setări de reclasificare',
+ weightedScore: {
+ title: 'Scor ponderat',
+ description: 'Prin ajustarea ponderilor atribuite, această strategie de reclasificare determină dacă să prioritizeze potrivirea semantică sau pe cea a cuvintelor cheie.',
+ semanticFirst: 'Semantic primul',
+ keywordFirst: 'Cuvânt cheie primul',
+ customized: 'Personalizat',
+ semantic: 'Semantic',
+ keyword: 'Cuvânt cheie',
+ },
+ nTo1RetrievalLegacy: 'Recuperarea N-la-1 va fi oficial depreciată din septembrie. Se recomandă utilizarea celei mai recente recuperări cu căi multiple pentru a obține rezultate mai bune.',
+ nTo1RetrievalLegacyLink: 'Află mai multe',
+ nTo1RetrievalLegacyLinkText: 'Recuperarea N-la-1 va fi oficial depreciată în septembrie.',
}
export default translation
diff --git a/web/i18n/tr-TR/dataset.ts b/web/i18n/tr-TR/dataset.ts
index 68bd5860bb..31d483f504 100644
--- a/web/i18n/tr-TR/dataset.ts
+++ b/web/i18n/tr-TR/dataset.ts
@@ -68,6 +68,8 @@ const translation = {
keyword: 'Anahtar Kelime',
},
nTo1RetrievalLegacy: 'Geri alım stratejisinin optimizasyonu ve yükseltilmesi nedeniyle, N-to-1 geri alımı Eylül ayında resmi olarak kullanım dışı kalacaktır. O zamana kadar normal şekilde kullanabilirsiniz.',
+ nTo1RetrievalLegacyLink: 'Daha fazla bilgi edin',
+ nTo1RetrievalLegacyLinkText: 'N-1 geri alma Eylül ayında resmi olarak kullanımdan kaldırılacaktır.',
}
export default translation
diff --git a/web/i18n/uk-UA/dataset.ts b/web/i18n/uk-UA/dataset.ts
index fb44b4107a..3bf59ed33b 100644
--- a/web/i18n/uk-UA/dataset.ts
+++ b/web/i18n/uk-UA/dataset.ts
@@ -45,6 +45,32 @@ const translation = {
},
docsFailedNotice: 'документи не вдалося проіндексувати',
retry: 'Повторити спробу',
+ indexingTechnique: {
+ high_quality: 'ВЯ',
+ economy: 'ЕКО',
+ },
+ indexingMethod: {
+ semantic_search: 'ВЕКТОР',
+ full_text_search: 'ПОВНИЙ ТЕКСТ',
+ hybrid_search: 'ГІБРИД',
+ invertedIndex: 'ІНВЕРТОВАНИЙ',
+ },
+ mixtureHighQualityAndEconomicTip: 'Модель перерангування потрібна для суміші високоякісних та економічних баз знань.',
+ inconsistentEmbeddingModelTip: 'Модель перерангування потрібна, якщо моделі вбудовування вибраних баз знань є несумісними.',
+ retrievalSettings: 'Налаштування пошуку',
+ rerankSettings: 'Налаштування перерангування',
+ weightedScore: {
+ title: 'Зважена оцінка',
+ description: 'Регулюючи призначені ваги, ця стратегія перерангування визначає, чи надавати пріоритет семантичному чи ключовому відповідності.',
+ semanticFirst: 'Спочатку семантичний',
+ keywordFirst: 'Спочатку ключове слово',
+ customized: 'Налаштований',
+ semantic: 'Семантичний',
+ keyword: 'Ключове слово',
+ },
+ nTo1RetrievalLegacy: 'N-до-1 пошук буде офіційно застарілим з вересня. Рекомендується використовувати найновіший багатошляховий пошук для отримання кращих результатів.',
+ nTo1RetrievalLegacyLink: 'Дізнатися більше',
+ nTo1RetrievalLegacyLinkText: 'N-до-1 пошук буде офіційно застарілим у вересні.',
}
export default translation
diff --git a/web/i18n/vi-VN/dataset.ts b/web/i18n/vi-VN/dataset.ts
index 27dad01f51..81b4597800 100644
--- a/web/i18n/vi-VN/dataset.ts
+++ b/web/i18n/vi-VN/dataset.ts
@@ -45,6 +45,32 @@ const translation = {
},
docsFailedNotice: 'tài liệu không được lập chỉ mục',
retry: 'Thử lại',
+ indexingTechnique: {
+ high_quality: 'CHẤT LƯỢNG',
+ economy: 'TIẾT KIỆM',
+ },
+ indexingMethod: {
+ semantic_search: 'VECTOR',
+ full_text_search: 'VĂN BẢN ĐẦY ĐỦ',
+ hybrid_search: 'KẾT HỢP',
+ invertedIndex: 'ĐẢO NGƯỢC',
+ },
+ mixtureHighQualityAndEconomicTip: 'Mô hình xếp hạng lại là cần thiết cho sự kết hợp của các cơ sở kiến thức chất lượng cao và tiết kiệm.',
+ inconsistentEmbeddingModelTip: 'Mô hình xếp hạng lại là cần thiết nếu các mô hình nhúng của các cơ sở kiến thức được chọn không nhất quán.',
+ retrievalSettings: 'Cài đặt truy xuất',
+ rerankSettings: 'Cài đặt xếp hạng lại',
+ weightedScore: {
+ title: 'Điểm số có trọng số',
+ description: 'Bằng cách điều chỉnh trọng số được gán, chiến lược xếp hạng lại này xác định liệu ưu tiên khớp ngữ nghĩa hay từ khóa.',
+ semanticFirst: 'Ngữ nghĩa trước',
+ keywordFirst: 'Từ khóa trước',
+ customized: 'Tùy chỉnh',
+ semantic: 'Ngữ nghĩa',
+ keyword: 'Từ khóa',
+ },
+ nTo1RetrievalLegacy: 'Truy xuất N-đến-1 sẽ chính thức bị loại bỏ từ tháng 9. Khuyến nghị sử dụng truy xuất đa đường dẫn mới nhất để có kết quả tốt hơn.',
+ nTo1RetrievalLegacyLink: 'Tìm hiểu thêm',
+ nTo1RetrievalLegacyLinkText: 'Truy xuất N-đến-1 sẽ chính thức bị loại bỏ vào tháng 9.',
}
export default translation
diff --git a/web/i18n/zh-Hant/dataset.ts b/web/i18n/zh-Hant/dataset.ts
index 8de7bc487f..1e011bc987 100644
--- a/web/i18n/zh-Hant/dataset.ts
+++ b/web/i18n/zh-Hant/dataset.ts
@@ -45,6 +45,32 @@ const translation = {
},
docsFailedNotice: '文件無法被索引',
retry: '重試',
+ indexingTechnique: {
+ high_quality: '高質量',
+ economy: '經濟',
+ },
+ indexingMethod: {
+ semantic_search: '向量',
+ full_text_search: '全文',
+ hybrid_search: '混合',
+ invertedIndex: '倒排索引',
+ },
+ mixtureHighQualityAndEconomicTip: '混合高質量和經濟知識庫需要重新排序模型。',
+ inconsistentEmbeddingModelTip: '如果選定知識庫的嵌入模型不一致,則需要重新排序模型。',
+ retrievalSettings: '檢索設置',
+ rerankSettings: '重新排序設置',
+ weightedScore: {
+ title: '加權分數',
+ description: '通過調整分配的權重,此重新排序策略決定是優先考慮語義匹配還是關鍵詞匹配。',
+ semanticFirst: '語義優先',
+ keywordFirst: '關鍵詞優先',
+ customized: '自定義',
+ semantic: '語義',
+ keyword: '關鍵詞',
+ },
+ nTo1RetrievalLegacy: 'N對1檢索將從9月起正式棄用。建議使用最新的多路徑檢索以獲得更好的結果。',
+ nTo1RetrievalLegacyLink: '了解更多',
+ nTo1RetrievalLegacyLinkText: 'N對1檢索將於9月正式棄用。',
}
export default translation
From a71fc185309f8b1fdc1dc079b3f6185848189091 Mon Sep 17 00:00:00 2001
From: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com>
Date: Fri, 23 Aug 2024 13:11:55 +0800
Subject: [PATCH 06/24] feat: set workflow zoom range for shortcut (#7563)
---
.../workflow/hooks/use-shortcuts.ts | 21 +++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/web/app/components/workflow/hooks/use-shortcuts.ts b/web/app/components/workflow/hooks/use-shortcuts.ts
index 9484f9c16e..666c3a45ba 100644
--- a/web/app/components/workflow/hooks/use-shortcuts.ts
+++ b/web/app/components/workflow/hooks/use-shortcuts.ts
@@ -37,12 +37,25 @@ export const useShortcuts = (): void => {
const { handleLayout } = useWorkflowOrganize()
const {
- zoomIn,
- zoomOut,
zoomTo,
+ getZoom,
fitView,
} = useReactFlow()
+ // Zoom out to a minimum of 0.5 for shortcut
+ const constrainedZoomOut = () => {
+ const currentZoom = getZoom()
+ const newZoom = Math.max(currentZoom - 0.1, 0.5)
+ zoomTo(newZoom)
+ }
+
+ // Zoom in to a maximum of 1 for shortcut
+ const constrainedZoomIn = () => {
+ const currentZoom = getZoom()
+ const newZoom = Math.min(currentZoom + 0.1, 1)
+ zoomTo(newZoom)
+ }
+
const shouldHandleShortcut = useCallback((e: KeyboardEvent) => {
const { showFeaturesPanel } = workflowStore.getState()
return !showFeaturesPanel && !isEventTargetInputArea(e.target as HTMLElement)
@@ -165,7 +178,7 @@ export const useShortcuts = (): void => {
useKeyPress(`${getKeyboardKeyCodeBySystem('ctrl')}.dash`, (e) => {
if (shouldHandleShortcut(e)) {
e.preventDefault()
- zoomOut()
+ constrainedZoomOut()
handleSyncWorkflowDraft()
}
}, {
@@ -176,7 +189,7 @@ export const useShortcuts = (): void => {
useKeyPress(`${getKeyboardKeyCodeBySystem('ctrl')}.equalsign`, (e) => {
if (shouldHandleShortcut(e)) {
e.preventDefault()
- zoomIn()
+ constrainedZoomIn()
handleSyncWorkflowDraft()
}
}, {
From 9618f86980a69ffaa5f48373267dc5aa22c3771a Mon Sep 17 00:00:00 2001
From: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com>
Date: Fri, 23 Aug 2024 13:14:17 +0800
Subject: [PATCH 07/24] fix: workflow context menu popup issue (#7530)
---
web/app/components/workflow/node-contextmenu.tsx | 12 +++++++++---
web/app/components/workflow/panel-contextmenu.tsx | 8 +++++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/web/app/components/workflow/node-contextmenu.tsx b/web/app/components/workflow/node-contextmenu.tsx
index adfed37b26..311bf1fddf 100644
--- a/web/app/components/workflow/node-contextmenu.tsx
+++ b/web/app/components/workflow/node-contextmenu.tsx
@@ -1,5 +1,6 @@
import {
memo,
+ useEffect,
useRef,
} from 'react'
import { useClickAway } from 'ahooks'
@@ -9,13 +10,18 @@ import type { Node } from './types'
import { useStore } from './store'
import { usePanelInteractions } from './hooks'
-const PanelContextmenu = () => {
+const NodeContextmenu = () => {
const ref = useRef(null)
const nodes = useNodes()
- const { handleNodeContextmenuCancel } = usePanelInteractions()
+ const { handleNodeContextmenuCancel, handlePaneContextmenuCancel } = usePanelInteractions()
const nodeMenu = useStore(s => s.nodeMenu)
const currentNode = nodes.find(node => node.id === nodeMenu?.nodeId) as Node
+ useEffect(() => {
+ if (nodeMenu)
+ handlePaneContextmenuCancel()
+ }, [nodeMenu, handlePaneContextmenuCancel])
+
useClickAway(() => {
handleNodeContextmenuCancel()
}, ref)
@@ -42,4 +48,4 @@ const PanelContextmenu = () => {
)
}
-export default memo(PanelContextmenu)
+export default memo(NodeContextmenu)
diff --git a/web/app/components/workflow/panel-contextmenu.tsx b/web/app/components/workflow/panel-contextmenu.tsx
index 502967ce2c..f01e3037a2 100644
--- a/web/app/components/workflow/panel-contextmenu.tsx
+++ b/web/app/components/workflow/panel-contextmenu.tsx
@@ -1,5 +1,6 @@
import {
memo,
+ useEffect,
useRef,
} from 'react'
import { useTranslation } from 'react-i18next'
@@ -23,11 +24,16 @@ const PanelContextmenu = () => {
const clipboardElements = useStore(s => s.clipboardElements)
const setShowImportDSLModal = useStore(s => s.setShowImportDSLModal)
const { handleNodesPaste } = useNodesInteractions()
- const { handlePaneContextmenuCancel } = usePanelInteractions()
+ const { handlePaneContextmenuCancel, handleNodeContextmenuCancel } = usePanelInteractions()
const { handleStartWorkflowRun } = useWorkflowStartRun()
const { handleAddNote } = useOperator()
const { exportCheck } = useDSL()
+ useEffect(() => {
+ if (panelMenu)
+ handleNodeContextmenuCancel()
+ }, [panelMenu, handleNodeContextmenuCancel])
+
useClickAway(() => {
handlePaneContextmenuCancel()
}, ref)
From 0a7ab9a47dc4858ed6d0cf8279add6ad299b6031 Mon Sep 17 00:00:00 2001
From: edo1z <89882017+edo1z@users.noreply.github.com>
Date: Fri, 23 Aug 2024 14:16:15 +0900
Subject: [PATCH 08/24] fix: incorrect duplication when no target node is
selected (#7539)
---
.../workflow/hooks/use-nodes-interactions.ts | 30 ++++++++++++-------
.../panel-operator/panel-operator-popup.tsx | 2 +-
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts
index 87d1b4de8c..3645e18449 100644
--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts
+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts
@@ -1027,7 +1027,7 @@ export const useNodesInteractions = () => {
handleNodeSelect(node.id)
}, [workflowStore, handleNodeSelect])
- const handleNodesCopy = useCallback(() => {
+ const handleNodesCopy = useCallback((nodeId?: string) => {
if (getNodesReadOnly())
return
@@ -1038,17 +1038,27 @@ export const useNodesInteractions = () => {
} = store.getState()
const nodes = getNodes()
- const bundledNodes = nodes.filter(node => node.data._isBundled && node.data.type !== BlockEnum.Start && !node.data.isInIteration)
- if (bundledNodes.length) {
- setClipboardElements(bundledNodes)
- return
+ if (nodeId) {
+ // If nodeId is provided, copy that specific node
+ const nodeToCopy = nodes.find(node => node.id === nodeId && node.data.type !== BlockEnum.Start)
+ if (nodeToCopy)
+ setClipboardElements([nodeToCopy])
}
+ else {
+ // If no nodeId is provided, fall back to the current behavior
+ const bundledNodes = nodes.filter(node => node.data._isBundled && node.data.type !== BlockEnum.Start && !node.data.isInIteration)
- const selectedNode = nodes.find(node => node.data.selected && node.data.type !== BlockEnum.Start)
+ if (bundledNodes.length) {
+ setClipboardElements(bundledNodes)
+ return
+ }
- if (selectedNode)
- setClipboardElements([selectedNode])
+ const selectedNode = nodes.find(node => node.data.selected && node.data.type !== BlockEnum.Start)
+
+ if (selectedNode)
+ setClipboardElements([selectedNode])
+ }
}, [getNodesReadOnly, store, workflowStore])
const handleNodesPaste = useCallback(() => {
@@ -1128,11 +1138,11 @@ export const useNodesInteractions = () => {
}
}, [getNodesReadOnly, workflowStore, store, reactflow, saveStateToHistory, handleSyncWorkflowDraft, handleNodeIterationChildrenCopy])
- const handleNodesDuplicate = useCallback(() => {
+ const handleNodesDuplicate = useCallback((nodeId?: string) => {
if (getNodesReadOnly())
return
- handleNodesCopy()
+ handleNodesCopy(nodeId)
handleNodesPaste()
}, [getNodesReadOnly, handleNodesCopy, handleNodesPaste])
diff --git a/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx b/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx
index aade4d8be8..bd642fcd66 100644
--- a/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx
+++ b/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx
@@ -138,7 +138,7 @@ const PanelOperatorPopup = ({
className='flex items-center justify-between px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50'
onClick={() => {
onClosePopup()
- handleNodesDuplicate()
+ handleNodesDuplicate(id)
}}
>
{t('workflow.common.duplicate')}
From 399d7cd596e2d276e7c6df366c92293488c6e3e9 Mon Sep 17 00:00:00 2001
From: Joel
Date: Fri, 23 Aug 2024 14:30:26 +0800
Subject: [PATCH 09/24] chore: improve the check time of variable name (#7569)
---
.../config-var/config-modal/index.tsx | 37 ++++++++++---------
web/i18n/de-DE/app-debug.ts | 10 ++---
web/i18n/en-US/app-debug.ts | 11 +++---
web/i18n/es-ES/app-debug.ts | 10 ++---
web/i18n/fa-IR/app-debug.ts | 10 ++---
web/i18n/fr-FR/app-debug.ts | 10 ++---
web/i18n/hi-IN/app-debug.ts | 10 ++---
web/i18n/it-IT/app-debug.ts | 10 ++---
web/i18n/ja-JP/app-debug.ts | 10 ++---
web/i18n/ko-KR/app-debug.ts | 10 ++---
web/i18n/pl-PL/app-debug.ts | 10 ++---
web/i18n/pt-BR/app-debug.ts | 10 ++---
web/i18n/ro-RO/app-debug.ts | 10 ++---
web/i18n/tr-TR/app-debug.ts | 10 ++---
web/i18n/uk-UA/app-debug.ts | 10 ++---
web/i18n/vi-VN/app-debug.ts | 10 ++---
web/i18n/zh-Hans/app-debug.ts | 11 +++---
web/i18n/zh-Hant/app-debug.ts | 10 ++---
18 files changed, 105 insertions(+), 104 deletions(-)
diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx
index 20fcf49de1..3296c77fb2 100644
--- a/web/app/components/app/configuration/config-var/config-modal/index.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx
@@ -42,18 +42,19 @@ const ConfigModal: FC = ({
const { type, label, variable, options, max_length } = tempPayload
const isStringInput = type === InputVarType.textInput || type === InputVarType.paragraph
+ const checkVariableName = useCallback((value: string) => {
+ const { isValid, errorMessageKey } = checkKeys([value], false)
+ if (!isValid) {
+ Toast.notify({
+ type: 'error',
+ message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: t('appDebug.variableConig.varName') }),
+ })
+ return false
+ }
+ return true
+ }, [t])
const handlePayloadChange = useCallback((key: string) => {
return (value: any) => {
- if (key === 'variable') {
- const { isValid, errorKey, errorMessageKey } = checkKeys([value], true)
- if (!isValid) {
- Toast.notify({
- type: 'error',
- message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
- })
- return
- }
- }
setTempPayload((prev) => {
const newPayload = {
...prev,
@@ -63,19 +64,20 @@ const ConfigModal: FC = ({
return newPayload
})
}
- }, [t])
+ }, [])
const handleVarKeyBlur = useCallback((e: any) => {
- if (tempPayload.label)
+ const varName = e.target.value
+ if (!checkVariableName(varName) || tempPayload.label)
return
setTempPayload((prev) => {
return {
...prev,
- label: e.target.value,
+ label: varName,
}
})
- }, [tempPayload])
+ }, [checkVariableName, tempPayload.label])
const handleConfirm = () => {
const moreInfo = tempPayload.variable === payload?.variable
@@ -84,10 +86,11 @@ const ConfigModal: FC = ({
type: ChangeType.changeVarName,
payload: { beforeKey: payload?.variable || '', afterKey: tempPayload.variable },
}
- if (!tempPayload.variable) {
- Toast.notify({ type: 'error', message: t('appDebug.variableConig.errorMsg.varNameRequired') })
+
+ const isVariableNameValid = checkVariableName(tempPayload.variable)
+ if (!isVariableNameValid)
return
- }
+
// TODO: check if key already exists. should the consider the edit case
// if (varKeys.map(key => key?.trim()).includes(tempPayload.variable.trim())) {
// Toast.notify({
diff --git a/web/i18n/de-DE/app-debug.ts b/web/i18n/de-DE/app-debug.ts
index e78b6c0d7a..acb3f53904 100644
--- a/web/i18n/de-DE/app-debug.ts
+++ b/web/i18n/de-DE/app-debug.ts
@@ -237,11 +237,11 @@ const translation = {
typeSelect: 'Auswählen',
},
varKeyError: {
- canNoBeEmpty: 'Variablenschlüssel darf nicht leer sein',
- tooLong: 'Variablenschlüssel: {{key}} zu lang. Darf nicht länger als 30 Zeichen sein',
- notValid: 'Variablenschlüssel: {{key}} ist ungültig. Darf nur Buchstaben, Zahlen und Unterstriche enthalten',
- notStartWithNumber: 'Variablenschlüssel: {{key}} darf nicht mit einer Zahl beginnen',
- keyAlreadyExists: 'Variablenschlüssel: :{{key}} existiert bereits',
+ canNoBeEmpty: '{{key}} ist erforderlich',
+ tooLong: '{{key}} zu lang. Darf nicht länger als 30 Zeichen sein',
+ notValid: '{{key}} ist ungültig. Darf nur Buchstaben, Zahlen und Unterstriche enthalten',
+ notStartWithNumber: '{{key}} darf nicht mit einer Zahl beginnen',
+ keyAlreadyExists: '{{key}} existiert bereits',
},
otherError: {
promptNoBeEmpty: 'Prompt darf nicht leer sein',
diff --git a/web/i18n/en-US/app-debug.ts b/web/i18n/en-US/app-debug.ts
index a4e8a4f7fa..86c5f720c3 100644
--- a/web/i18n/en-US/app-debug.ts
+++ b/web/i18n/en-US/app-debug.ts
@@ -290,11 +290,11 @@ const translation = {
typeSelect: 'Select',
},
varKeyError: {
- canNoBeEmpty: 'Variable key can not be empty',
- tooLong: 'Variable key: {{key}} too length. Can not be longer then 30 characters',
- notValid: 'Variable key: {{key}} is invalid. Can only contain letters, numbers, and underscores',
- notStartWithNumber: 'Variable key: {{key}} can not start with a number',
- keyAlreadyExists: 'Variable key: :{{key}} already exists',
+ canNoBeEmpty: '{{key}} is required',
+ tooLong: '{{key}} is too length. Can not be longer then 30 characters',
+ notValid: '{{key}} is invalid. Can only contain letters, numbers, and underscores',
+ notStartWithNumber: '{{key}} can not start with a number',
+ keyAlreadyExists: '{{key}} already exists',
},
otherError: {
promptNoBeEmpty: 'Prompt can not be empty',
@@ -323,7 +323,6 @@ const translation = {
'content': 'Content',
'required': 'Required',
'errorMsg': {
- varNameRequired: 'Variable name is required',
labelNameRequired: 'Label name is required',
varNameCanBeRepeat: 'Variable name can not be repeated',
atLeastOneOption: 'At least one option is required',
diff --git a/web/i18n/es-ES/app-debug.ts b/web/i18n/es-ES/app-debug.ts
index 9e309a7d62..68088c26a6 100644
--- a/web/i18n/es-ES/app-debug.ts
+++ b/web/i18n/es-ES/app-debug.ts
@@ -248,11 +248,11 @@ const translation = {
typeSelect: 'Seleccionar',
},
varKeyError: {
- canNoBeEmpty: 'La clave de la variable no puede estar vacía',
- tooLong: 'Clave de la variable: {{key}} demasiado larga. No puede tener más de 30 caracteres',
- notValid: 'Clave de la variable: {{key}} no es válida. Solo puede contener letras, números y guiones bajos',
- notStartWithNumber: 'Clave de la variable: {{key}} no puede comenzar con un número',
- keyAlreadyExists: 'Clave de la variable: {{key}} ya existe',
+ canNoBeEmpty: 'Se requiere {{key}}',
+ tooLong: '{{key}} demasiado larga. No puede tener más de 30 caracteres',
+ notValid: '{{key}} no es válida. Solo puede contener letras, números y guiones bajos',
+ notStartWithNumber: '{{key}} no puede comenzar con un número',
+ keyAlreadyExists: '{{key}} ya existe',
},
otherError: {
promptNoBeEmpty: 'La indicación no puede estar vacía',
diff --git a/web/i18n/fa-IR/app-debug.ts b/web/i18n/fa-IR/app-debug.ts
index 863f47bb18..1ce222581d 100644
--- a/web/i18n/fa-IR/app-debug.ts
+++ b/web/i18n/fa-IR/app-debug.ts
@@ -283,11 +283,11 @@ const translation = {
typeSelect: 'انتخاب',
},
varKeyError: {
- canNoBeEmpty: 'کلید متغیر نمیتواند خالی باشد',
- tooLong: 'کلید متغیر: {{key}} طولانی است. نمیتواند بیش از 30 کاراکتر باشد',
- notValid: 'کلید متغیر: {{key}} نامعتبر است. فقط میتواند شامل حروف، اعداد و زیرخط باشد',
- notStartWithNumber: 'کلید متغیر: {{key}} نمیتواند با عدد شروع شود',
- keyAlreadyExists: 'کلید متغیر: :{{key}} از قبل وجود دارد',
+ canNoBeEmpty: '{{key}} مطلوب',
+ tooLong: '{{key}} طولانی است. نمیتواند بیش از 30 کاراکتر باشد',
+ notValid: '{{key}} نامعتبر است. فقط میتواند شامل حروف، اعداد و زیرخط باشد',
+ notStartWithNumber: '{{key}} نمیتواند با عدد شروع شود',
+ keyAlreadyExists: '{{key}} از قبل وجود دارد',
},
otherError: {
promptNoBeEmpty: 'پرس و جو نمیتواند خالی باشد',
diff --git a/web/i18n/fr-FR/app-debug.ts b/web/i18n/fr-FR/app-debug.ts
index 91d2dcb142..b71d251956 100644
--- a/web/i18n/fr-FR/app-debug.ts
+++ b/web/i18n/fr-FR/app-debug.ts
@@ -237,11 +237,11 @@ const translation = {
typeSelect: 'Sélectionner',
},
varKeyError: {
- canNoBeEmpty: 'La clé variable ne peut pas être vide',
- tooLong: 'Variable key: {{key}} too length. Can not be longer then 30 characters',
- notValid: 'Variable key: {{key}} is invalid. Can only contain letters, numbers, and underscores',
- notStartWithNumber: 'Variable key: {{key}} can not start with a number',
- keyAlreadyExists: 'Variable key: :{{key}} already exists',
+ canNoBeEmpty: '{{key}} est obligatoire',
+ tooLong: '{{key}} too length. Can not be longer then 30 characters',
+ notValid: '{{key}} is invalid. Can only contain letters, numbers, and underscores',
+ notStartWithNumber: '{{key}} can not start with a number',
+ keyAlreadyExists: '{{key}} already exists',
},
otherError: {
promptNoBeEmpty: 'Le prompt ne peut pas être vide',
diff --git a/web/i18n/hi-IN/app-debug.ts b/web/i18n/hi-IN/app-debug.ts
index 872a1b9fe8..29944c8d84 100644
--- a/web/i18n/hi-IN/app-debug.ts
+++ b/web/i18n/hi-IN/app-debug.ts
@@ -276,14 +276,14 @@ const translation = {
typeSelect: 'चुनें',
},
varKeyError: {
- canNoBeEmpty: 'वेरिएबल कुंजी खाली नहीं हो सकती',
+ canNoBeEmpty: '{{key}} आवश्यक है',
tooLong:
- 'वेरिएबल कुंजी: {{key}} बहुत लंबी है। 30 वर्णों से अधिक नहीं हो सकती',
+ '{{key}} बहुत लंबी है। 30 वर्णों से अधिक नहीं हो सकती',
notValid:
- 'वेरिएबल कुंजी: {{key}} अवैध है। केवल अक्षर, संख्याएं, और अंडरस्कोर शामिल हो सकते हैं',
+ '{{key}} अवैध है। केवल अक्षर, संख्याएं, और अंडरस्कोर शामिल हो सकते हैं',
notStartWithNumber:
- 'वेरिएबल कुंजी: {{key}} एक संख्या से प्रारंभ नहीं हो सकती',
- keyAlreadyExists: 'वेरिएबल कुंजी: {{key}} पहले से मौजूद है',
+ '{{key}} एक संख्या से प्रारंभ नहीं हो सकती',
+ keyAlreadyExists: '{{key}} पहले से मौजूद है',
},
otherError: {
promptNoBeEmpty: 'प्रॉम्प्ट खाली नहीं हो सकता',
diff --git a/web/i18n/it-IT/app-debug.ts b/web/i18n/it-IT/app-debug.ts
index 8efe575945..a4cf7bba2d 100644
--- a/web/i18n/it-IT/app-debug.ts
+++ b/web/i18n/it-IT/app-debug.ts
@@ -278,14 +278,14 @@ const translation = {
typeSelect: 'Seleziona',
},
varKeyError: {
- canNoBeEmpty: 'La chiave della variabile non può essere vuota',
+ canNoBeEmpty: '{{key}} è obbligatorio',
tooLong:
- 'La chiave della variabile: {{key}} è troppo lunga. Non può essere più lunga di 30 caratteri',
+ '{{key}} è troppo lunga. Non può essere più lunga di 30 caratteri',
notValid:
- 'La chiave della variabile: {{key}} non è valida. Può contenere solo lettere, numeri e underscore',
+ '{{key}} non è valida. Può contenere solo lettere, numeri e underscore',
notStartWithNumber:
- 'La chiave della variabile: {{key}} non può iniziare con un numero',
- keyAlreadyExists: 'La chiave della variabile: {{key}} esiste già',
+ '{{key}} non può iniziare con un numero',
+ keyAlreadyExists: '{{key}} esiste già',
},
otherError: {
promptNoBeEmpty: 'Il prompt non può essere vuoto',
diff --git a/web/i18n/ja-JP/app-debug.ts b/web/i18n/ja-JP/app-debug.ts
index 39ea3386ed..6049be2406 100644
--- a/web/i18n/ja-JP/app-debug.ts
+++ b/web/i18n/ja-JP/app-debug.ts
@@ -284,11 +284,11 @@ const translation = {
typeSelect: '選択',
},
varKeyError: {
- canNoBeEmpty: '変数キーを空にすることはできません',
- tooLong: '変数キー: {{key}} が長すぎます。30文字を超えることはできません',
- notValid: '変数キー: {{key}} が無効です。文字、数字、アンダースコアのみを含めることができます',
- notStartWithNumber: '変数キー: {{key}} は数字で始めることはできません',
- keyAlreadyExists: '変数キー: {{key}} はすでに存在します',
+ canNoBeEmpty: '{{key}} は必須です',
+ tooLong: '{{key}} が長すぎます。30文字を超えることはできません',
+ notValid: '{{key}} が無効です。文字、数字、アンダースコアのみを含めることができます',
+ notStartWithNumber: '{{key}} は数字で始めることはできません',
+ keyAlreadyExists: '{{key}} はすでに存在します',
},
otherError: {
promptNoBeEmpty: 'プロンプトを空にすることはできません',
diff --git a/web/i18n/ko-KR/app-debug.ts b/web/i18n/ko-KR/app-debug.ts
index 77eac2503d..0a2488b64c 100644
--- a/web/i18n/ko-KR/app-debug.ts
+++ b/web/i18n/ko-KR/app-debug.ts
@@ -248,11 +248,11 @@ const translation = {
typeSelect: '선택',
},
varKeyError: {
- canNoBeEmpty: '변수 키를 비울 수 없습니다',
- tooLong: '변수 키: {{key}}가 너무 깁니다. 30자를 넘을 수 없습니다',
- notValid: '변수 키: {{key}}가 유효하지 않습니다. 문자, 숫자, 밑줄만 포함할 수 있습니다',
- notStartWithNumber: '변수 키: {{key}}는 숫자로 시작할 수 없습니다',
- keyAlreadyExists: '변수 키: {{key}}는 이미 존재합니다',
+ canNoBeEmpty: '{{key}}가 필요합니다',
+ tooLong: '{{key}}가 너무 깁니다. 30자를 넘을 수 없습니다',
+ notValid: '{{key}}가 유효하지 않습니다. 문자, 숫자, 밑줄만 포함할 수 있습니다',
+ notStartWithNumber: '{{key}}는 숫자로 시작할 수 없습니다',
+ keyAlreadyExists: '{{key}}는 이미 존재합니다',
},
otherError: {
promptNoBeEmpty: '프롬프트를 비울 수 없습니다',
diff --git a/web/i18n/pl-PL/app-debug.ts b/web/i18n/pl-PL/app-debug.ts
index 960209c045..afb412f264 100644
--- a/web/i18n/pl-PL/app-debug.ts
+++ b/web/i18n/pl-PL/app-debug.ts
@@ -275,14 +275,14 @@ const translation = {
typeSelect: 'Wybierz',
},
varKeyError: {
- canNoBeEmpty: 'Klucz zmiennej nie może być pusty',
+ canNoBeEmpty: '{{klucz}} jest wymagany',
tooLong:
- 'Klucz zmiennej: {{key}} za długi. Nie może być dłuższy niż 30 znaków',
+ '{{key}} za długi. Nie może być dłuższy niż 30 znaków',
notValid:
- 'Klucz zmiennej: {{key}} jest nieprawidłowy. Może zawierać tylko litery, cyfry i podkreślenia',
+ '{{key}} jest nieprawidłowy. Może zawierać tylko litery, cyfry i podkreślenia',
notStartWithNumber:
- 'Klucz zmiennej: {{key}} nie może zaczynać się od cyfry',
- keyAlreadyExists: 'Klucz zmiennej: :{{key}} już istnieje',
+ '{{key}} nie może zaczynać się od cyfry',
+ keyAlreadyExists: '{{key}} już istnieje',
},
otherError: {
promptNoBeEmpty: 'Monit nie może być pusty',
diff --git a/web/i18n/pt-BR/app-debug.ts b/web/i18n/pt-BR/app-debug.ts
index 91730d44b3..9605bd5d95 100644
--- a/web/i18n/pt-BR/app-debug.ts
+++ b/web/i18n/pt-BR/app-debug.ts
@@ -254,11 +254,11 @@ const translation = {
typeSelect: 'Selecionar',
},
varKeyError: {
- canNoBeEmpty: 'A chave da variável não pode estar vazia',
- tooLong: 'A chave da variável: {{key}} é muito longa. Não pode ter mais de 30 caracteres',
- notValid: 'A chave da variável: {{key}} é inválida. Pode conter apenas letras, números e sublinhados',
- notStartWithNumber: 'A chave da variável: {{key}} não pode começar com um número',
- keyAlreadyExists: 'A chave da variável: :{{key}} já existe',
+ canNoBeEmpty: '{{key}} é obrigatório',
+ tooLong: '{{key}} é muito longa. Não pode ter mais de 30 caracteres',
+ notValid: '{{key}} é inválida. Pode conter apenas letras, números e sublinhados',
+ notStartWithNumber: '{{key}} não pode começar com um número',
+ keyAlreadyExists: '{{key}} já existe',
},
otherError: {
promptNoBeEmpty: 'A solicitação não pode estar vazia',
diff --git a/web/i18n/ro-RO/app-debug.ts b/web/i18n/ro-RO/app-debug.ts
index b4e9442de8..7363f2954f 100644
--- a/web/i18n/ro-RO/app-debug.ts
+++ b/web/i18n/ro-RO/app-debug.ts
@@ -254,11 +254,11 @@ const translation = {
typeSelect: 'Selectează',
},
varKeyError: {
- canNoBeEmpty: 'Cheia variabilei nu poate fi goală',
- tooLong: 'Cheia variabilei: {{key}} este prea lungă. Nu poate fi mai lungă de 30 de caractere',
- notValid: 'Cheia variabilei: {{key}} este nevalidă. Poate conține doar litere, cifre și sublinieri',
- notStartWithNumber: 'Cheia variabilei: {{key}} nu poate începe cu un număr',
- keyAlreadyExists: 'Cheia variabilei: :{{key}} deja există',
+ canNoBeEmpty: '{{key}} este necesară',
+ tooLong: '{{key}} este prea lungă. Nu poate fi mai lungă de 30 de caractere',
+ notValid: '{{key}} este nevalidă. Poate conține doar litere, cifre și sublinieri',
+ notStartWithNumber: '{{key}} nu poate începe cu un număr',
+ keyAlreadyExists: ':{{key}} deja există',
},
otherError: {
promptNoBeEmpty: 'Promptul nu poate fi gol',
diff --git a/web/i18n/tr-TR/app-debug.ts b/web/i18n/tr-TR/app-debug.ts
index 889f48c78e..fbf51535fe 100644
--- a/web/i18n/tr-TR/app-debug.ts
+++ b/web/i18n/tr-TR/app-debug.ts
@@ -290,11 +290,11 @@ const translation = {
typeSelect: 'Seçim',
},
varKeyError: {
- canNoBeEmpty: 'Değişken anahtarı boş olamaz',
- tooLong: 'Değişken anahtarı: {{key}} çok uzun. 30 karakterden uzun olamaz',
- notValid: 'Değişken anahtarı: {{key}} geçersizdir. Sadece harfler, rakamlar ve altçizgiler içerebilir',
- notStartWithNumber: 'Değişken anahtarı: {{key}} bir rakamla başlamamalıdır',
- keyAlreadyExists: 'Değişken anahtarı: {{key}} zaten mevcut',
+ canNoBeEmpty: '{{key}} gereklidir',
+ tooLong: '{{key}} çok uzun. 30 karakterden uzun olamaz',
+ notValid: '{{key}} geçersizdir. Sadece harfler, rakamlar ve altçizgiler içerebilir',
+ notStartWithNumber: '{{key}} bir rakamla başlamamalıdır',
+ keyAlreadyExists: '{{key}} zaten mevcut',
},
otherError: {
promptNoBeEmpty: 'Prompt boş olamaz',
diff --git a/web/i18n/uk-UA/app-debug.ts b/web/i18n/uk-UA/app-debug.ts
index c64444c871..7c0ba45b3c 100644
--- a/web/i18n/uk-UA/app-debug.ts
+++ b/web/i18n/uk-UA/app-debug.ts
@@ -248,11 +248,11 @@ const translation = {
typeSelect: 'Вибрати', // Select
},
varKeyError: {
- canNoBeEmpty: 'Ключ змінної не може бути порожнім', // Variable key can not be empty
- tooLong: 'Ключ змінної: {{key}} занадто довгий. Не може бути більше 30 символів', // Variable key: {{key}} too length. Can not be longer then 30 characters
- notValid: 'Ключ змінної: {{key}} недійсний. Може містити лише літери, цифри та підкреслення', // Variable key: {{key}} is invalid. Can only contain letters, numbers, and underscores
- notStartWithNumber: 'Ключ змінної: {{key}} не може починатися з цифри', // Variable key: {{key}} can not start with a number
- keyAlreadyExists: 'Ключ змінної: :{{key}} вже існує', // Variable key: :{{key}} already exists
+ canNoBeEmpty: 'Потрібен {{key}}', // Variable key can not be empty
+ tooLong: '{{key}} занадто довгий. Не може бути більше 30 символів', // Variable key: {{key}} too length. Can not be longer then 30 characters
+ notValid: '{{key}} недійсний. Може містити лише літери, цифри та підкреслення', // Variable key: {{key}} is invalid. Can only contain letters, numbers, and underscores
+ notStartWithNumber: '{{key}} не може починатися з цифри', // Variable key: {{key}} can not start with a number
+ keyAlreadyExists: ':{{key}} вже існує', // Variable key: :{{key}} already exists
},
otherError: {
promptNoBeEmpty: 'Команда не може бути порожньою', // Prompt can not be empty
diff --git a/web/i18n/vi-VN/app-debug.ts b/web/i18n/vi-VN/app-debug.ts
index 4797f768e3..906b39d10a 100644
--- a/web/i18n/vi-VN/app-debug.ts
+++ b/web/i18n/vi-VN/app-debug.ts
@@ -248,11 +248,11 @@ const translation = {
typeSelect: 'Lựa chọn',
},
varKeyError: {
- canNoBeEmpty: 'Khóa biến không thể trống',
- tooLong: 'Khóa biến: {{key}} quá dài. Không thể dài hơn 30 ký tự',
- notValid: 'Khóa biến: {{key}} không hợp lệ. Chỉ có thể chứa chữ cái, số, và dấu gạch dưới',
- notStartWithNumber: 'Khóa biến: {{key}} không thể bắt đầu bằng số',
- keyAlreadyExists: 'Khóa biến: {{key}} đã tồn tại',
+ canNoBeEmpty: '{{key}} là bắt buộc',
+ tooLong: '{{key}} quá dài. Không thể dài hơn 30 ký tự',
+ notValid: '{{key}} không hợp lệ. Chỉ có thể chứa chữ cái, số, và dấu gạch dưới',
+ notStartWithNumber: '{{key}} không thể bắt đầu bằng số',
+ keyAlreadyExists: '{{key}} đã tồn tại',
},
otherError: {
promptNoBeEmpty: 'Lời nhắc không thể trống',
diff --git a/web/i18n/zh-Hans/app-debug.ts b/web/i18n/zh-Hans/app-debug.ts
index b95bb8ce51..febf80d786 100644
--- a/web/i18n/zh-Hans/app-debug.ts
+++ b/web/i18n/zh-Hans/app-debug.ts
@@ -287,11 +287,11 @@ const translation = {
typeSelect: '下拉选项',
},
varKeyError: {
- canNoBeEmpty: '变量不能为空',
- tooLong: '变量: {{key}} 长度太长。不能超过 30 个字符',
- notValid: '变量: {{key}} 非法。只能包含英文字符,数字和下划线',
- notStartWithNumber: '变量: {{key}} 不能以数字开头',
- keyAlreadyExists: '变量:{{key}} 已存在',
+ canNoBeEmpty: '{{key}}必填',
+ tooLong: '{{key}} 长度太长。不能超过 30 个字符',
+ notValid: '{{key}} 非法。只能包含英文字符,数字和下划线',
+ notStartWithNumber: '{{key}} 不能以数字开头',
+ keyAlreadyExists: '{{key}} 已存在',
},
otherError: {
promptNoBeEmpty: '提示词不能为空',
@@ -320,7 +320,6 @@ const translation = {
'required': '必填',
'content': '内容',
'errorMsg': {
- varNameRequired: '变量名称必填',
labelNameRequired: '显示名称必填',
varNameCanBeRepeat: '变量名称不能重复',
atLeastOneOption: '至少需要一个选项',
diff --git a/web/i18n/zh-Hant/app-debug.ts b/web/i18n/zh-Hant/app-debug.ts
index ec5d536bb9..ca4dfbb0cf 100644
--- a/web/i18n/zh-Hant/app-debug.ts
+++ b/web/i18n/zh-Hant/app-debug.ts
@@ -233,11 +233,11 @@ const translation = {
typeSelect: '下拉選項',
},
varKeyError: {
- canNoBeEmpty: '變數不能為空',
- tooLong: '變數: {{key}} 長度太長。不能超過 30 個字元',
- notValid: '變數: {{key}} 非法。只能包含英文字元,數字和下劃線',
- notStartWithNumber: '變數: {{key}} 不能以數字開頭',
- keyAlreadyExists: '變數:{{key}} 已存在',
+ canNoBeEmpty: '{{key}} 是必要的',
+ tooLong: '{{key}} 長度太長。不能超過 30 個字元',
+ notValid: '{{key}} 非法。只能包含英文字元,數字和下劃線',
+ notStartWithNumber: '{{key}} 不能以數字開頭',
+ keyAlreadyExists: '{{key}} 已存在',
},
otherError: {
promptNoBeEmpty: '提示詞不能為空',
From fb75bd979048ed410616578dc9e825734174240a Mon Sep 17 00:00:00 2001
From: Joel
Date: Fri, 23 Aug 2024 15:08:34 +0800
Subject: [PATCH 10/24] chore: improve the check time of variable name in
conversation and env var (#7572)
---
.../components/variable-modal.tsx | 26 +++++++++++--------
.../panel/env-panel/variable-modal.tsx | 26 +++++++++++--------
2 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx
index 289e29d592..e6c1ebb5cc 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx
@@ -15,6 +15,7 @@ import type { ConversationVariable } from '@/app/components/workflow/types'
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'
import cn from '@/utils/classnames'
+import { checkKeys } from '@/utils/var'
export type ModalPropsType = {
chatVar?: ConversationVariable
@@ -128,14 +129,16 @@ const ChatVariableModal = ({
}
}
- const handleNameChange = (v: string) => {
- if (!v)
- return setName('')
- if (!/^[a-zA-Z0-9_]+$/.test(v))
- return notify({ type: 'error', message: 'name is can only contain letters, numbers and underscores' })
- if (/^[0-9]/.test(v))
- return notify({ type: 'error', message: 'name can not start with a number' })
- setName(v)
+ const checkVariableName = (value: string) => {
+ const { isValid, errorMessageKey } = checkKeys([value], false)
+ if (!isValid) {
+ notify({
+ type: 'error',
+ message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: t('workflow.env.modal.name') }),
+ })
+ return false
+ }
+ return true
}
const handleTypeChange = (v: ChatVarType) => {
@@ -211,8 +214,8 @@ const ChatVariableModal = ({
}
const handleSave = () => {
- if (!name)
- return notify({ type: 'error', message: 'name can not be empty' })
+ if (!checkVariableName(name))
+ return
if (!chatVar && varList.some(chatVar => chatVar.name === name))
return notify({ type: 'error', message: 'name is existed' })
// if (type !== ChatVarType.Object && !value)
@@ -272,7 +275,8 @@ const ChatVariableModal = ({
className='block px-3 w-full h-8 bg-components-input-bg-normal system-sm-regular radius-md border border-transparent appearance-none outline-none caret-primary-600 hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:bg-components-input-bg-active focus:border-components-input-border-active focus:shadow-xs placeholder:system-sm-regular placeholder:text-components-input-text-placeholder'
placeholder={t('workflow.chatVariable.modal.namePlaceholder') || ''}
value={name}
- onChange={e => handleNameChange(e.target.value)}
+ onChange={e => setName(e.target.value || '')}
+ onBlur={e => checkVariableName(e.target.value)}
type='text'
/>
diff --git a/web/app/components/workflow/panel/env-panel/variable-modal.tsx b/web/app/components/workflow/panel/env-panel/variable-modal.tsx
index 46f92bd8ed..c62a849f36 100644
--- a/web/app/components/workflow/panel/env-panel/variable-modal.tsx
+++ b/web/app/components/workflow/panel/env-panel/variable-modal.tsx
@@ -9,6 +9,7 @@ import { ToastContext } from '@/app/components/base/toast'
import { useStore } from '@/app/components/workflow/store'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
import cn from '@/utils/classnames'
+import { checkKeys } from '@/utils/var'
export type ModalPropsType = {
env?: EnvironmentVariable
@@ -28,19 +29,21 @@ const VariableModal = ({
const [name, setName] = React.useState('')
const [value, setValue] = React.useState
()
- const handleNameChange = (v: string) => {
- if (!v)
- return setName('')
- if (!/^[a-zA-Z0-9_]+$/.test(v))
- return notify({ type: 'error', message: 'name is can only contain letters, numbers and underscores' })
- if (/^[0-9]/.test(v))
- return notify({ type: 'error', message: 'name can not start with a number' })
- setName(v)
+ const checkVariableName = (value: string) => {
+ const { isValid, errorMessageKey } = checkKeys([value], false)
+ if (!isValid) {
+ notify({
+ type: 'error',
+ message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: t('workflow.env.modal.name') }),
+ })
+ return false
+ }
+ return true
}
const handleSave = () => {
- if (!name)
- return notify({ type: 'error', message: 'name can not be empty' })
+ if (!checkVariableName(name))
+ return
if (!value)
return notify({ type: 'error', message: 'value can not be empty' })
if (!env && envList.some(env => env.name === name))
@@ -118,7 +121,8 @@ const VariableModal = ({
className='block px-3 w-full h-8 bg-components-input-bg-normal system-sm-regular radius-md border border-transparent appearance-none outline-none caret-primary-600 hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:bg-components-input-bg-active focus:border-components-input-border-active focus:shadow-xs placeholder:system-sm-regular placeholder:text-components-input-text-placeholder'
placeholder={t('workflow.env.modal.namePlaceholder') || ''}
value={name}
- onChange={e => handleNameChange(e.target.value)}
+ onChange={e => setName(e.target.value || '')}
+ onBlur={e => checkVariableName(e.target.value)}
type='text'
/>
From 0c38a8fdd43dd24f5daa5763a9a6f4e2acf823ca Mon Sep 17 00:00:00 2001
From: Nam Vu