Skip to content

Commit cc90860

Browse files
zhanglongbinHaiHui886
authored andcommitted
Fix the bug of dataflow with ID OpenCSGs/csghub-dataflow#80OpenCSGs/csghub-dataflow#83
1 parent f377507 commit cc90860

File tree

9 files changed

+586
-25
lines changed

9 files changed

+586
-25
lines changed

label_studio/core/views.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,10 @@ def collect_metrics(request):
282282
def system_config(request):
283283
"""Proxy endpoint to fetch system config from external API"""
284284
try:
285-
# 从session或请求参数中获取origin
286-
origin = request.session.get('origin') or request.GET.get('origin')
287-
288-
# 构建API URL
289-
if origin:
290-
# 确保origin以/结尾,然后拼接接口路径
291-
origin = origin.rstrip('/')
292-
api_url = f"{origin}/internal_api/system_config"
293-
else:
294-
# 如果没有origin,使用默认URL
295-
api_url = 'https://opencsg.com/internal_api/system_config'
296-
297285
# 调用外部API
298-
response = requests.get(api_url)
286+
response = requests.get(
287+
'https://opencsg-stg.com/internal_api/system_config'
288+
)
299289
response.raise_for_status()
300290

301291
# 返回JSON响应

label_studio/log/label_studio.log

Lines changed: 439 additions & 0 deletions
Large diffs are not rendered by default.

label_studio/users/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,12 @@ def reset_token(self) -> Token:
222222

223223
def get_initials(self, is_deleted=False):
224224
initials = '?'
225-
225+
print(self.user_name)
226226
if is_deleted:
227227
return 'DU'
228-
229-
if not self.first_name and not self.last_name:
228+
if self.user_name :
229+
initials = self.user_name[0:2]
230+
elif self.first_name and not self.last_name:
230231
initials = self.email[0:2]
231232
elif self.first_name and not self.last_name:
232233
initials = self.first_name[0:1]

label_studio/users/views.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,6 @@ def login_reques(request):
445445
# 将语言保存到session中
446446
request.session['language'] = language
447447
origin = request.GET.get('origin') # 获取origin参数
448-
# 将origin保存到session中,供后续接口使用
449-
if origin:
450-
request.session['origin'] = origin
451448
user = request.user
452449
# 设置默认重定向页面
453450
if not next_page or not url_has_allowed_host_and_scheme(url=next_page, allowed_hosts=request.get_host()):

