fix: textual.suggestion 兼容老版 Textual + 升级最低版本约束
- textual.suggestion 在 Textual < 2.0 中不存在 - 添加 try/except fallback 构造兼容 Suggestion 类 - requirements.txt: textual>=0.40.0 → >=0.47.0 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,15 @@ from textual.containers import Container, ScrollableContainer, Horizontal
|
||||
from textual.widgets import Static, Input, Header, Footer, LoadingIndicator
|
||||
from textual.reactive import reactive
|
||||
from textual.suggester import Suggester
|
||||
from textual.suggestion import Suggestion
|
||||
|
||||
try:
|
||||
from textual.suggestion import Suggestion
|
||||
except ImportError:
|
||||
# Textual < 2.0 兼容 — 自行构造 Suggestion
|
||||
class Suggestion:
|
||||
__slots__ = ("value",)
|
||||
def __init__(self, value: str = ""):
|
||||
self.value = value
|
||||
from typing import List, Dict
|
||||
import asyncio
|
||||
from datetime import datetime
|
||||
|
||||
Reference in New Issue
Block a user