Skip to content

Commit

Permalink
モーダルに日本語を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nose221834 committed Nov 16, 2024
1 parent b75ea0b commit 6cd8986
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/src/app/api/minio/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,21 @@ export async function POST(req: NextRequest) {

const score = await scoreRegister(scoreData, assignmentId);

const japaneseText = await prisma.word.findFirst({
where: {
english: assignment,
},
select: {
japanese: true,
},
});

const response: ScoreResponse = {
text: caption || "",
score: score?.point || 0,
similarity: resSimilarity.similarity,
assignmentId: assignmentId,
japaneseText: japaneseText?.japanese || "",
};

return new Response(JSON.stringify(response), {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/camera/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const CameraApp = () => {
const percentSimilarity = Math.floor(data.similarity * 100);

setMessage(
`キャプション: ${data.text} \n類似度: ${percentSimilarity}% スコア: ${data.score} \nランキングから順位を確認しましょう!`,
`生成文章: ${data.text} \n日本語: ${data.japaneseText} \n類似度: ${percentSimilarity}% スコア: ${data.score} \nランキングから順位を確認しましょう!`,
);
const newAssignments = assignments.map((assignment) => {
if (assignment.assignmentId === data.assignmentId) {
Expand Down
1 change: 1 addition & 0 deletions app/src/types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export interface ScoreResponse {
score: number;
similarity: number;
assignmentId: number;
japaneseText: string;
}

export interface ChangeStatus {
Expand Down

0 comments on commit 6cd8986

Please sign in to comment.