fix: resolve RealtimeOutput import error by moving to utils package

Python prefers packages over modules, causing imports to resolve to
gui/utils/__init__.py instead of gui/utils.py. Moved RealtimeOutput
class into the utils package to fix the ImportError.

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-02-26 19:42:20 +08:00
parent f715cb97e3
commit 950e30fef0
2 changed files with 4 additions and 4 deletions

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
实时输出流模块
"""
class RealtimeOutput:
"""实时输出流,每次写入立即回调通知"""
def __init__(self, callback):
"""
初始化实时输出流
Args:
callback: 写入时的回调函数,接收文本内容
"""
self.callback = callback
self.buffer = []
def write(self, text):
"""写入文本"""
if text:
# 将文本按行分割,逐行回调
lines = text.split("\n")
for line in lines:
if line: # 忽略空行(由 split 产生)
self.callback(line)
return len(text)
def flush(self):
"""刷新(兼容性方法)"""
pass
def isatty(self):
"""返回 False表示不是终端"""
return False