Skip to content

Commit

Permalink
feat: display account name on the logs page for the apps (#7668)
Browse files Browse the repository at this point in the history
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
  • Loading branch information
kurokobo and crazywoola authored Aug 27, 2024
1 parent 122ce41 commit d7aa407
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 36 deletions.
2 changes: 2 additions & 0 deletions api/fields/conversation_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def format(self, value):
"from_end_user_id": fields.String,
"from_end_user_session_id": fields.String(),
"from_account_id": fields.String,
"from_account_name": fields.String,
"read_at": TimestampField,
"created_at": TimestampField,
"annotation": fields.Nested(annotation_fields, allow_null=True),
Expand Down Expand Up @@ -146,6 +147,7 @@ def format(self, value):
"from_end_user_id": fields.String,
"from_end_user_session_id": fields.String,
"from_account_id": fields.String,
"from_account_name": fields.String,
"name": fields.String,
"summary": fields.String(attribute="summary_or_query"),
"read_at": TimestampField,
Expand Down
10 changes: 9 additions & 1 deletion api/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ def tenant(self):
return tenant



class Conversation(db.Model):
__tablename__ = 'conversations'
__table_args__ = (
Expand Down Expand Up @@ -623,6 +622,15 @@ def from_end_user_session_id(self):

return None

@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):
return self.override_model_configs is not None
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/app/log/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh })
</thead>
<tbody className="text-gray-500">
{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 rightValue = get(log, isChatMode ? 'message_count' : 'message.answer')
return <tr
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/app/workflow-log/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
</thead>
<tbody className="text-gray-700 text-[13px]">
{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
key={log.id}
className={`border-b border-gray-200 h-8 hover:bg-gray-50 cursor-pointer ${currentLog?.id !== log.id ? '' : 'bg-gray-50'}`}
Expand Down
2 changes: 1 addition & 1 deletion web/i18n/de-DE/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Aktualisierungszeit',
time: 'Erstellungszeit',
endUser: 'Endbenutzer',
endUser: 'Endbenutzer oder Konto',
input: 'Eingabe',
output: 'Ausgabe',
summary: 'Titel',
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/en-US/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Updated time',
time: 'Created time',
endUser: 'End User',
endUser: 'End User or Account',
input: 'Input',
output: 'Output',
summary: 'Title',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'STATUS',
runtime: 'RUN TIME',
tokens: 'TOKENS',
user: 'END-USER',
user: 'End User or Account',
version: 'VERSION',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/es-ES/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Hora actualizada',
time: 'Hora creada',
endUser: 'Usuario Final',
endUser: 'Usuario Final o Cuenta',
input: 'Entrada',
output: 'Salida',
summary: 'Título',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'ESTADO',
runtime: 'TIEMPO DE EJECUCIÓN',
tokens: 'TOKENS',
user: 'USUARIO FINAL',
user: 'USUARIO FINAL O CUENTA',
version: 'VERSIÓN',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/fa-IR/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'زمان به‌روزرسانی',
time: 'زمان ایجاد',
endUser: 'کاربر نهایی',
endUser: 'کاربر نهایی یا حساب',
input: 'ورودی',
output: 'خروجی',
summary: 'عنوان',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'وضعیت',
runtime: 'زمان اجرا',
tokens: 'توکن‌ها',
user: 'کاربر نهایی',
user: 'کاربر نهایی یا حساب',
version: 'نسخه',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/fr-FR/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Heure de mise à jour',
time: 'Heure de création',
endUser: 'Utilisateur final',
endUser: 'Utilisateur final ou compte',
input: 'Entrée',
output: 'Sortie',
summary: 'Titre',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'STATUT',
runtime: 'TEMPS D\'EXÉCUTION',
tokens: 'JETONS',
user: 'UTILISATEUR FINAL',
user: 'UTILISATEUR FINAL OU COMPTE',
version: 'VERSION',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/hi-IN/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'अपडेट का समय',
time: 'बनाने का समय',
endUser: 'अंतिम उपयोगकर्ता',
endUser: 'अंतिम उपयोगकर्ता या खाता',
input: 'इनपुट',
output: 'आउटपुट',
summary: 'शीर्षक',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'स्थिति',
runtime: 'रन टाइम',
tokens: 'टोकन',
user: 'अंतिम उपयोगकर्ता',
user: 'अंतिम उपयोगकर्ता या खाता',
version: 'संस्करण',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/it-IT/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const translation = {
header: {
updatedTime: 'Ora di aggiornamento',
time: 'Ora di creazione',
endUser: 'Utente Finale',
endUser: 'Utente Finale o Account',
input: 'Input',
output: 'Output',
summary: 'Titolo',
Expand All @@ -18,7 +18,7 @@ const translation = {
status: 'STATO',
runtime: 'TEMPO DI ESECUZIONE',
tokens: 'TOKEN',
user: 'UTENTE FINALE',
user: 'UTENTE FINALE O ACCOUNT',
version: 'VERSIONE',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/ja-JP/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: '更新時間',
time: '作成時間',
endUser: 'エンドユーザー',
endUser: 'エンドユーザーまたはアカウント',
input: '入力',
output: '出力',
summary: 'タイトル',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'ステータス',
runtime: 'ランタイム',
tokens: 'トークン',
user: 'エンドユーザー',
user: 'エンドユーザーまたはアカウント',
version: 'バージョン',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/ko-KR/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: '업데이트 시간',
time: '생성 시간',
endUser: '엔드 유저',
endUser: '엔드 유저 또는 계정',
input: '입력',
output: '출력',
summary: '요약',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: '상태',
runtime: '실행 시간',
tokens: '토큰',
user: '엔드 유저',
user: '엔드 유저 또는 계정',
version: '버전',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/pl-PL/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const translation = {
header: {
updatedTime: 'Czas aktualizacji',
time: 'Czas utworzenia',
endUser: 'Użytkownik końcowy',
endUser: 'Użytkownik końcowy lub konto',
input: 'Wejście',
output: 'Wyjście',
summary: 'Tytuł',
Expand All @@ -18,7 +18,7 @@ const translation = {
status: 'STATUS',
runtime: 'CZAS DZIAŁANIA',
tokens: 'TOKENY',
user: 'UŻYTKOWNIK KOŃCOWY',
user: 'UŻYTKOWNIK KOŃCOWY LUB KONTO',
version: 'WERSJA',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/pt-BR/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Hora de atualização',
time: 'Hora de criação',
endUser: 'Usuário Final',
endUser: 'Usuário final ou conta',
input: 'Entrada',
output: 'Saída',
summary: 'Título',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'STATUS',
runtime: 'TEMPO DE EXECUÇÃO',
tokens: 'TOKENS',
user: 'USUÁRIO FINAL',
user: 'USUÁRIO FINAL OU CONTA',
version: 'VERSÃO',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/ro-RO/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Timp actualizare',
time: 'Timp creare',
endUser: 'Utilizator final',
endUser: 'Utilizator final sau cont',
input: 'Intrare',
output: 'Ieșire',
summary: 'Titlu',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'STARE',
runtime: 'TIMP DE RULARE',
tokens: 'JETOANE',
user: 'UTILIZATOR FINAL',
user: 'UTILIZATOR FINAL SAU CONT',
version: 'VERSIUNE',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/tr-TR/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Güncellenme zamanı',
time: 'Oluşturulma zamanı',
endUser: 'Son Kullanıcı',
endUser: 'Son Kullanıcı veya Hesap',
input: 'Girdi',
output: 'Çıktı',
summary: 'Başlık',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'DURUM',
runtime: 'ÇALIŞMA SÜRESİ',
tokens: 'TOKENLAR',
user: 'SON KULLANICI',
user: 'SON KULLANICI VEYA HESAP',
version: 'VERSİYON',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/uk-UA/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Час оновлення',
time: 'Час створення',
endUser: 'Кінцевий Користувач',
endUser: 'Кінцевий Користувач або Обліковий Запис',
input: 'Введення',
output: 'Виведення',
summary: 'Заголовок',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'СТАТУС',
runtime: 'ЧАС ВИКОНАННЯ',
tokens: 'ТОКЕНИ',
user: 'КІНЦЕВИЙ КОРИСТУВАЧ',
user: 'КІНЦЕВИЙ КОРИСТУВАЧ АБО ОБЛІКОВИЙ ЗАПИС',
version: 'ВЕРСІЯ',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/vi-VN/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: 'Thời gian cập nhật',
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',
output: 'Đầu ra',
summary: 'Tóm tắt',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: 'TRẠNG THÁI',
runtime: 'THỜI GIAN CHẠY',
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',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/zh-Hans/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: '更新时间',
time: '创建时间',
endUser: '用户',
endUser: '用户或账户',
input: '输入',
output: '输出',
summary: '标题',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: '状态',
runtime: '运行时间',
tokens: 'TOKENS',
user: '用户',
user: '用户或账户',
version: '版本',
},
pagination: {
Expand Down
4 changes: 2 additions & 2 deletions web/i18n/zh-Hant/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const translation = {
header: {
updatedTime: '更新時間',
time: '創建時間',
endUser: '使用者',
endUser: '使用者或賬戶',
input: '輸入',
output: '輸出',
summary: '標題',
Expand All @@ -17,7 +17,7 @@ const translation = {
status: '狀態',
runtime: '執行時間',
tokens: 'TOKENS',
user: '使用者',
user: '使用者或賬戶',
version: '版本',
},
pagination: {
Expand Down

0 comments on commit d7aa407

Please sign in to comment.