fix(一言): 句子下面多挂了个「· 游戏」「· 动画」的分类,看着啰嗦——不显示分类;本机不用再配 env 就能读到一言数据集
Deploy / deploy (push) Canceled after 0s
Deploy / deploy (push) Canceled after 0s
- 出处只写「—— 谁《出处》」。接口里的分类还在,只用来判断出处要不要加书名号 - HITOKOTO_DIRECTORY 默认值改成仓库旁边的 ../sentences-bundle,.env.example 里那几行撤掉。 线上不受影响:镜像里 Dockerfile 写死了 /data/hitokoto Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c7a8e05385
commit
adea781b8e
5 files changed
+10
-25
No files matched your search
@@ -16,6 +16,3 @@ TRIAL_CONCURRENCY=2
|
|||||||
ALLOWED_WS_ORIGINS=
|
ALLOWED_WS_ORIGINS=
|
||||||
OJ2_DEV_USERNAME=student
|
OJ2_DEV_USERNAME=student
|
||||||
OJ2_DEV_PASSWORD=student123
|
OJ2_DEV_PASSWORD=student123
|
||||||
# 一言数据集(hitokoto 官方的 sentences-bundle)。默认 data/hitokoto;本机放在仓库旁边的话指过去,
|
|
||||||
# 读不到就回落到内置的三句,不影响启动
|
|
||||||
# HITOKOTO_DIRECTORY=../sentences-bundle
|
|
||||||
@@ -77,7 +77,7 @@ const envSchema = z.object({
|
|||||||
AVATAR_DIRECTORY: text("data/avatar"),
|
AVATAR_DIRECTORY: text("data/avatar"),
|
||||||
TEST_CASE_DIRECTORY: text("data/test_case"),
|
TEST_CASE_DIRECTORY: text("data/test_case"),
|
||||||
UPLOAD_DIRECTORY: text("data/upload"),
|
UPLOAD_DIRECTORY: text("data/upload"),
|
||||||
HITOKOTO_DIRECTORY: text("data/hitokoto"),
|
HITOKOTO_DIRECTORY: text("../sentences-bundle"),
|
||||||
ALLOWED_WS_ORIGINS: text(""),
|
ALLOWED_WS_ORIGINS: text(""),
|
||||||
UPLOAD_URI_PREFIX: text("/public/upload"),
|
UPLOAD_URI_PREFIX: text("/public/upload"),
|
||||||
AVATAR_URI_PREFIX: text("/public/avatar"),
|
AVATAR_URI_PREFIX: text("/public/avatar"),
|
||||||
@@ -150,8 +150,8 @@ export const config = {
|
|||||||
// 判题沙箱把这个目录挂成只读的 /test_case,两边必须指同一处
|
// 判题沙箱把这个目录挂成只读的 /test_case,两边必须指同一处
|
||||||
testCaseDirectory: repoPath(env.TEST_CASE_DIRECTORY),
|
testCaseDirectory: repoPath(env.TEST_CASE_DIRECTORY),
|
||||||
uploadDirectory: repoPath(env.UPLOAD_DIRECTORY),
|
uploadDirectory: repoPath(env.UPLOAD_DIRECTORY),
|
||||||
// 一言数据集(hitokoto.cn 官方导出),和旧后端读同一份:容器里是 /data/hitokoto。
|
// 一言数据集(hitokoto.cn 官方的 sentences-bundle)。线上容器里是 /data/hitokoto(Dockerfile 写死,
|
||||||
// 本机 dev 默认路径下没有这份数据,读不到就回落到内置的几条,不影响启动。
|
// 这个默认值管不到);本机默认读仓库旁边那份 ../sentences-bundle,读不到就回落到内置的几条,不影响启动。
|
||||||
hitokotoDirectory: repoPath(env.HITOKOTO_DIRECTORY),
|
hitokotoDirectory: repoPath(env.HITOKOTO_DIRECTORY),
|
||||||
/**
|
/**
|
||||||
* WebSocket 升级时额外放行的来源(逗号分隔的完整 origin,如 https://oj.example.com)。
|
* WebSocket 升级时额外放行的来源(逗号分隔的完整 origin,如 https://oj.example.com)。
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ siteRoutes.get("/site/online", async (c) => {
|
|||||||
return success(c, { count: await onlineCount() } satisfies OnlineCount)
|
return success(c, { count: await onlineCount() } satisfies OnlineCount)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 数据集读不到时的兜底(本机 dev 没挂 data/hitokoto 就会走这里)
|
// 数据集读不到时的兜底(本机旁边没有 sentences-bundle 就会走这里)
|
||||||
const fallbackQuotes = [
|
const fallbackQuotes = [
|
||||||
{
|
{
|
||||||
hitokoto: "程序首先是写给人读的,其次才是让机器执行。",
|
hitokoto: "程序首先是写给人读的,其次才是让机器执行。",
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useThemeVars } from "naive-ui"
|
|||||||
import { getHitokoto } from "../api"
|
import { getHitokoto } from "../api"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一言(设计稿「一言重设计」A 版):大引号 + 一行句子 + 「—— 谁《出处》· 分类」+ 一个看得见的「换一句」。
|
* 一言(设计稿「一言重设计」A 版):大引号 + 一行句子 + 「—— 谁《出处》」+ 一个看得见的「换一句」。
|
||||||
|
* 分类(动画、诗词……)不显示;接口里的 type 只用来判断出处要不要加书名号。
|
||||||
* 原来只能点句子换,没人知道;出处被截成「来自 Structure and Interpretatio…」。
|
* 原来只能点句子换,没人知道;出处被截成「来自 Structure and Interpretatio…」。
|
||||||
* 长句(数据集 p90 44 字、最长 255 字)一行放不下,点句子弹出全文。
|
* 长句(数据集 p90 44 字、最长 255 字)一行放不下,点句子弹出全文。
|
||||||
* 留着它是给学生一点「无聊的乐趣」,别去掉、别挪到看不见的地方。
|
* 留着它是给学生一点「无聊的乐趣」,别去掉、别挪到看不见的地方。
|
||||||
@@ -56,22 +57,12 @@ const popVars = computed(() => ({
|
|||||||
<template #trigger>
|
<template #trigger>
|
||||||
<div class="body" title="点一下看全文">
|
<div class="body" title="点一下看全文">
|
||||||
<span class="sentence">{{ quote.hitokoto }}</span>
|
<span class="sentence">{{ quote.hitokoto }}</span>
|
||||||
<span class="source">
|
<span v-if="source" class="source">—— {{ source }}</span>
|
||||||
<template v-if="source">—— {{ source }}</template>
|
|
||||||
<template v-if="quote.type">
|
|
||||||
<template v-if="source"> · </template><span class="type">{{ quote.type }}</span>
|
|
||||||
</template>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="full" :style="popVars">
|
<div class="full" :style="popVars">
|
||||||
<div class="full-text">{{ quote.hitokoto }}</div>
|
<div class="full-text">{{ quote.hitokoto }}</div>
|
||||||
<div class="full-source">
|
<div v-if="source" class="full-source">—— {{ source }}</div>
|
||||||
<template v-if="source">—— {{ source }}</template>
|
|
||||||
<template v-if="quote.type"
|
|
||||||
><template v-if="source"> · </template>{{ quote.type }}</template
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</n-popover>
|
</n-popover>
|
||||||
<button
|
<button
|
||||||
@@ -130,10 +121,6 @@ const popVars = computed(() => ({
|
|||||||
color: v-bind("theme.textColor3");
|
color: v-bind("theme.textColor3");
|
||||||
}
|
}
|
||||||
|
|
||||||
.type {
|
|
||||||
color: v-bind("theme.primaryColor");
|
|
||||||
}
|
|
||||||
|
|
||||||
.refresh {
|
.refresh {
|
||||||
width: 28px;
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ export const onlineCountSchema = z.object({
|
|||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一言。`from` 是出处(作品),`fromWho` 是谁说的,`type` 是数据集的分类名(动画、诗词……),
|
* 一言。`from` 是出处(作品),`fromWho` 是谁说的,`type` 是数据集的分类名(动画、诗词……,界面不显示,
|
||||||
|
* 只拿来判断出处要不要加书名号),
|
||||||
* 后两个数据集里可能没有。原来是 string | Record 的宽类型,前端拿到再猜形状;
|
* 后两个数据集里可能没有。原来是 string | Record 的宽类型,前端拿到再猜形状;
|
||||||
* 出参是后端自己拼的,直接给定形
|
* 出参是后端自己拼的,直接给定形
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user