소스 검색

feat: display account name on the logs page for the apps (#7668)

Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
kurokobo 7 달 전
부모
커밋
d7aa4076c9

+ 2 - 0
api/fields/conversation_fields.py

@@ -111,6 +111,7 @@ conversation_fields = {
     "from_end_user_id": fields.String,
     "from_end_user_id": fields.String,
     "from_end_user_session_id": fields.String(),
     "from_end_user_session_id": fields.String(),
     "from_account_id": fields.String,
     "from_account_id": fields.String,
+    "from_account_name": fields.String,
     "read_at": TimestampField,
     "read_at": TimestampField,
     "created_at": TimestampField,
     "created_at": TimestampField,
     "annotation": fields.Nested(annotation_fields, allow_null=True),
     "annotation": fields.Nested(annotation_fields, allow_null=True),
@@ -146,6 +147,7 @@ conversation_with_summary_fields = {
     "from_end_user_id": fields.String,
     "from_end_user_id": fields.String,
     "from_end_user_session_id": fields.String,
     "from_end_user_session_id": fields.String,
     "from_account_id": fields.String,
     "from_account_id": fields.String,
+    "from_account_name": fields.String,
     "name": fields.String,
     "name": fields.String,
     "summary": fields.String(attribute="summary_or_query"),
     "summary": fields.String(attribute="summary_or_query"),
     "read_at": TimestampField,
     "read_at": TimestampField,

+ 9 - 1
api/models/model.py

@@ -490,7 +490,6 @@ class InstalledApp(db.Model):
         return tenant
         return tenant
 
 
 
 
-
 class Conversation(db.Model):
 class Conversation(db.Model):
     __tablename__ = 'conversations'
     __tablename__ = 'conversations'
     __table_args__ = (
     __table_args__ = (
@@ -624,6 +623,15 @@ class Conversation(db.Model):
         return None
         return None
 
 
     @property
     @property
+    def from_account_name(self):
+        if self.from_account_id:
+            account = db.session.query(Account).filter(Account.id == self.from_account_id).first()
+            if account:
+                return account.name
+
+        return None
+
+    @property
     def in_debug_mode(self):
     def in_debug_mode(self):
         return self.override_model_configs is not None
         return self.override_model_configs is not None
 
 

+ 1 - 1
web/app/components/app/log/list.tsx

@@ -678,7 +678,7 @@ const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh })
         </thead>
         </thead>
         <tbody className="text-gray-500">
         <tbody className="text-gray-500">
           {logs.data.map((log: any) => {
           {logs.data.map((log: any) => {
-            const endUser = log.from_end_user_session_id
+            const endUser = log.from_end_user_session_id || log.from_account_name
             const leftValue = get(log, isChatMode ? 'name' : 'message.inputs.query') || (!isChatMode ? (get(log, 'message.query') || get(log, 'message.inputs.default_input')) : '') || ''
             const leftValue = get(log, isChatMode ? 'name' : 'message.inputs.query') || (!isChatMode ? (get(log, 'message.query') || get(log, 'message.inputs.default_input')) : '') || ''
             const rightValue = get(log, isChatMode ? 'message_count' : 'message.answer')
             const rightValue = get(log, isChatMode ? 'message_count' : 'message.answer')
             return <tr
             return <tr

+ 1 - 1
web/app/components/app/workflow-log/list.tsx

@@ -91,7 +91,7 @@ const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
         </thead>
         </thead>
         <tbody className="text-gray-700 text-[13px]">
         <tbody className="text-gray-700 text-[13px]">
           {logs.data.map((log: WorkflowAppLogDetail) => {
           {logs.data.map((log: WorkflowAppLogDetail) => {
-            const endUser = log.created_by_end_user ? log.created_by_end_user.session_id : defaultValue
+            const endUser = log.created_by_end_user ? log.created_by_end_user.session_id : log.created_by_account ? log.created_by_account.name : defaultValue
             return <tr
             return <tr
               key={log.id}
               key={log.id}
               className={`border-b border-gray-200 h-8 hover:bg-gray-50 cursor-pointer ${currentLog?.id !== log.id ? '' : 'bg-gray-50'}`}
               className={`border-b border-gray-200 h-8 hover:bg-gray-50 cursor-pointer ${currentLog?.id !== log.id ? '' : 'bg-gray-50'}`}

+ 1 - 1
web/i18n/de-DE/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Aktualisierungszeit',
       updatedTime: 'Aktualisierungszeit',
       time: 'Erstellungszeit',
       time: 'Erstellungszeit',
-      endUser: 'Endbenutzer',
+      endUser: 'Endbenutzer oder Konto',
       input: 'Eingabe',
       input: 'Eingabe',
       output: 'Ausgabe',
       output: 'Ausgabe',
       summary: 'Titel',
       summary: 'Titel',

+ 2 - 2
web/i18n/en-US/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Updated time',
       updatedTime: 'Updated time',
       time: 'Created time',
       time: 'Created time',
-      endUser: 'End User',
+      endUser: 'End User or Account',
       input: 'Input',
       input: 'Input',
       output: 'Output',
       output: 'Output',
       summary: 'Title',
       summary: 'Title',
@@ -17,7 +17,7 @@ const translation = {
       status: 'STATUS',
       status: 'STATUS',
       runtime: 'RUN TIME',
       runtime: 'RUN TIME',
       tokens: 'TOKENS',
       tokens: 'TOKENS',
-      user: 'END-USER',
+      user: 'End User or Account',
       version: 'VERSION',
       version: 'VERSION',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/es-ES/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Hora actualizada',
       updatedTime: 'Hora actualizada',
       time: 'Hora creada',
       time: 'Hora creada',
-      endUser: 'Usuario Final',
+      endUser: 'Usuario Final o Cuenta',
       input: 'Entrada',
       input: 'Entrada',
       output: 'Salida',
       output: 'Salida',
       summary: 'Título',
       summary: 'Título',
@@ -17,7 +17,7 @@ const translation = {
       status: 'ESTADO',
       status: 'ESTADO',
       runtime: 'TIEMPO DE EJECUCIÓN',
       runtime: 'TIEMPO DE EJECUCIÓN',
       tokens: 'TOKENS',
       tokens: 'TOKENS',
-      user: 'USUARIO FINAL',
+      user: 'USUARIO FINAL O CUENTA',
       version: 'VERSIÓN',
       version: 'VERSIÓN',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/fa-IR/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'زمان به‌روزرسانی',
       updatedTime: 'زمان به‌روزرسانی',
       time: 'زمان ایجاد',
       time: 'زمان ایجاد',
-      endUser: 'کاربر نهایی',
+      endUser: 'کاربر نهایی یا حساب',
       input: 'ورودی',
       input: 'ورودی',
       output: 'خروجی',
       output: 'خروجی',
       summary: 'عنوان',
       summary: 'عنوان',
@@ -17,7 +17,7 @@ const translation = {
       status: 'وضعیت',
       status: 'وضعیت',
       runtime: 'زمان اجرا',
       runtime: 'زمان اجرا',
       tokens: 'توکن‌ها',
       tokens: 'توکن‌ها',
-      user: 'کاربر نهایی',
+      user: 'کاربر نهایی یا حساب',
       version: 'نسخه',
       version: 'نسخه',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/fr-FR/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Heure de mise à jour',
       updatedTime: 'Heure de mise à jour',
       time: 'Heure de création',
       time: 'Heure de création',
-      endUser: 'Utilisateur final',
+      endUser: 'Utilisateur final ou compte',
       input: 'Entrée',
       input: 'Entrée',
       output: 'Sortie',
       output: 'Sortie',
       summary: 'Titre',
       summary: 'Titre',
@@ -17,7 +17,7 @@ const translation = {
       status: 'STATUT',
       status: 'STATUT',
       runtime: 'TEMPS D\'EXÉCUTION',
       runtime: 'TEMPS D\'EXÉCUTION',
       tokens: 'JETONS',
       tokens: 'JETONS',
-      user: 'UTILISATEUR FINAL',
+      user: 'UTILISATEUR FINAL OU COMPTE',
       version: 'VERSION',
       version: 'VERSION',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/hi-IN/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'अपडेट का समय',
       updatedTime: 'अपडेट का समय',
       time: 'बनाने का समय',
       time: 'बनाने का समय',
-      endUser: 'अंतिम उपयोगकर्ता',
+      endUser: 'अंतिम उपयोगकर्ता या खाता',
       input: 'इनपुट',
       input: 'इनपुट',
       output: 'आउटपुट',
       output: 'आउटपुट',
       summary: 'शीर्षक',
       summary: 'शीर्षक',
@@ -17,7 +17,7 @@ const translation = {
       status: 'स्थिति',
       status: 'स्थिति',
       runtime: 'रन टाइम',
       runtime: 'रन टाइम',
       tokens: 'टोकन',
       tokens: 'टोकन',
-      user: 'अंतिम उपयोगकर्ता',
+      user: 'अंतिम उपयोगकर्ता या खाता',
       version: 'संस्करण',
       version: 'संस्करण',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/it-IT/app-log.ts

@@ -7,7 +7,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Ora di aggiornamento',
       updatedTime: 'Ora di aggiornamento',
       time: 'Ora di creazione',
       time: 'Ora di creazione',
-      endUser: 'Utente Finale',
+      endUser: 'Utente Finale o Account',
       input: 'Input',
       input: 'Input',
       output: 'Output',
       output: 'Output',
       summary: 'Titolo',
       summary: 'Titolo',
@@ -18,7 +18,7 @@ const translation = {
       status: 'STATO',
       status: 'STATO',
       runtime: 'TEMPO DI ESECUZIONE',
       runtime: 'TEMPO DI ESECUZIONE',
       tokens: 'TOKEN',
       tokens: 'TOKEN',
-      user: 'UTENTE FINALE',
+      user: 'UTENTE FINALE O ACCOUNT',
       version: 'VERSIONE',
       version: 'VERSIONE',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/ja-JP/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: '更新時間',
       updatedTime: '更新時間',
       time: '作成時間',
       time: '作成時間',
-      endUser: 'エンドユーザー',
+      endUser: 'エンドユーザーまたはアカウント',
       input: '入力',
       input: '入力',
       output: '出力',
       output: '出力',
       summary: 'タイトル',
       summary: 'タイトル',
@@ -17,7 +17,7 @@ const translation = {
       status: 'ステータス',
       status: 'ステータス',
       runtime: 'ランタイム',
       runtime: 'ランタイム',
       tokens: 'トークン',
       tokens: 'トークン',
-      user: 'エンドユーザー',
+      user: 'エンドユーザーまたはアカウント',
       version: 'バージョン',
       version: 'バージョン',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/ko-KR/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: '업데이트 시간',
       updatedTime: '업데이트 시간',
       time: '생성 시간',
       time: '생성 시간',
-      endUser: '엔드 유저',
+      endUser: '엔드 유저 또는 계정',
       input: '입력',
       input: '입력',
       output: '출력',
       output: '출력',
       summary: '요약',
       summary: '요약',
@@ -17,7 +17,7 @@ const translation = {
       status: '상태',
       status: '상태',
       runtime: '실행 시간',
       runtime: '실행 시간',
       tokens: '토큰',
       tokens: '토큰',
-      user: '엔드 유저',
+      user: '엔드 유저 또는 계정',
       version: '버전',
       version: '버전',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/pl-PL/app-log.ts

@@ -7,7 +7,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Czas aktualizacji',
       updatedTime: 'Czas aktualizacji',
       time: 'Czas utworzenia',
       time: 'Czas utworzenia',
-      endUser: 'Użytkownik końcowy',
+      endUser: 'Użytkownik końcowy lub konto',
       input: 'Wejście',
       input: 'Wejście',
       output: 'Wyjście',
       output: 'Wyjście',
       summary: 'Tytuł',
       summary: 'Tytuł',
@@ -18,7 +18,7 @@ const translation = {
       status: 'STATUS',
       status: 'STATUS',
       runtime: 'CZAS DZIAŁANIA',
       runtime: 'CZAS DZIAŁANIA',
       tokens: 'TOKENY',
       tokens: 'TOKENY',
-      user: 'UŻYTKOWNIK KOŃCOWY',
+      user: 'UŻYTKOWNIK KOŃCOWY LUB KONTO',
       version: 'WERSJA',
       version: 'WERSJA',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/pt-BR/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Hora de atualização',
       updatedTime: 'Hora de atualização',
       time: 'Hora de criação',
       time: 'Hora de criação',
-      endUser: 'Usuário Final',
+      endUser: 'Usuário final ou conta',
       input: 'Entrada',
       input: 'Entrada',
       output: 'Saída',
       output: 'Saída',
       summary: 'Título',
       summary: 'Título',
@@ -17,7 +17,7 @@ const translation = {
       status: 'STATUS',
       status: 'STATUS',
       runtime: 'TEMPO DE EXECUÇÃO',
       runtime: 'TEMPO DE EXECUÇÃO',
       tokens: 'TOKENS',
       tokens: 'TOKENS',
-      user: 'USUÁRIO FINAL',
+      user: 'USUÁRIO FINAL OU CONTA',
       version: 'VERSÃO',
       version: 'VERSÃO',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/ro-RO/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Timp actualizare',
       updatedTime: 'Timp actualizare',
       time: 'Timp creare',
       time: 'Timp creare',
-      endUser: 'Utilizator final',
+      endUser: 'Utilizator final sau cont',
       input: 'Intrare',
       input: 'Intrare',
       output: 'Ieșire',
       output: 'Ieșire',
       summary: 'Titlu',
       summary: 'Titlu',
@@ -17,7 +17,7 @@ const translation = {
       status: 'STARE',
       status: 'STARE',
       runtime: 'TIMP DE RULARE',
       runtime: 'TIMP DE RULARE',
       tokens: 'JETOANE',
       tokens: 'JETOANE',
-      user: 'UTILIZATOR FINAL',
+      user: 'UTILIZATOR FINAL SAU CONT',
       version: 'VERSIUNE',
       version: 'VERSIUNE',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/tr-TR/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Güncellenme zamanı',
       updatedTime: 'Güncellenme zamanı',
       time: 'Oluşturulma zamanı',
       time: 'Oluşturulma zamanı',
-      endUser: 'Son Kullanıcı',
+      endUser: 'Son Kullanıcı veya Hesap',
       input: 'Girdi',
       input: 'Girdi',
       output: 'Çıktı',
       output: 'Çıktı',
       summary: 'Başlık',
       summary: 'Başlık',
@@ -17,7 +17,7 @@ const translation = {
       status: 'DURUM',
       status: 'DURUM',
       runtime: 'ÇALIŞMA SÜRESİ',
       runtime: 'ÇALIŞMA SÜRESİ',
       tokens: 'TOKENLAR',
       tokens: 'TOKENLAR',
-      user: 'SON KULLANICI',
+      user: 'SON KULLANICI VEYA HESAP',
       version: 'VERSİYON',
       version: 'VERSİYON',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/uk-UA/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Час оновлення',
       updatedTime: 'Час оновлення',
       time: 'Час створення',
       time: 'Час створення',
-      endUser: 'Кінцевий Користувач',
+      endUser: 'Кінцевий Користувач або Обліковий Запис',
       input: 'Введення',
       input: 'Введення',
       output: 'Виведення',
       output: 'Виведення',
       summary: 'Заголовок',
       summary: 'Заголовок',
@@ -17,7 +17,7 @@ const translation = {
       status: 'СТАТУС',
       status: 'СТАТУС',
       runtime: 'ЧАС ВИКОНАННЯ',
       runtime: 'ЧАС ВИКОНАННЯ',
       tokens: 'ТОКЕНИ',
       tokens: 'ТОКЕНИ',
-      user: 'КІНЦЕВИЙ КОРИСТУВАЧ',
+      user: 'КІНЦЕВИЙ КОРИСТУВАЧ АБО ОБЛІКОВИЙ ЗАПИС',
       version: 'ВЕРСІЯ',
       version: 'ВЕРСІЯ',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/vi-VN/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: 'Thời gian cập nhật',
       updatedTime: 'Thời gian cập nhật',
       time: 'Thời gian tạo',
       time: 'Thời gian tạo',
-      endUser: 'Người dùng cuối',
+      endUser: 'Người dùng cuối hoặc tài khoản',
       input: 'Đầu vào',
       input: 'Đầu vào',
       output: 'Đầu ra',
       output: 'Đầu ra',
       summary: 'Tóm tắt',
       summary: 'Tóm tắt',
@@ -17,7 +17,7 @@ const translation = {
       status: 'TRẠNG THÁI',
       status: 'TRẠNG THÁI',
       runtime: 'THỜI GIAN CHẠY',
       runtime: 'THỜI GIAN CHẠY',
       tokens: 'TOKEN',
       tokens: 'TOKEN',
-      user: 'NGƯỜI DÙNG CUỐI',
+      user: 'NGƯỜI DÙNG CUỐI HOẶC TÀI KHOẢN',
       version: 'PHIÊN BẢN',
       version: 'PHIÊN BẢN',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/zh-Hans/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: '更新时间',
       updatedTime: '更新时间',
       time: '创建时间',
       time: '创建时间',
-      endUser: '用户',
+      endUser: '用户或账户',
       input: '输入',
       input: '输入',
       output: '输出',
       output: '输出',
       summary: '标题',
       summary: '标题',
@@ -17,7 +17,7 @@ const translation = {
       status: '状态',
       status: '状态',
       runtime: '运行时间',
       runtime: '运行时间',
       tokens: 'TOKENS',
       tokens: 'TOKENS',
-      user: '用户',
+      user: '用户或账户',
       version: '版本',
       version: '版本',
     },
     },
     pagination: {
     pagination: {

+ 2 - 2
web/i18n/zh-Hant/app-log.ts

@@ -6,7 +6,7 @@ const translation = {
     header: {
     header: {
       updatedTime: '更新時間',
       updatedTime: '更新時間',
       time: '創建時間',
       time: '創建時間',
-      endUser: '使用者',
+      endUser: '使用者或賬戶',
       input: '輸入',
       input: '輸入',
       output: '輸出',
       output: '輸出',
       summary: '標題',
       summary: '標題',
@@ -17,7 +17,7 @@ const translation = {
       status: '狀態',
       status: '狀態',
       runtime: '執行時間',
       runtime: '執行時間',
       tokens: 'TOKENS',
       tokens: 'TOKENS',
-      user: '使用者',
+      user: '使用者或賬戶',
       version: '版本',
       version: '版本',
     },
     },
     pagination: {
     pagination: {