Skip to content

Commit c54e04d

Browse files
authored
Merge pull request #16 from ut-code/markdown
AI解答のmarkdown形式化
2 parents 9b10d53 + 18138d3 commit c54e04d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/[docs_id]/chatForm.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useState, FormEvent } from "react";
44
import { askAI } from "@/app/actions/chatActions";
5+
import { StyledMarkdown } from "./markdown";
56

67
export function ChatForm({ documentContent }: { documentContent: string }) {
78
const [inputValue, setInputValue] = useState("");
@@ -30,7 +31,7 @@ export function ChatForm({ documentContent }: { documentContent: string }) {
3031
return (
3132
<>
3233
{isFormVisible && (
33-
<form className="border border-2 border-primary shadow-xl p-6 rounded-lg bg-base-100" style={{width:"100%", textAlign:"center", boxShadow:"-moz-initial"}} onSubmit={handleSubmit}>
34+
<form className="border border-2 border-secondary shadow-xl p-6 rounded-lg bg-base-100" style={{width:"100%", textAlign:"center", boxShadow:"-moz-initial"}} onSubmit={handleSubmit}>
3435
<h2 className="text-xl font-bold mb-4 text-left relative -top-2 font-mono h-2">
3536
AIへ質問
3637
</h2>
@@ -58,7 +59,7 @@ export function ChatForm({ documentContent }: { documentContent: string }) {
5859
<div className="right-controls">
5960
<button
6061
type="submit"
61-
className="btn btn-soft btn-circle btn-primary rounded-full"
62+
className="btn btn-soft btn-circle btn-accent border-2 border-accent rounded-full"
6263
title="送信"
6364
style={{marginTop:"10px"}}
6465
disabled={isLoading}
@@ -82,8 +83,8 @@ export function ChatForm({ documentContent }: { documentContent: string }) {
8283
<article>
8384
<h3 className="text-lg font-semibold mb-2">AIの回答</h3>
8485
<div className="chat chat-start">
85-
<div className="chat-bubble chat-bubble-primary">
86-
<div className="response-container">{response}</div>
86+
<div className="chat-bubble bg-secondary-content text-black" style={{maxWidth: "100%", wordBreak: "break-word"}}>
87+
<div className="response-container"><StyledMarkdown content={response}/></div>
8788
</div>
8889
</div>
8990
</article>

app/[docs_id]/markdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const components: Components = {
118118
// inline
119119
return (
120120
<code
121-
className="bg-base-200 border border-base-300 px-1 py-0.5 rounded text-sm "
121+
className="bg-base-200/60 border border-base-300 px-1 py-0.5 rounded text-sm "
122122
{...props}
123123
/>
124124
);

0 commit comments

Comments
 (0)