web/apps/labelstudio/src/components/Menubar/Menubar.jsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ export const Menubar = ({
103103
const contextItem = menubarClass.elem("context-item");
104104
const showNewsletterDot = !isDefined(user?.allow_newsletters);
105105

106+
// 获取用户显示名称:优先使用user_name,其次username,最后邮箱
107+
const userDisplayName = useMemo(() => {
108+
if (!user) return "";
109+
if (user.user_name) {
110+
return user.user_name;
111+
}
112+
if (user.username) {
113+
return user.username;
114+
}
115+
return user.email || "";
116+
}, [user]);
117+
106118
const handleLanguageChange = useCallback((lang) => {
107119
i18n.changeLanguage(lang);
108120
langMenuRef.current?.close();
@@ -363,14 +375,14 @@ export const Menubar = ({
363375
</Menu>
364376
}
365377
>
366-
<div title={user?.email} className={menubarClass.elem("user")}>
378+
<div title={userDisplayName} className={menubarClass.elem("user")}>
367379
<Userpic user={user} isInProgress={isInProgress} />
368380
{showNewsletterDot && (
369381
<div className={menubarClass.elem("userpic-badge")} />
370382
)}
371383
</div>
372384
</Dropdown.Trigger> */}
373-
<div title={user?.email} className={menubarClass.elem("user")}>
385+
<div title={userDisplayName} className={menubarClass.elem("user")}>
374386
<Userpic user={user} isInProgress={isInProgress} />
375387
{showNewsletterDot && (
376388
<div className={menubarClass.elem("userpic-badge")} />

web/apps/labelstudio/src/locales/en.json

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,65 @@
481481
"Simple object detection": "Simple object detection",
482482
"Sample config to label with bboxes": "Sample config to label with bboxes",
483483
"You can configure labels and their colors": "You can configure labels and their colors",
484-
"Select label and click on image to start": "Select label and click on image to start"
484+
"Select label and click on image to start": "Select label and click on image to start",
485+
"Speech Transcription": "Speech Transcription",
486+
"Signal Quality Detection": "Signal Quality Detection",
487+
"Automatic Speech Recognition": "Automatic Speech Recognition",
488+
"Sound Event Detection": "Sound Event Detection",
489+
"Automatic Speech Recognition using Segments": "Automatic Speech Recognition using Segments",
490+
"Speaker Segmentation": "Speaker Segmentation",
491+
"Intent Classification": "Intent Classification",
492+
"Conversational Analysis": "Conversational Analysis",
493+
"Intent Classification and Slot Filling": "Intent Classification and Slot Filling",
494+
"Response Generation": "Response Generation",
495+
"Response Selection": "Response Selection",
496+
"Coreference Resolution & Entity Linking": "Coreference Resolution & Entity Linking",
497+
"Chatbot Model Assessment": "Chatbot Model Assessment",
498+
"LLM Response Grading": "LLM Response Grading",
499+
"Supervised Language Model Fine-tuning": "Supervised Language Model Fine-tuning",
500+
"Visual Ranker": "Visual Ranker",
501+
"Human Preference collection for RLHF": "Human Preference collection for RLHF",
502+
"LLM Ranker": "LLM Ranker",
503+
"Question Answering": "Question Answering",
504+
"Content Moderation": "Content Moderation",
505+
"Text Classification": "Text Classification",
506+
"Relation Extraction": "Relation Extraction",
507+
"Taxonomy": "Taxonomy",
508+
"Machine Translation": "Machine Translation",
509+
"Text Summarization": "Text Summarization",
510+
"Named Entity Recognition": "Named Entity Recognition",
511+
"Pairwise classification": "Pairwise classification",
512+
"ASR Hypotheses Selection": "ASR Hypotheses Selection",
513+
"Text-to-Image Generation": "Text-to-Image Generation",
514+
"Pairwise regression": "Pairwise regression",
515+
"Document Retrieval": "Document Retrieval",
516+
"Content-based Image Retrieval": "Content-based Image Retrieval",
517+
"Search Page Ranking": "Search Page Ranking",
518+
"Time Series Forecasting": "Time Series Forecasting",
519+
"Activity Recognition": "Activity Recognition",
520+
"Signal Quality": "Signal Quality",
521+
"Change Point Detection": "Change Point Detection",
522+
"Outliers & Anomaly Detection": "Outliers & Anomaly Detection",
523+
"HTML Entity Recognition": "HTML Entity Recognition",
524+
"Tabular Data": "Tabular Data",
525+
"PDF Classification": "PDF Classification",
526+
"Freeform Metadata": "Freeform Metadata",
527+
"Video Object Tracking": "Video Object Tracking",
528+
"Video Frame Classification": "Video Frame Classification",
529+
"Video Classification": "Video Classification",
530+
"Video Timeline Segmentation": "Video Timeline Segmentation",
531+
"Keypoint Labeling": "Keypoint Labeling",
532+
"Inventory Tracking": "Inventory Tracking",
533+
"Image Classification": "Image Classification",
534+
"Semantic Segmentation with Masks": "Semantic Segmentation with Masks",
535+
"Optical Character Recognition": "Optical Character Recognition",
536+
"Visual Genome": "Visual Genome",
537+
"Semantic Segmentation with Polygons": "Semantic Segmentation with Polygons",
538+
"Visual Question Answering": "Visual Question Answering",
539+
"Medical Image Classification with Bounding Boxes": "Medical Image Classification with Bounding Boxes",
540+
"Image Captioning": "Image Captioning",
541+
"Object Detection with Bounding Boxes": "Object Detection with Bounding Boxes",
542+
"Multi-page document annotation": "Multi-page document annotation"
485543
},
486544
"uiPreview": "UI Preview"
487545
},

web/apps/labelstudio/src/locales/zh.json

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,65 @@
481481
"Simple object detection": "简单目标检测",
482482
"Sample config to label with bboxes": "使用边界框标注的示例配置",
483483
"You can configure labels and their colors": "您可以配置标签及其颜色",
484-
"Select label and click on image to start": "选择标签并点击图像开始"
484+
"Select label and click on image to start": "选择标签并点击图像开始",
485+
"Speech Transcription": "语音转录",
486+
"Signal Quality Detection": "信号质量检测",
487+
"Automatic Speech Recognition": "自动语音识别",
488+
"Sound Event Detection": "声音事件检测",
489+
"Automatic Speech Recognition using Segments": "基于片段的自动语音识别",
490+
"Speaker Segmentation": "说话人分割",
491+
"Intent Classification": "意图分类",
492+
"Conversational Analysis": "对话分析",
493+
"Intent Classification and Slot Filling": "意图分类与槽填充",
494+
"Response Generation": "回复生成",
495+
"Response Selection": "回复选择",
496+
"Coreference Resolution & Entity Linking": "共指消解与实体链接",
497+
"Chatbot Model Assessment": "聊天机器人模型评估",
498+
"LLM Response Grading": "大语言模型回复评分",
499+
"Supervised Language Model Fine-tuning": "监督式语言模型微调",
500+
"Visual Ranker": "视觉排序器",
501+
"Human Preference collection for RLHF": "人类偏好收集(用于RLHF)",
502+
"LLM Ranker": "大语言模型排序器",
503+
"Question Answering": "问答",
504+
"Content Moderation": "内容审核",
505+
"Text Classification": "文本分类",
506+
"Relation Extraction": "关系抽取",
507+
"Taxonomy": "分类法",
508+
"Machine Translation": "机器翻译",
509+
"Text Summarization": "文本摘要",
510+
"Named Entity Recognition": "命名实体识别",
511+
"Pairwise classification": "成对分类",
512+
"ASR Hypotheses Selection": "ASR假设选择",
513+
"Text-to-Image Generation": "文本到图像生成",
514+
"Pairwise regression": "成对回归",
515+
"Document Retrieval": "文档检索",
516+
"Content-based Image Retrieval": "基于内容的图像检索",
517+
"Search Page Ranking": "搜索结果页排序",
518+
"Time Series Forecasting": "时间序列预测",
519+
"Activity Recognition": "活动识别",
520+
"Signal Quality": "信号质量",
521+
"Change Point Detection": "变化点检测",
522+
"Outliers & Anomaly Detection": "异常值检测",
523+
"HTML Entity Recognition": "HTML实体识别",
524+
"Tabular Data": "表格数据",
525+
"PDF Classification": "PDF分类",
526+
"Freeform Metadata": "自由格式元数据",
527+
"Video Object Tracking": "视频目标跟踪",
528+
"Video Frame Classification": "视频帧分类",
529+
"Video Classification": "视频分类",
530+
"Video Timeline Segmentation": "视频时间线分割",
531+
"Keypoint Labeling": "关键点标注",
532+
"Inventory Tracking": "库存跟踪",
533+
"Image Classification": "图像分类",
534+
"Semantic Segmentation with Masks": "基于掩码的语义分割",
535+
"Optical Character Recognition": "光学字符识别",
536+
"Visual Genome": "视觉基因组",
537+
"Semantic Segmentation with Polygons": "基于多边形的语义分割",
538+
"Visual Question Answering": "视觉问答",
539+
"Medical Image Classification with Bounding Boxes": "医学图像分类(带边界框)",
540+
"Image Captioning": "图像字幕生成",
541+
"Object Detection with Bounding Boxes": "目标检测(带边界框)",
542+
"Multi-page document annotation": "多页文档标注"
485543
},
486544
"uiPreview": "界面预览"
487545
},

web/libs/core/src/lib/hooks/usePersistentState.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { renderHook, act } from "@testing-library/react-hooks";
1+
import { renderHook, act } from "@testing-library/react";
22
import { usePersistentState, usePersistentJSONState } from "./usePersistentState";
33

44
describe("usePersistentState", () => {

web/libs/ui/src/lib/Userpic/Userpic.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ export const Userpic = forwardRef(
6868
}
6969

7070
const displayName = useMemo(() => {
71-
return userDisplayName(user ?? userRef.current);
71+
const curUser = user ?? userRef.current;
72+
// 优先使用 user_name 字段
73+
if (curUser?.user_name) {
74+
return curUser.user_name;
75+
}
76+
// 如果没有 user_name,使用 userDisplayName 作为后备
77+
return userDisplayName(curUser);
7278
}, [user]);
7379

7480
const background = useMemo(() => {

0 commit comments

Comments
 (0)