Skip to content

Commit 9d8f045

Browse files
committed
questionExampleをfetchする処理をコメントアウト
1 parent 237cd67 commit 9d8f045

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

app/[docs_id]/chatForm.tsx

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"use client";
22

33
import { useState, FormEvent, useEffect } from "react";
4-
import useSWR from "swr";
5-
import {
6-
getQuestionExample,
7-
QuestionExampleParams,
8-
} from "../actions/questionExample";
9-
import { getLanguageName } from "../pagesList";
4+
// import useSWR from "swr";
5+
// import {
6+
// getQuestionExample,
7+
// QuestionExampleParams,
8+
// } from "../actions/questionExample";
9+
// import { getLanguageName } from "../pagesList";
1010
import { DynamicMarkdownSection } from "./pageContent";
1111
import { useEmbedContext } from "../terminal/embedContext";
1212
import { useChatHistoryContext } from "./chatHistory";
@@ -32,31 +32,31 @@ export function ChatForm({
3232

3333
const { addChat } = useChatHistoryContext();
3434

35-
const lang = getLanguageName(docs_id);
35+
// const lang = getLanguageName(docs_id);
3636

3737
const { files, replOutputs, execResults } = useEmbedContext();
3838

39-
const documentContentInView = sectionContent
40-
.filter((s) => s.inView)
41-
.map((s) => s.rawContent)
42-
.join("\n\n");
43-
const { data: exampleData, error: exampleError } = useSWR(
44-
// 質問フォームを開いたときだけで良い
45-
{
46-
lang,
47-
documentContent: documentContentInView,
48-
} satisfies QuestionExampleParams,
49-
getQuestionExample,
50-
{
51-
// リクエストは古くても構わないので1回でいい
52-
revalidateIfStale: false,
53-
revalidateOnFocus: false,
54-
revalidateOnReconnect: false,
55-
}
56-
);
57-
if (exampleError) {
58-
console.error("Error getting question example:", exampleError);
59-
}
39+
// const documentContentInView = sectionContent
40+
// .filter((s) => s.inView)
41+
// .map((s) => s.rawContent)
42+
// .join("\n\n");
43+
// const { data: exampleData, error: exampleError } = useSWR(
44+
// // 質問フォームを開いたときだけで良い
45+
// {
46+
// lang,
47+
// documentContent: documentContentInView,
48+
// } satisfies QuestionExampleParams,
49+
// getQuestionExample,
50+
// {
51+
// // リクエストは古くても構わないので1回でいい
52+
// revalidateIfStale: false,
53+
// revalidateOnFocus: false,
54+
// revalidateOnReconnect: false,
55+
// }
56+
// );
57+
// if (exampleError) {
58+
// console.error("Error getting question example:", exampleError);
59+
// }
6060
// 質問フォームを開くたびにランダムに選び直し、
6161
// exampleData[Math.floor(exampleChoice * exampleData.length)] を採用する
6262
const [exampleChoice, setExampleChoice] = useState<number>(0); // 0〜1
@@ -71,13 +71,13 @@ export function ChatForm({
7171
setIsLoading(true);
7272
setErrorMessage(null); // Clear previous error message
7373

74-
let userQuestion = inputValue;
75-
if (!userQuestion && exampleData) {
76-
// 質問が空欄なら、質問例を使用
77-
userQuestion =
78-
exampleData[Math.floor(exampleChoice * exampleData.length)];
79-
setInputValue(userQuestion);
80-
}
74+
const userQuestion = inputValue;
75+
// if (!userQuestion && exampleData) {
76+
// // 質問が空欄なら、質問例を使用
77+
// userQuestion =
78+
// exampleData[Math.floor(exampleChoice * exampleData.length)];
79+
// setInputValue(userQuestion);
80+
// }
8181

8282
const result = await askAI({
8383
userQuestion,
@@ -114,10 +114,10 @@ export function ChatForm({
114114
<textarea
115115
className="textarea textarea-ghost textarea-md rounded-box"
116116
placeholder={
117-
"質問を入力してください" +
117+
"質問を入力してください" /* +
118118
(exampleData
119119
? ` (例:「${exampleData[Math.floor(exampleChoice * exampleData.length)]}」)`
120-
: "")
120+
: "")*/
121121
}
122122
style={{
123123
width: "100%",

0 commit comments

Comments
 (0)