fix: 若干改进
This commit is contained in:
@@ -27,6 +27,7 @@ nucleon_dir = "./data/nucleon"
|
||||
electron_dir = "./data/electron"
|
||||
orbital_dir = "./data/orbital"
|
||||
cache_dir = "./data/cache"
|
||||
template_dir = "./data/template"
|
||||
|
||||
[services] # 定义服务到提供者的映射
|
||||
audio = "playsound" # 可选项: playsound(通用), termux(仅用于支持 Android Termux), mpg123(TODO)
|
||||
@@ -35,4 +36,4 @@ llm = "openai" # 可选项: openai
|
||||
|
||||
[providers.llm.openai] # 与 OpenAI 相容的语言模型接口服务设置
|
||||
url = ""
|
||||
key = ""
|
||||
key = ""
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from heurams.context import rootdir, workdir, config_var
|
||||
|
||||
from textual.app import App
|
||||
from textual.widgets import Button
|
||||
from .screens.dashboard import DashboardScreen
|
||||
@@ -48,6 +46,7 @@ def is_subdir(parent, child):
|
||||
return 0
|
||||
|
||||
# 开发模式
|
||||
from heurams.context import rootdir, workdir, config_var
|
||||
from pathlib import Path
|
||||
from heurams.context import rootdir
|
||||
import os
|
||||
|
||||
@@ -20,12 +20,23 @@ class NucleonCreatorScreen(Screen):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(name=None, id=None, classes=None)
|
||||
|
||||
def search_templates():
|
||||
from heurams.context import
|
||||
|
||||
def search_templates(self):
|
||||
with open('r','/template/t.timl'):
|
||||
pass
|
||||
from pathlib import Path
|
||||
from heurams.context import config_var
|
||||
template_dir = Path(config_var.get()['paths']['template_dir'])
|
||||
templates = list()
|
||||
for i in template_dir.iterdir():
|
||||
if i.name.endswith('.toml'):
|
||||
try:
|
||||
import toml
|
||||
with open('r', i) as f:
|
||||
dic = toml.load(f)
|
||||
desc = dic['__metadata__']['attribution']['desc']
|
||||
templates.append(desc + ' (' + i.name + ')')
|
||||
except:
|
||||
templates.append(f'无描述模板 ({i.name})')
|
||||
print(templates)
|
||||
return templates
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header(show_clock=True)
|
||||
|
||||
@@ -38,4 +38,4 @@ def probe_all(is_stem = 1):
|
||||
if __name__ == "__main__":
|
||||
import os
|
||||
print(os.getcwd())
|
||||
print(probe_all())
|
||||
print(probe_all())
|
||||
|
||||
Reference in New Issue
Block a user