Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chatGLM
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘坚-丰林-DEV
chatGLM
Commits
655a0f28
Commit
655a0f28
authored
Apr 18, 2023
by
文旺-丰林-DEV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some not use code
parent
c330a658
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
708 deletions
+1
-708
index.tsx
src/pages/AccountManage/index.tsx
+0
-5
index.tsx
src/pages/Chat/index.tsx
+1
-3
UpdateForm.tsx
src/pages/TableList/components/UpdateForm.tsx
+0
-209
index.tsx
src/pages/TableList/index.tsx
+0
-397
test.tsx
src/pages/test.tsx
+0
-94
No files found.
src/pages/AccountManage/index.tsx
deleted
100644 → 0
View file @
c330a658
import
React
from
'react'
;
export
default
function
index
()
{
return
<
div
>
index
</
div
>;
}
src/pages/Chat/index.tsx
View file @
655a0f28
...
...
@@ -58,17 +58,15 @@ const Chat: React.FC = () => {
const
{
sendMessage
}
=
useWebSocket
(
'wss://glm-api.baibaomen.com/ws'
,
{
onMessage
:
(
event
)
=>
{
const
text
=
event
.
data
;
console
.
log
(
text
);
if
(
text
==
'{{BBMCPLT}}'
)
{
setLoading
(
false
);
}
else
{
setAnswer
(
text
);
window
.
scrollTo
(
0
,
document
.
body
.
scrollHeight
);
console
.
log
(
text
);
}
},
onOpen
:
()
=>
{
console
.
log
(
'
连接成功!
'
);
console
.
log
(
'
connected!
'
);
setLoading
(
false
);
},
onError
:
()
=>
{
...
...
src/pages/TableList/components/UpdateForm.tsx
deleted
100644 → 0
View file @
c330a658
import
{
ProFormDateTimePicker
,
ProFormRadio
,
ProFormSelect
,
ProFormText
,
ProFormTextArea
,
StepsForm
,
}
from
'@ant-design/pro-components'
;
import
{
Modal
}
from
'antd'
;
import
React
from
'react'
;
import
{
FormattedMessage
,
useIntl
}
from
'umi'
;
export
type
FormValueType
=
{
target
?:
string
;
template
?:
string
;
type
?:
string
;
time
?:
string
;
frequency
?:
string
;
}
&
Partial
<
API
.
RuleListItem
>
;
export
type
UpdateFormProps
=
{
onCancel
:
(
flag
?:
boolean
,
formVals
?:
FormValueType
)
=>
void
;
onSubmit
:
(
values
:
FormValueType
)
=>
Promise
<
void
>
;
updateModalVisible
:
boolean
;
values
:
Partial
<
API
.
RuleListItem
>
;
};
const
UpdateForm
:
React
.
FC
<
UpdateFormProps
>
=
(
props
)
=>
{
const
intl
=
useIntl
();
return
(
<
StepsForm
stepsProps=
{
{
size
:
'small'
,
}
}
stepsFormRender=
{
(
dom
,
submitter
)
=>
{
return
(
<
Modal
width=
{
640
}
bodyStyle=
{
{
padding
:
'32px 40px 48px'
}
}
destroyOnClose
title=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.ruleConfig'
,
defaultMessage
:
'规则配置'
,
})
}
visible=
{
props
.
updateModalVisible
}
footer=
{
submitter
}
onCancel=
{
()
=>
{
props
.
onCancel
();
}
}
>
{
dom
}
</
Modal
>
);
}
}
onFinish=
{
props
.
onSubmit
}
>
<
StepsForm
.
StepForm
initialValues=
{
{
name
:
props
.
values
.
name
,
desc
:
props
.
values
.
desc
,
}
}
title=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.basicConfig'
,
defaultMessage
:
'基本信息'
,
})
}
>
<
ProFormText
name=
"name"
label=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.ruleName.nameLabel'
,
defaultMessage
:
'规则名称'
,
})
}
width=
"md"
rules=
{
[
{
required
:
true
,
message
:
(
<
FormattedMessage
id=
"pages.searchTable.updateForm.ruleName.nameRules"
defaultMessage=
"请输入规则名称!"
/>
),
},
]
}
/>
<
ProFormTextArea
name=
"desc"
width=
"md"
label=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.ruleDesc.descLabel'
,
defaultMessage
:
'规则描述'
,
})
}
placeholder=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.ruleDesc.descPlaceholder'
,
defaultMessage
:
'请输入至少五个字符'
,
})
}
rules=
{
[
{
required
:
true
,
message
:
(
<
FormattedMessage
id=
"pages.searchTable.updateForm.ruleDesc.descRules"
defaultMessage=
"请输入至少五个字符的规则描述!"
/>
),
min
:
5
,
},
]
}
/>
</
StepsForm
.
StepForm
>
<
StepsForm
.
StepForm
initialValues=
{
{
target
:
'0'
,
template
:
'0'
,
}
}
title=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.ruleProps.title'
,
defaultMessage
:
'配置规则属性'
,
})
}
>
<
ProFormSelect
name=
"target"
width=
"md"
label=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.object'
,
defaultMessage
:
'监控对象'
,
})
}
valueEnum=
{
{
0
:
'表一'
,
1
:
'表二'
,
}
}
/>
<
ProFormSelect
name=
"template"
width=
"md"
label=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.ruleProps.templateLabel'
,
defaultMessage
:
'规则模板'
,
})
}
valueEnum=
{
{
0
:
'规则模板一'
,
1
:
'规则模板二'
,
}
}
/>
<
ProFormRadio
.
Group
name=
"type"
label=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.ruleProps.typeLabel'
,
defaultMessage
:
'规则类型'
,
})
}
options=
{
[
{
value
:
'0'
,
label
:
'强'
,
},
{
value
:
'1'
,
label
:
'弱'
,
},
]
}
/>
</
StepsForm
.
StepForm
>
<
StepsForm
.
StepForm
initialValues=
{
{
type
:
'1'
,
frequency
:
'month'
,
}
}
title=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.schedulingPeriod.title'
,
defaultMessage
:
'设定调度周期'
,
})
}
>
<
ProFormDateTimePicker
name=
"time"
width=
"md"
label=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.schedulingPeriod.timeLabel'
,
defaultMessage
:
'开始时间'
,
})
}
rules=
{
[
{
required
:
true
,
message
:
(
<
FormattedMessage
id=
"pages.searchTable.updateForm.schedulingPeriod.timeRules"
defaultMessage=
"请选择开始时间!"
/>
),
},
]
}
/>
<
ProFormSelect
name=
"frequency"
label=
{
intl
.
formatMessage
({
id
:
'pages.searchTable.updateForm.object'
,
defaultMessage
:
'监控对象'
,
})
}
width=
"md"
valueEnum=
{
{
month
:
'月'
,
week
:
'周'
,
}
}
/>
</
StepsForm
.
StepForm
>
</
StepsForm
>
);
};
export
default
UpdateForm
;
src/pages/TableList/index.tsx
deleted
100644 → 0
View file @
c330a658
This diff is collapsed.
Click to expand it.
src/pages/test.tsx
deleted
100644 → 0
View file @
c330a658
import
{
useWebSocket
}
from
'ahooks'
;
import
{
Button
,
Col
,
Row
,
message
}
from
'antd'
;
import
Input
from
'rc-input'
;
import
{
useMemo
,
useRef
,
useEffect
,
useState
}
from
'react'
;
enum
ReadyState
{
Connecting
=
0
,
Open
=
1
,
Closing
=
2
,
Closed
=
3
,
}
interface
IHistory
{
prompt
:
string
;
answer
:
string
;
}
const
Test
=
()
=>
{
const
[
prompt
,
setPrompt
]
=
useState
<
string
>
(
'你好'
);
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
answer
,
setAnswer
]
=
useState
(
''
);
const
messageHistory
=
useRef
<
IHistory
[]
>
([]);
const
{
sendMessage
}
=
useWebSocket
(
'wss://glm-api.baibaomen.com/ws'
,
{
onMessage
:
(
event
)
=>
{
const
text
=
event
.
data
;
if
(
text
==
'{{BBMCPLT}}'
)
{
}
else
{
setAnswer
(
text
);
}
},
onOpen
:
()
=>
{
setLoading
(
false
);
console
.
log
(
'连接成功!'
);
},
onError
:
(
e
)
=>
{
message
.
error
(
'连接失败了,请稍后再试!'
);
},
});
// useEffect(() => {
// console.log(readyState);
// if (readyState !== ReadyState.Open) {
// connect && connect();
// }
// return () => {
// disconnect && disconnect();
// };
// }, []);
messageHistory
.
current
=
useMemo
(()
=>
{
if
(
messageHistory
.
current
.
length
>
0
)
messageHistory
.
current
[
messageHistory
.
current
.
length
-
1
].
answer
+=
answer
;
console
.
log
(
messageHistory
.
current
);
return
messageHistory
.
current
;
},
[
answer
]);
function
handleSendMessage
()
{
sendMessage
&&
sendMessage
(
JSON
.
stringify
({
prompt
:
prompt
,
max_length
:
2048
,
top_p
:
0.7
,
temperature
:
0.95
,
history
:
[
messageHistory
.
current
.
map
((
h
)
=>
h
.
prompt
)],
token
:
'Uicm6VMjVPdzepbqnwNvpl25xJjRxFekMV8QZdeTLTwacNBl'
,
}),
);
messageHistory
.
current
.
push
({
prompt
:
prompt
,
answer
:
''
});
}
return
(
<>
<
Input
placeholder=
""
value=
{
prompt
}
onChange=
{
(
e
)
=>
{
setPrompt
(
e
.
target
.
value
);
}
}
/>
<
Button
onClick=
{
handleSendMessage
}
loading=
{
loading
}
>
发送
</
Button
>
{
messageHistory
.
current
.
map
((
item
,
index
)
=>
(
<
Row
key=
{
'message-'
+
index
}
>
<
Col
span=
{
24
}
>
{
item
.
prompt
}
</
Col
>
<
Col
span=
{
24
}
dangerouslySetInnerHTML=
{
{
__html
:
item
.
answer
}
}
></
Col
>
</
Row
>
))
}
</>
);
};
export
default
Test
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment