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:
qinglong
2026-06-13 11:15:09 +08:00
parent 249ef5d91e
commit 7518f4fd17
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
rich>=13.0.0
textual>=0.40.0
textual>=0.47.0
websockets>=12.0
aiohttp>=3.9.0
pyyaml>=6.0
+9 -1
View File
@@ -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