09cfde4de8
A blank composer is the least helpful thing a chat client can show someone who has just installed one. Three cards now sit under the empty state, and an administrator manages them at /admin/suggestions. Clicking a card fills the composer and stops there. It deliberately does not send: every default ends mid-sentence, because a card is a starting point rather than a question somebody already asked, and the caret lands where the person has to start typing. Seeding is guarded by a settings flag, not by "is the table empty" -- otherwise an administrator who decided against them would get all three back on every restart. Capped at twelve, six shown: past a dozen this is a menu, and a menu on the empty screen is a worse blank page than a blank page. The cards are gated on there being no chat at all, not on the thread being empty. An empty chat someone opened on purpose already has a model and a prompt chosen. Also fixes a pre-existing bug the position test caught. Both this and _refresh_models wrote `coalesce(max(position), -1) or -1`, and position 0 is falsy -- so the second row landed back on 0 on top of the first. The coalesce was already doing that job; the `or` was undoing it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
95 lines
1.8 KiB
Python
95 lines
1.8 KiB
Python
"""All ORM models.
|
|
|
|
Importing this package registers every table on ``Base.metadata``, which is
|
|
what ``init_db()`` relies on to create the schema at startup. Any new model
|
|
module must be imported here or its table will silently never be created.
|
|
"""
|
|
|
|
from lembas.db.models.attachment import (
|
|
KIND_DOCUMENT,
|
|
KIND_IMAGE,
|
|
KIND_TEXT,
|
|
Attachment,
|
|
)
|
|
from lembas.db.models.chat import (
|
|
ROLE_ASSISTANT,
|
|
ROLE_SYSTEM,
|
|
ROLE_TOOL,
|
|
ROLE_USER,
|
|
Chat,
|
|
Folder,
|
|
Message,
|
|
)
|
|
from lembas.db.models.connection import Connection, Model, model_groups
|
|
from lembas.db.models.library import (
|
|
AUTHOR_MODEL,
|
|
AUTHOR_USER,
|
|
PRINCIPAL_GROUP,
|
|
PRINCIPAL_USER,
|
|
RESOURCE_BASE,
|
|
RESOURCE_NOTE,
|
|
RESOURCE_SKILL,
|
|
SOURCE_LINK,
|
|
SOURCE_UPLOAD,
|
|
Document,
|
|
KnowledgeBase,
|
|
Memory,
|
|
Note,
|
|
Share,
|
|
Skill,
|
|
SkillRevision,
|
|
chat_knowledge_bases,
|
|
)
|
|
from lembas.db.models.setting import Setting
|
|
from lembas.db.models.suggestion import Suggestion
|
|
from lembas.db.models.user import (
|
|
ROLE_ADMIN,
|
|
ROLE_PENDING,
|
|
Group,
|
|
Session,
|
|
User,
|
|
user_groups,
|
|
)
|
|
|
|
__all__ = [
|
|
"AUTHOR_MODEL",
|
|
"AUTHOR_USER",
|
|
"Attachment",
|
|
"KIND_DOCUMENT",
|
|
"KIND_IMAGE",
|
|
"KIND_TEXT",
|
|
"PRINCIPAL_GROUP",
|
|
"PRINCIPAL_USER",
|
|
"RESOURCE_BASE",
|
|
"RESOURCE_NOTE",
|
|
"RESOURCE_SKILL",
|
|
"ROLE_ADMIN",
|
|
"ROLE_ASSISTANT",
|
|
"ROLE_PENDING",
|
|
"ROLE_SYSTEM",
|
|
"ROLE_TOOL",
|
|
"ROLE_USER",
|
|
"SOURCE_LINK",
|
|
"SOURCE_UPLOAD",
|
|
"Chat",
|
|
"Connection",
|
|
"Document",
|
|
"Folder",
|
|
"Group",
|
|
"KnowledgeBase",
|
|
"Memory",
|
|
"Message",
|
|
"Model",
|
|
"Note",
|
|
"Session",
|
|
"Setting",
|
|
"Share",
|
|
"Skill",
|
|
"SkillRevision",
|
|
"Suggestion",
|
|
"User",
|
|
"chat_knowledge_bases",
|
|
"model_groups",
|
|
"user_groups",
|
|
]
|