Skip to content

Commit

Permalink
Feat/0.3.3 (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jul 8, 2024
2 parents baf2a86 + cc58fb8 commit c21ed6b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
15 changes: 12 additions & 3 deletions src/backend/bisheng/database/models/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class MessageBase(SQLModelSerializable):
receiver: Optional[Dict] = Field(index=False, default=None, description='autogen 的发送方')
intermediate_steps: Optional[str] = Field(sa_column=Column(Text), description='过程日志')
files: Optional[str] = Field(sa_column=Column(String(length=4096)), description='上传的文件等')
remark: Optional[str] = Field(sa_column=Column(String(length=4096)), description='备注。break_answer: 中断的回复不作为history传给模型')
remark: Optional[str] = Field(sa_column=Column(String(length=4096)),
description='备注。break_answer: 中断的回复不作为history传给模型')
create_time: Optional[datetime] = Field(
sa_column=Column(DateTime, nullable=False, server_default=text('CURRENT_TIMESTAMP')))
update_time: Optional[datetime] = Field(
Expand Down Expand Up @@ -88,11 +89,19 @@ def get_latest_message_by_chatid(cls, chat_id: str):

@classmethod
def get_latest_message_by_chat_ids(cls, chat_ids: list[str], category: str = None):
statement = select(ChatMessage).where(ChatMessage.chat_id.in_(chat_ids))
"""
获取每个会话最近的一次消息内容
"""
statement = select(ChatMessage.chat_id, func.max(ChatMessage.id)).where(ChatMessage.chat_id.in_(chat_ids))
if category:
statement = statement.where(ChatMessage.category == category)
statement = statement.order_by(ChatMessage.create_time.desc())
statement = statement.group_by(ChatMessage.chat_id)
with session_getter() as session:
# 获取最新的id列表
res = session.exec(statement).all()
ids = [one[1] for one in res]
# 获取消息的具体内容
statement = select(ChatMessage).where(ChatMessage.id.in_(ids))
return session.exec(statement).all()

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ export default function MessagePanne({ useName, guideWord, loadMore }) {
type = 'separator'
} else if (msg.files?.length) {
type = 'file'
} else if (['tool', 'flow', 'knowledge'].includes(msg.category)){
// || msg.category === 'processing') { // 项目演示?
} else if (['tool', 'flow', 'knowledge'].includes(msg.category)
|| (msg.category === 'processing' && msg.thought.indexOf(`status_code`) === -1)
) { // 项目演示?
type = 'runLog'
} else if (msg.thought) {
type = 'system'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ export default function MessageSystem({ data }) {

const border = { system: 'border-slate-500', question: 'border-amber-500', processing: 'border-cyan-600', answer: 'border-lime-600', report: 'border-slate-500', guide: 'border-none' }

// 中英去掉最终的回答(report)
// if(data.category === 'report') return null

return <div className="py-1">
<div className={`relative rounded-sm px-6 py-4 border text-sm dark:bg-gray-900 ${data.category === 'guide' ? 'bg-[#EDEFF6]' : 'bg-slate-50'} ${border[data.category || 'system']}`}>
{logMkdown}
{/* 中英 */}
{data.category === 'report' && <CopyIcon className=" absolute right-4 top-2 cursor-pointer" onClick={(e) => handleCopy(e.target.parentNode)}></CopyIcon>}
{/* {<CopyIcon className=" absolute right-4 top-2 cursor-pointer" onClick={(e) => handleCopy(e.target.parentNode)}></CopyIcon>} */}
</div>
</div>
};
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const ResultPanne = ({ chatId, words, data, onClose, onAdd, children }: { chatId
{/* left */}
<div className="w-[300px] bg-gray-100 rounded-md py-4 px-2 h-full overflow-y-auto no-scrollbar">
{/* label */}
{/* 中英 */}
<div className="mb-4 text-sm font-bold">
{t('chat.filterLabel')}
<div className="tooltip fixed" data-tip={t('chat.tooltipText')}><span data-theme="light" className="badge cursor-pointer">?</span></div>
Expand Down
4 changes: 0 additions & 4 deletions src/frontend/src/pages/LoginPage/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ export const LoginPage = () => {
</div>
)
}
{/* 中英 */}
{/* <Button
className='h-[48px] mt-[32px] dark:bg-button'
disabled={isLoading} onClick={handleLogin} >{t('login.loginButton')}</Button> */}
{
showLogin ? <>
<div className="text-center">
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { viteStaticCopy } from 'vite-plugin-static-copy';
import svgr from "vite-plugin-svgr";

// Use environment variable to determine the target.
const target = process.env.VITE_PROXY_TARGET || "http://192.168.106.120:3002";
const target = process.env.VITE_PROXY_TARGET || "http://127.0.0.1:7861";
const apiRoutes = ["^/api/", "/health"];

const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
Expand Down

0 comments on commit c21ed6b

Please sign in to comment.