diff --git a/swanlab/cli/commands/task/list.py b/swanlab/cli/commands/task/list.py index 8f845aa4..e924c8a5 100644 --- a/swanlab/cli/commands/task/list.py +++ b/swanlab/cli/commands/task/list.py @@ -110,11 +110,14 @@ def table(self): output_url = tlm.output.output_url if output_url is not None: output_url = Markdown(f"[{tlm.output.path}]({output_url})", justify="center") + url = tlm.url + if url is not None: + url = Markdown(f"[{tlm.project_name}]({url})", justify="center") st.add_row( tlm.cuid, tlm.name, status, - tlm.url, + url, output_url, tlm.output.size, tlm.started_at, diff --git a/swanlab/cli/commands/task/search.py b/swanlab/cli/commands/task/search.py index 68de27c1..87673372 100644 --- a/swanlab/cli/commands/task/search.py +++ b/swanlab/cli/commands/task/search.py @@ -62,7 +62,7 @@ def search(cuid): for dataset in data.get("datasets", []): console.print(f"[bold]Dataset ID:[/bold] [white]{dataset['cuid']}[/white]") - tm.url is not None and console.print(f"[bold]SwanLab URL:[/bold] {tm.url}") + tm.url is not None and console.print(Markdown(f"**SwanLab URL:** [{tm.project_name}]({tm.url})")) if tm.output.path is not None: console.print(Markdown(f"**Output URL**: [{tm.output.path}]({tm.output.output_url})")) console.print(f"[bold]Output Size:[/bold] {tm.output.size}") diff --git a/swanlab/cli/commands/task/utils.py b/swanlab/cli/commands/task/utils.py index 964c62f9..1c5439ce 100644 --- a/swanlab/cli/commands/task/utils.py +++ b/swanlab/cli/commands/task/utils.py @@ -93,13 +93,13 @@ def __init__(self, cuid: str, output: dict): @property def output_url(self): - """获取预签名的输出下载 url""" + """获取预签名的输出下载 url (过期时间 1 小时)""" if self.path is None: return None uploader = CosUploader() key = f"{uploader.prefix}/outputs/{self.path}" return uploader.client.get_presigned_download_url( - Bucket=uploader.bucket, Key=key, Params={'x-cos-security-token': uploader.token} + Bucket=uploader.bucket, Key=key, Params={'x-cos-security-token': uploader.token}, Expired=3600 ) @staticmethod