Commit a48bd3ac authored by littleforest's avatar littleforest

feat: resolved conflict

parents 08c351f4 e845bb19
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" version="1.1" viewBox="0 0 200 200"><title>Group 28 Copy 5</title><desc>Created with Sketch.</desc><defs><linearGradient id="linearGradient-1" x1="62.102%" x2="108.197%" y1="0%" y2="37.864%"><stop offset="0%" stop-color="#4285EB"/><stop offset="100%" stop-color="#2EC7FF"/></linearGradient><linearGradient id="linearGradient-2" x1="69.644%" x2="54.043%" y1="0%" y2="108.457%"><stop offset="0%" stop-color="#29CDFF"/><stop offset="37.86%" stop-color="#148EFF"/><stop offset="100%" stop-color="#0A60FF"/></linearGradient><linearGradient id="linearGradient-3" x1="69.691%" x2="16.723%" y1="-12.974%" y2="117.391%"><stop offset="0%" stop-color="#FA816E"/><stop offset="41.473%" stop-color="#F74A5C"/><stop offset="100%" stop-color="#F51D2C"/></linearGradient><linearGradient id="linearGradient-4" x1="68.128%" x2="30.44%" y1="-35.691%" y2="114.943%"><stop offset="0%" stop-color="#FA8E7D"/><stop offset="51.264%" stop-color="#F74A5C"/><stop offset="100%" stop-color="#F51D2C"/></linearGradient></defs><g id="Page-1" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="logo" transform="translate(-20.000000, -20.000000)"><g id="Group-28-Copy-5" transform="translate(20.000000, 20.000000)"><g id="Group-27-Copy-3"><g id="Group-25" fill-rule="nonzero"><g id="2"><path id="Shape" fill="url(#linearGradient-1)" d="M91.5880863,4.17652823 L4.17996544,91.5127728 C-0.519240605,96.2081146 -0.519240605,103.791885 4.17996544,108.487227 L91.5880863,195.823472 C96.2872923,200.518814 103.877304,200.518814 108.57651,195.823472 L145.225487,159.204632 C149.433969,154.999611 149.433969,148.181924 145.225487,143.976903 C141.017005,139.771881 134.193707,139.771881 129.985225,143.976903 L102.20193,171.737352 C101.032305,172.906015 99.2571609,172.906015 98.0875359,171.737352 L28.285908,101.993122 C27.1162831,100.824459 27.1162831,99.050775 28.285908,97.8821118 L98.0875359,28.1378823 C99.2571609,26.9692191 101.032305,26.9692191 102.20193,28.1378823 L129.985225,55.8983314 C134.193707,60.1033528 141.017005,60.1033528 145.225487,55.8983314 C149.433969,51.69331 149.433969,44.8756232 145.225487,40.6706018 L108.58055,4.05574592 C103.862049,-0.537986846 96.2692618,-0.500797906 91.5880863,4.17652823 Z"/><path id="Shape" fill="url(#linearGradient-2)" d="M91.5880863,4.17652823 L4.17996544,91.5127728 C-0.519240605,96.2081146 -0.519240605,103.791885 4.17996544,108.487227 L91.5880863,195.823472 C96.2872923,200.518814 103.877304,200.518814 108.57651,195.823472 L145.225487,159.204632 C149.433969,154.999611 149.433969,148.181924 145.225487,143.976903 C141.017005,139.771881 134.193707,139.771881 129.985225,143.976903 L102.20193,171.737352 C101.032305,172.906015 99.2571609,172.906015 98.0875359,171.737352 L28.285908,101.993122 C27.1162831,100.824459 27.1162831,99.050775 28.285908,97.8821118 L98.0875359,28.1378823 C100.999864,25.6271836 105.751642,20.541824 112.729652,19.3524487 C117.915585,18.4685261 123.585219,20.4140239 129.738554,25.1889424 C125.624663,21.0784292 118.571995,14.0340304 108.58055,4.05574592 C103.862049,-0.537986846 96.2692618,-0.500797906 91.5880863,4.17652823 Z"/></g><path id="Shape" fill="url(#linearGradient-3)" d="M153.685633,135.854579 C157.894115,140.0596 164.717412,140.0596 168.925894,135.854579 L195.959977,108.842726 C200.659183,104.147384 200.659183,96.5636133 195.960527,91.8688194 L168.690777,64.7181159 C164.472332,60.5180858 157.646868,60.5241425 153.435895,64.7316526 C149.227413,68.936674 149.227413,75.7543607 153.435895,79.9593821 L171.854035,98.3623765 C173.02366,99.5310396 173.02366,101.304724 171.854035,102.473387 L153.685633,120.626849 C149.47715,124.83187 149.47715,131.649557 153.685633,135.854579 Z"/></g><ellipse id="Combined-Shape" cx="100.519" cy="100.437" fill="url(#linearGradient-4)" rx="23.6" ry="23.581"/></g></g></g></g></svg> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60px" height="60px" viewBox="0 0 60 60" version="1.1">
\ No newline at end of file <title>Logo</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="00-登录" transform="translate(-690.000000, -257.000000)">
<g id="登录弹窗" transform="translate(480.000000, 201.000000)">
<g id="Logo" transform="translate(210.000000, 56.000000)">
<circle id="蒙版" fill="#009B95" cx="30" cy="30" r="30"/>
<path d="M43.6206675,12.8571429 L26.0612746,39.342497 L30.9634602,39.3273668 L25.6813009,47.1418292 C20.9416499,47.1034366 17.7855367,47.1034366 16.2129613,47.1418292 C13.8540984,47.199418 12.3967701,44.8312194 14.6440881,41.5811231 C16.1423001,39.4143923 20.091283,33.5844355 26.4910367,24.0912527 C21.3960215,26.3606758 18.4475098,28.0586387 17.6455018,29.1851413 C16.8434938,30.3116439 17.5602907,31.3144717 19.7958927,32.1936248 C18.179136,34.4870184 17.1405631,35.9961963 16.6801741,36.7211585 C15.2227544,35.7816226 8.70762596,31.4500161 14.7813221,27.1283422 C17.6370772,25.09636 27.2501923,20.3392935 43.6206675,12.8571429 L43.6206675,12.8571429 Z M39.6194247,32.2552064 L41.0517805,32.2561164 C41.3859168,32.2564139 41.7020886,32.2567638 42.000296,32.2571663 C50.9014455,32.2691795 48.466034,46.8837662 41.6384988,47.1076269 C41.0081312,47.1282953 39.7078711,47.1398696 37.7377182,47.1423498 L35.9762948,47.1423498 C33.640746,47.1398696 30.6353046,47.1282953 26.9599705,47.1076269 L32.1667577,39.3180125 L36.4295434,39.3180125 L36.4295434,39.3180125 C37.8328596,39.3180125 38.0587296,36.6161295 36.4320419,36.6161295 L29.1716291,36.6161295 L29.1716291,36.6161295 L31.9737895,32.2571663 C32.5474523,32.2567638 33.1031506,32.2564139 33.6408844,32.2561164 L35.6960091,32.2552064 C35.8592853,32.255154 36.0205654,32.2551073 36.1798494,32.2550665 L39.2313949,32.2550665 C39.3627342,32.2551073 39.4920775,32.255154 39.6194247,32.2552064 Z" id="形状结合" fill="#FFFFFF"/>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
@import (reference) '~antd/es/style/themes/index'; @import (reference) '~antd/es/style/themes/index';
.modal { .modal {
.ant-modal-content { :global(.ant-modal-content) {
border-radius: 10px; border-radius: 16px;
padding: 0;
} }
} }
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
width: 60px; width: 60px;
height: 60px; height: 60px;
} }
p { p {
height: 28px; height: 28px;
padding-top: 16px; padding-top: 16px;
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
:global(.ant-form) { :global(.ant-form) {
width: 100%; width: 100%;
.div:nth-child(3) { div:nth-child(3) {
margin-bottom: 16px; margin-bottom: 16px;
} }
} }
...@@ -62,10 +62,6 @@ ...@@ -62,10 +62,6 @@
} }
} }
:global(.ant-checkbox-inner) {
background-color: #009b95;
}
.modal_button { .modal_button {
width: 100%; width: 100%;
height: 44px; height: 44px;
......
import styles from './index.less'; import styles from './index.less';
import { Button, Checkbox, Form, FormInstance, Input, Modal } from 'antd'; import { Button, Checkbox, Form, FormInstance, Input, Modal, message } from 'antd';
import { LockOutlined, UserOutlined } from '@ant-design/icons'; import { LockOutlined, UserOutlined } from '@ant-design/icons';
import logoSvg from '../../assets/logo.svg'; import logoSvg from '../../assets/logo.svg';
import { useRef } from 'react'; import { useRef, useState } from 'react';
import { loginChatGLM } from '@/services/chatGLM/api';
import { useIntl } from 'react-intl';
interface ILoginModalProps { interface ILoginModalProps {
open: boolean; open: boolean;
...@@ -11,6 +13,11 @@ interface ILoginModalProps { ...@@ -11,6 +13,11 @@ interface ILoginModalProps {
const LoginModal = (props: ILoginModalProps) => { const LoginModal = (props: ILoginModalProps) => {
const { open, setOpen } = props; const { open, setOpen } = props;
const intl = useIntl();
const [loginResult, setLoginResult] = useState({});
const [loading, setLoading] = useState(false);
const formRef = useRef<FormInstance>(null); const formRef = useRef<FormInstance>(null);
...@@ -19,22 +26,43 @@ const LoginModal = (props: ILoginModalProps) => { ...@@ -19,22 +26,43 @@ const LoginModal = (props: ILoginModalProps) => {
formRef.current?.resetFields(); formRef.current?.resetFields();
}; };
const handleLogin = (values: any) => { const handleSubmit = async (values: any) => {
console.log('values', values); console.log('values', values);
setLoading(true);
const { username, password, checked } = values;
try {
const result = await loginChatGLM({
name: username,
password,
});
localStorage.setItem('user', JSON.stringify(result || {}));
console.log('result', result);
setLoading(false);
} catch(error) {
const defaultLoginFailureMessage = intl.formatMessage({
id: 'pages.login.failure',
defaultMessage: '登录失败,请重试!',
});
message.error(defaultLoginFailureMessage);
}
reset(); reset();
}; };
return ( return (
<Modal <Modal
open={open} open={open}
onOk={handleLogin}
footer={null} footer={null}
closable={false} closable={false}
width={480} width={480}
wrapClassName={styles.modal}
bodyStyle={{ bodyStyle={{
padding: '56px', padding: '56px',
height: '496px', height: '496px',
}} }}
centered
maskClosable={true}
> >
<div className={styles.modal_login}> <div className={styles.modal_login}>
<div className={styles.modal_title}> <div className={styles.modal_title}>
...@@ -45,7 +73,7 @@ const LoginModal = (props: ILoginModalProps) => { ...@@ -45,7 +73,7 @@ const LoginModal = (props: ILoginModalProps) => {
<Form <Form
name="normal_login" name="normal_login"
initialValues={{ remember: true }} initialValues={{ remember: true }}
onFinish={handleLogin} onFinish={handleSubmit}
onValuesChange={(value) => { onValuesChange={(value) => {
console.log(value); console.log(value);
}} }}
......
/* eslint-disable @typescript-eslint/no-unused-expressions */ /* eslint-disable @typescript-eslint/no-unused-expressions */
import { Form, Button, Col, Row, Input, Typography } from 'antd'; import { Form, Button, Col, Row, Input, Typography, message } from 'antd';
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import ChatFirstContent from './components/content'; import ChatFirstContent from './components/content';
import { import {
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import classNames from 'classnames'; import classNames from 'classnames';
import { Grid } from 'antd'; import { Grid } from 'antd';
import LoginModal from '@/components/loginModal';
const { useBreakpoint } = Grid; const { useBreakpoint } = Grid;
...@@ -24,6 +25,7 @@ const { Item } = Form; ...@@ -24,6 +25,7 @@ const { Item } = Form;
const Chat: React.FC = () => { const Chat: React.FC = () => {
const screens = useBreakpoint(); const screens = useBreakpoint();
const isMobile = screens.xs; const isMobile = screens.xs;
const isPod = screens.sm;
const [chat, SetChat] = useState({ const [chat, SetChat] = useState({
chatInput: '', chatInput: '',
}); });
...@@ -32,22 +34,38 @@ const Chat: React.FC = () => { ...@@ -32,22 +34,38 @@ const Chat: React.FC = () => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [selectSiderTabs, setSelectSiderTabs] = useState(''); const [selectSiderTabs, setSelectSiderTabs] = useState('');
const [open, setOpen] = useState(false);
const tabShow = showSider && isMobile;
useEffect(() => {
let token = '';
if (localStorage.getItem('user')) {
token = JSON.parse(localStorage.user)?.token;
}
if (token) {
setOpen(false);
} else {
setOpen(true);
}
}, []);
const onSend = (value: any) => { const onSend = (value: any) => {
console.log(value); console.log(value);
form.setFieldValue('chatInput', ''); form.setFieldValue('chatInput', '');
setFirstChat(true); setFirstChat(true);
}; };
const onChange = (value: any) => {
value?.chatInput && SetChat(value?.chatInput);
value?.firstInput && setInput(value);
};
const setInput = (value: any) => { const setInput = (value: any) => {
form.setFieldValue('chatInput', value?.firstInput); form.setFieldValue('chatInput', value?.firstInput);
setFirstChat(true); setFirstChat(true);
}; };
const onChange = (value: any) => {
value?.chatInput && SetChat(value?.chatInput);
value?.firstInput && setInput(value);
};
const siderTabsList = [ const siderTabsList = [
{ {
icons: <DeleteOutlined />, icons: <DeleteOutlined />,
...@@ -97,7 +115,7 @@ const Chat: React.FC = () => { ...@@ -97,7 +115,7 @@ const Chat: React.FC = () => {
<> <>
{isMobile && renderMobileHeader()} {isMobile && renderMobileHeader()}
<Row> <Row>
{showSider && ( {tabShow && (
<Col span={4} sm={10} md={7} xs={12} lg={5} className={styles.siderWrapper}> <Col span={4} sm={10} md={7} xs={12} lg={5} className={styles.siderWrapper}>
<div className={styles.sider}> <div className={styles.sider}>
<div className={styles.siderChatContent}> <div className={styles.siderChatContent}>
......
import { useState } from "react";
const PromptWord = () => { const PromptWord = () => {
return <>PromptWord</>; return (
<>
PromptWord
</>
)
}; };
export default PromptWord; export default PromptWord;
import request from 'umi-request';
interface ILoginParams {
name: string;
password: string;
}
request.interceptors.request.use((url, options) => {
let { token } = JSON.parse(localStorage.getItem('user') || '');
if (null === token) {
token = '';
}
const authHeader = {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
'__tenant': '3a0a90fe-9a0d-70f4-200d-a80a41fb6195' // 用户id
};
return {
url: url,
options: { ...options, interceptors: true, headers: authHeader },
};
});
export function loginChatGLM(options: ILoginParams) {
return request('https://glm-mangement-api.baibaomen.com/api/app/account/login', {
method: 'POST',
data: options
})
}
type History = [string, string];
interface ITalkParams {
prompt: string;
history: History[];
max_length?: number;
top_p?: number;
temperature?: number;
}
// export function talkChatGLM({ prompt, history, max_length = 2000, top_p = 0.9, temperature = 0.8 }: ITalkParams) {
// return request('https://glm-mangement-api.baibaomen.com/', {
// method: 'POST',
// data: {
// prompt,
// history,
// max_length,
// top_p,
// temperature
// }
// })
// }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment