mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
perf(ollama): 优化命令显示细节
This commit is contained in:
parent
3dc413638b
commit
7c06141ce2
|
@ -21,8 +21,8 @@ class OllamaOperator(operator.CommandOperator):
|
|||
for model in model_list:
|
||||
content += f"name: {model['name']}\n"
|
||||
content += f"modified_at: {model['modified_at']}\n"
|
||||
content += f"size: {bytes_to_mb(model['size'])}mb\n\n"
|
||||
yield entities.CommandReturn(text=f"{content}")
|
||||
content += f"size: {bytes_to_mb(model['size'])}MB\n\n"
|
||||
yield entities.CommandReturn(text=f"{content.strip()}")
|
||||
|
||||
|
||||
def bytes_to_mb(num_bytes):
|
||||
|
@ -56,7 +56,7 @@ class OllamaShowOperator(operator.CommandOperator):
|
|||
except ollama.ResponseError as e:
|
||||
content = f"{e.error}"
|
||||
|
||||
yield entities.CommandReturn(text=content)
|
||||
yield entities.CommandReturn(text=content.strip())
|
||||
|
||||
|
||||
@operator.operator_class(
|
||||
|
@ -93,7 +93,7 @@ class OllamaPullOperator(operator.CommandOperator):
|
|||
if percentage_completed > progress_count:
|
||||
progress_count += 10
|
||||
yield entities.CommandReturn(
|
||||
text=f"下载进度: {completed}/{total} = {percentage_completed:.2f}%")
|
||||
text=f"下载进度: {completed}/{total} ({percentage_completed:.2f}%)")
|
||||
except ollama.ResponseError as e:
|
||||
yield entities.CommandReturn(text=f"拉取失败: {e.error}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user