feat(一言): 一言挤在角落里,出处被截成「来自 Structure and Interpretatio…」、不知道点一下能换——改成引号 + 句子 + 「—— 谁《出处》· 分类」+ 换一句按钮
设计稿「一言重设计」A 版: - 句子一行,长句(数据集 p90 44 字、最长 255 字)截断,点句子弹出全文 - 出处写成「雷电将军《原神》· 游戏」:接口多下发 fromWho 和分类名,「佚名」「网络」这类充数的出处不写 - 「换一句」是个看得见的圆按钮,换的时候转一圈 - 契约 quoteSchema 从 string | Record 收成定形对象 - .env.example 说明本机怎么把 HITOKOTO_DIRECTORY 指到 sentences-bundle(不指就一直是内置的三句) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dab53c9098
commit
c7a8e05385
5 files changed
+200
-67
No files matched your search
@@ -16,7 +16,17 @@ export const onlineCountSchema = z.object({
|
||||
count: z.number().int().nonnegative(),
|
||||
})
|
||||
|
||||
export const quoteSchema = z.union([z.string(), z.record(z.string(), z.unknown())])
|
||||
/**
|
||||
* 一言。`from` 是出处(作品),`fromWho` 是谁说的,`type` 是数据集的分类名(动画、诗词……),
|
||||
* 后两个数据集里可能没有。原来是 string | Record 的宽类型,前端拿到再猜形状;
|
||||
* 出参是后端自己拼的,直接给定形
|
||||
*/
|
||||
export const quoteSchema = z.object({
|
||||
hitokoto: z.string(),
|
||||
from: z.string(),
|
||||
fromWho: z.string().nullable(),
|
||||
type: z.string().nullable(),
|
||||
})
|
||||
|
||||
export type WebsiteConfig = z.infer<typeof websiteConfigSchema>
|
||||
export type Quote = z.infer<typeof quoteSchema>
|
||||
|
||||
Reference in new issue
Block a user