このコミットが含まれているのは:
2026-06-16 00:34:48 +09:00
コミット ffebce36b9
10個のファイルの変更940行の追加541行の削除
+10 -3
ファイルの表示
@@ -62,6 +62,7 @@ export type GekanatorExtraQuestion = {
priorityWeight: number }
export type StoredGekanatorQuestion = {
recordId?: number
id: string
text: string
kind: GekanatorQuestionKind
@@ -71,6 +72,7 @@ export type StoredGekanatorQuestion = {
exampleAnswers?: Record<`${ number }`, GekanatorAnswerValue> }
export type GekanatorQuestion = {
recordId?: number
id: string
text: string
kind: GekanatorQuestionKind
@@ -148,7 +150,7 @@ const directExampleAnswerFor = (
question: StoredGekanatorQuestion,
post: Post,
): GekanatorAnswerValue | null => {
if (question.kind !== 'post_similarity')
if (question.kind !== 'post_similarity' && question.kind !== 'tag')
return null
const direct = question.exampleAnswers?.[String (post.id) as `${ number }`]
@@ -348,6 +350,7 @@ export const restoreGekanatorQuestion = (
const normalizedCondition = normalizeTitleLengthCondition (question.condition)
const normalizedQuestion = {
...question,
recordId: question.recordId,
id: normalizedCondition.type === 'title-length-at-least'
? `title:length-at-least:${ normalizedCondition.length }`
: question.id,
@@ -367,6 +370,7 @@ export const storeGekanatorQuestion = (
id: question.condition.type === 'title-length-greater-than'
? `title:length-at-least:${ question.condition.length + 1 }`
: question.id,
recordId: question.recordId,
text: question.text,
kind: question.kind,
condition: normalizeTitleLengthCondition (question.condition),
@@ -581,7 +585,7 @@ export const saveGekanatorGame = async ({
guessedPostId: number
correctPostId: number
answers: GekanatorAnswerLog[]
}): Promise<{ id: number }> =>
}): Promise<{ id: number; learnedExampleCount: number }> =>
await apiPost ('/gekanator/games', {
guessed_post_id: guessedPostId,
correct_post_id: correctPostId,
@@ -595,15 +599,18 @@ export const saveGekanatorGame = async ({
export const saveGekanatorQuestionSuggestion = async ({
gekanatorGameId,
existingQuestionId,
questionText,
answer,
}: {
gekanatorGameId: number
questionText: string
existingQuestionId?: number
questionText?: string
answer: GekanatorAnswerValue
}): Promise<{ id: number; count: number }> =>
await apiPost ('/gekanator/question_suggestions', {
gekanator_game_id: gekanatorGameId,
existing_question_id: existingQuestionId,
question_text: questionText,
answer })
+15
ファイルの表示
@@ -13,6 +13,16 @@ export type RecoveredCandidatePost = {
answerCountAtRecovery: number }
const questionIsFactLikeForHardFiltering = (
question: GekanatorQuestion,
): boolean =>
!(question.kind === 'post_similarity'
|| (
question.kind === 'tag'
&& question.condition.type === 'tag'
&& !(question.condition.key.startsWith ('nico:'))))
export const candidatePostsFor = ({
posts,
questions,
@@ -46,6 +56,8 @@ export const candidatePostsFor = ({
const question = questionById.get (answer.questionId)
if (!(question))
return true
if (!(questionIsFactLikeForHardFiltering (question)))
return true
switch (answer.answer)
{
@@ -71,6 +83,9 @@ export const hardFilteredPostsForAnswer = ({
question: GekanatorQuestion
answer: GekanatorAnswerValue
}): Post[] => {
if (!(questionIsFactLikeForHardFiltering (question)))
return posts
if (answer === 'unknown')
return posts
ファイル差分が大きすぎるため省略します 差分を読込み
+4
ファイルの表示
@@ -139,6 +139,10 @@ export type Post = {
title: string | null
thumbnail: string | null
thumbnailBase: string | null
postSimilarityEdges?: {
targetPostId: number
cos: number
}[]
tags: Tag[]
parentPosts?: Post[]
childPosts?: Post[]