Skip to content

Commit

Permalink
Add comment to message
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Mar 4, 2024
1 parent 79924de commit d2d424b
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 15 deletions.
1 change: 1 addition & 0 deletions object/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Message struct {
ReplyTo string `xorm:"varchar(100) index" json:"replyTo"`
Author string `xorm:"varchar(100)" json:"author"`
Text string `xorm:"mediumtext" json:"text"`
Comment string `xorm:"mediumtext" json:"comment"`
TokenCount int `json:"tokenCount"`
Price float64 `json:"price"`
Currency string `xorm:"varchar(100)" json:"currency"`
Expand Down
10 changes: 10 additions & 0 deletions web/src/MessageEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ class MessageEditPage extends React.Component {
}} />
</Col>
</Row>
<Row style={{marginTop: "20px"}}>
<Col style={{marginTop: "5px"}} span={2}>
{i18next.t("message:Comment")}:
</Col>
<Col span={22}>
<TextArea autoSize={{minRows: 1, maxRows: 15}} value={this.state.message.comment} onChange={(e) => {
this.updateMessageField("comment", e.target.value);
}} />
</Col>
</Row>
</Card>
);
}
Expand Down
42 changes: 27 additions & 15 deletions web/src/MessageListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import React from "react";
import {Link} from "react-router-dom";
import {Button, Popconfirm, Table, Tag} from "antd";
import {Button, Popconfirm, Table} from "antd";
import * as Setting from "./Setting";
import * as MessageBackend from "./backend/MessageBackend";
import moment from "moment";
Expand Down Expand Up @@ -227,23 +227,35 @@ class MessageListPage extends React.Component {
},
},
{
title: i18next.t("message:Knowledge"),
dataIndex: "knowledge",
key: "knowledge",
width: "100px",
sorter: (a, b) => a.knowledge.localeCompare(b.knowledge),
title: i18next.t("message:Comment"),
dataIndex: "comment",
key: "comment",
width: "250px",
sorter: (a, b) => a.comment.localeCompare(b.comment),
render: (text, record, index) => {
return record.vectorScores?.map(vectorScore => {
return (
<Link key={vectorScore.vector} to={`/vectors/${vectorScore.vector}`}>
<Tag style={{marginTop: "5px"}} color={"processing"}>
{vectorScore.score}
</Tag>
</Link>
);
});
return (
<div dangerouslySetInnerHTML={{__html: text}} />
);
},
},
// {
// title: i18next.t("message:Knowledge"),
// dataIndex: "knowledge",
// key: "knowledge",
// width: "100px",
// sorter: (a, b) => a.knowledge.localeCompare(b.knowledge),
// render: (text, record, index) => {
// return record.vectorScores?.map(vectorScore => {
// return (
// <Link key={vectorScore.vector} to={`/vectors/${vectorScore.vector}`}>
// <Tag style={{marginTop: "5px"}} color={"processing"}>
// {vectorScore.score}
// </Tag>
// </Link>
// );
// });
// },
// },
{
title: i18next.t("general:Action"),
dataIndex: "action",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/de/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Group",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Single",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Updated time",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Author",
"Chat": "Chat",
"Comment": "Comment",
"Edit Chat": "Edit Chat",
"Knowledge": "Knowledge",
"Messages": "Messages",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/en/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Group",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Single",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Updated time",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Author",
"Chat": "Chat",
"Comment": "Comment",
"Edit Chat": "Edit Chat",
"Knowledge": "Knowledge",
"Messages": "Messages",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/es/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Group",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Single",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Updated time",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Author",
"Chat": "Chat",
"Comment": "Comment",
"Edit Chat": "Edit Chat",
"Knowledge": "Knowledge",
"Messages": "Messages",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/fr/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Group",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Single",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Updated time",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Author",
"Chat": "Chat",
"Comment": "Comment",
"Edit Chat": "Edit Chat",
"Knowledge": "Knowledge",
"Messages": "Messages",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/id/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Group",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Single",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Updated time",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Author",
"Chat": "Chat",
"Comment": "Comment",
"Edit Chat": "Edit Chat",
"Knowledge": "Knowledge",
"Messages": "Messages",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/ja/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Group",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Single",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Updated time",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Author",
"Chat": "Chat",
"Comment": "Comment",
"Edit Chat": "Edit Chat",
"Knowledge": "Knowledge",
"Messages": "Messages",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/ko/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Group",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Single",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Updated time",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Author",
"Chat": "Chat",
"Comment": "Comment",
"Edit Chat": "Edit Chat",
"Knowledge": "Knowledge",
"Messages": "Messages",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/ru/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "Filter single chat",
"Group": "Группа",
"New Chat": "New Chat",
"Price": "Price",
"Single": "Один",
"Store": "Store",
"Token count": "Token count",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "Successfully update",
"Sure to delete": "Sure to delete",
"This is a read-only demo site!": "This is a read-only demo site!",
"Tokens": "Tokens",
"URL": "URL",
"Updated time": "Обновленное время",
"User": "User",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "Автор",
"Chat": "Чат",
"Comment": "Comment",
"Edit Chat": "Редактировать чат",
"Knowledge": "Knowledge",
"Messages": "Сообщения",
Expand Down
3 changes: 3 additions & 0 deletions web/src/locales/zh/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"Filter single chat": "筛选单个会话",
"Group": "群聊",
"New Chat": "新会话",
"Price": "价格",
"Single": "单聊",
"Store": "数据仓库",
"Token count": "Token数量",
Expand Down Expand Up @@ -84,6 +85,7 @@
"Successfully update": "更新成功",
"Sure to delete": "确定删除",
"This is a read-only demo site!": "这是一个只读的演示站点!",
"Tokens": "Tokens",
"URL": "链接",
"Updated time": "更新时间",
"User": "用户",
Expand All @@ -100,6 +102,7 @@
"message": {
"Author": "作者",
"Chat": "会话",
"Comment": "批注",
"Edit Chat": "编辑会话",
"Knowledge": "知识",
"Messages": "消息",
Expand Down

0 comments on commit d2d424b

Please sign in to comment.