Fixed Git integration
This commit is contained in:
@@ -11,8 +11,15 @@ function shouldShowMessage(msg: ChatMessage): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
function roleLabel(role: string): string {
|
||||
if (role === "notice") return "таймер";
|
||||
function noticeLabel(content: string): string {
|
||||
if (content.startsWith("⏱")) return "таймер";
|
||||
if (content.startsWith("📋")) return "задачи";
|
||||
if (content.startsWith("🔀")) return "git";
|
||||
return "система";
|
||||
}
|
||||
|
||||
function roleLabel(role: string, content = ""): string {
|
||||
if (role === "notice") return noticeLabel(content);
|
||||
if (role === "user") return "вы";
|
||||
return role;
|
||||
}
|
||||
@@ -111,7 +118,9 @@ export default function Chat() {
|
||||
}
|
||||
if (chunk.event === "notice") {
|
||||
setLiveNotices((prev) => [...prev, chunk.data.content]);
|
||||
refreshPomodoro();
|
||||
if (String(chunk.data.content).startsWith("⏱")) {
|
||||
refreshPomodoro();
|
||||
}
|
||||
}
|
||||
if (chunk.event === "pomodoro") {
|
||||
refreshPomodoro();
|
||||
@@ -166,7 +175,7 @@ export default function Chat() {
|
||||
<div className="messages">
|
||||
{visibleMessages.map((msg) => (
|
||||
<div key={msg.id} className={`message message-${msg.role}`}>
|
||||
<div className="message-role">{roleLabel(msg.role)}</div>
|
||||
<div className="message-role">{roleLabel(msg.role, msg.content)}</div>
|
||||
<div className="message-content">
|
||||
{msg.role === "assistant" || msg.role === "notice" ? (
|
||||
<ReactMarkdown>{msg.content}</ReactMarkdown>
|
||||
@@ -179,7 +188,7 @@ export default function Chat() {
|
||||
|
||||
{liveNotices.map((notice, idx) => (
|
||||
<div key={`notice-${idx}`} className="message message-notice">
|
||||
<div className="message-role">таймер</div>
|
||||
<div className="message-role">{noticeLabel(notice)}</div>
|
||||
<div className="message-content">
|
||||
<ReactMarkdown>{notice}</ReactMarkdown>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user