加入「拾绪」:心情说说 + 小拾 AI 评论
- 新增 moments 应用:Moment / MomentImage / MomentComment 及迁移 - 7 种心情、文字 + 最多 4 张图片、心情筛选 - 发布时调用本地 Ollama,以「小拾」人设自动评论 - 支持「让小拾再说一句」,每条最多 6 条 AI 回应 - 写操作复用拾匣密码;首页新增「拾绪」入口 - explore/llm.py 增加通用 chat_text 与超时参数
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Moment, MomentComment, MomentImage
|
||||
|
||||
|
||||
class MomentImageInline(admin.TabularInline):
|
||||
model = MomentImage
|
||||
extra = 0
|
||||
fields = ("image", "created_at")
|
||||
readonly_fields = ("created_at",)
|
||||
|
||||
|
||||
class MomentCommentInline(admin.TabularInline):
|
||||
model = MomentComment
|
||||
extra = 0
|
||||
fields = ("author", "content", "is_ai", "created_at")
|
||||
readonly_fields = ("created_at",)
|
||||
|
||||
|
||||
@admin.register(Moment)
|
||||
class MomentAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "short_content", "mood", "created_at", "comment_count")
|
||||
list_filter = ("mood", "created_at")
|
||||
search_fields = ("content",)
|
||||
inlines = [MomentImageInline, MomentCommentInline]
|
||||
|
||||
@admin.display(description="内容")
|
||||
def short_content(self, obj):
|
||||
return obj.content[:60]
|
||||
|
||||
@admin.display(description="评论")
|
||||
def comment_count(self, obj):
|
||||
return obj.comments.count()
|
||||
|
||||
|
||||
@admin.register(MomentComment)
|
||||
class MomentCommentAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "post", "author", "is_ai", "created_at")
|
||||
list_filter = ("is_ai", "created_at")
|
||||
search_fields = ("content",)
|
||||
|
||||
|
||||
@admin.register(MomentImage)
|
||||
class MomentImageAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "post", "created_at")
|
||||
Reference in New Issue
Block a user