明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
D
deepseek_wechat_chat
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
zengfanpei
deepseek_wechat_chat
Commits
6591bac2
Commit
6591bac2
authored
Feb 20, 2025
by
yangyajing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add page
parent
3b841d47
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10622 additions
and
1 deletion
+10622
-1
index.css
public/publicAccount/css/index.css
+106
-0
send.svg
public/publicAccount/images/send.svg
+1
-0
index.html
public/publicAccount/index.html
+26
-1
index.js
public/publicAccount/js/index.js
+138
-0
jquery-1.11.3.js
public/publicAccount/js/jquery-1.11.3.js
+10351
-0
No files found.
public/publicAccount/css/index.css
0 → 100644
View file @
6591bac2
body
,
html
{
width
:
100%
;
height
:
100%
;
padding
:
0
;
margin
:
0
;
font-size
:
16px
;
}
.container
{
width
:
100%
;
height
:
100%
;
padding
:
1rem
;
background-color
:
#f0f8ff
;
box-sizing
:
border-box
;
display
:
flex
;
flex-direction
:
column
;
}
.container
.conversation-wrap
{
flex
:
1
;
height
:
0
;
border-radius
:
0.31rem
;
overflow-y
:
auto
;
}
.container
.conversation-wrap
.conversation-question
{
text-align
:
right
;
}
.container
.conversation-wrap
.question-data
{
display
:
inline-block
;
background-color
:
#1FC67E
;
color
:
#fff
;
margin
:
0.625rem
0
;
border-radius
:
0.625rem
;
border-top-right-radius
:
0
;
padding
:
0.5rem
0.625rem
;
}
.container
.conversation-wrap
.answer-data
{
display
:
inline-block
;
background-color
:
#fff
;
color
:
#333
;
margin
:
0.625rem
0
;
border-radius
:
0.625rem
;
border-top-left-radius
:
0
;
padding
:
0.5rem
0.625rem
;
}
.container
.conversation-loading
{
margin
:
0.31rem
;
text-align
:
center
;
font-size
:
0.75rem
;
color
:
#999
;
display
:
none
;
}
.container
.input-wrap
{
margin-top
:
0.625rem
;
}
.container
.input-wrap
input
{
width
:
100%
;
border
:
1px
solid
#aaa
;
height
:
1.875rem
;
line-height
:
1.875rem
;
border-radius
:
0.25rem
;
padding
:
0
0.75rem
;
box-sizing
:
border-box
;
outline
:
none
;
}
.mask-container
{
position
:
fixed
;
width
:
100%
;
height
:
100%
;
top
:
0
;
bottom
:
0
;
left
:
0
;
right
:
0
;
z-index
:
99999
;
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
display
:
none
;
}
.mask-container
.mask-wrap
{
width
:
70%
;
padding
:
3.125rem
0
;
text-align
:
center
;
position
:
absolute
;
top
:
30%
;
left
:
15%
;
background-color
:
#fff
;
border-radius
:
0.25rem
;
}
.mask-container
.mask-title
{
font-size
:
1.5rem
;
font-weight
:
600
;
line-height
:
2rem
;
}
.mask-container
.mask-content
{
font-size
:
0.875rem
;
color
:
#333
;
margin
:
0.75rem
0
;
}
.mask-container
.mask-button
{
display
:
inline-block
;
padding
:
0
1rem
;
height
:
2rem
;
line-height
:
2rem
;
text-align
:
center
;
background-color
:
rgb
(
239
,
10
,
10
);
color
:
#fff
;
border-radius
:
0.5rem
;
cursor
:
pointer
;
}
public/publicAccount/images/send.svg
0 → 100644
View file @
6591bac2
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
t=
"1740035071822"
class=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"5579"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"32"
height=
"32"
><path
d=
"M1015.754983 6.744114A39.428502 39.428502 0 0 0 986.315035 0.69841L70.522354 312.972149A134.056908 134.056908 0 0 0 5.596753 403.920561a140.891182 140.891182 0 0 0 45.99992 105.142673l191.359664 163.496856a19.714251 19.714251 0 0 0 0 2.891424L242.167767 1002.18237a23.131388 23.131388 0 0 0 14.719974 19.977108c2.628567 0 0 1.839997 2.628567 1.839996a83.851282 83.851282 0 0 0 31.542802-6.045703l121.439787-117.496937a45.737063 45.737063 0 0 0 0-45.474206 20.502821 20.502821 0 0 0-29.177091 0l-91.999839 84.376995V710.411452l326.730856 257.599549a95.154119 95.154119 0 0 0 154.034016-43.108496l238.936724-867.427051c1.839997-7.359987 10.514267-45.737063 4.73142-50.994197zM275.024852 636.023011l-198.719651-177.165404A53.88562 53.88562 0 0 1 91.550888 368.697765L938.737975 57.73831l-663.713123 578.284701z m446.85636 259.702402a54.148477 54.148477 0 0 1-52.571336 37.325649 131.428341 131.428341 0 0 1-41.005643-8.67427l-310.433741-255.496695L951.880809 105.841083l-229.473883 788.570047z"
fill=
"#1F212B"
p-id=
"5580"
></path></svg>
\ No newline at end of file
public/publicAccount/index.html
View file @
6591bac2
<p>
hello 亚晶
</p>
\ No newline at end of file
<!DOCTYPE html>
<head>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"./css/index.css"
>
</head>
<html>
<body>
<div
class=
"container"
>
<div
class=
"conversation-wrap"
>
<div
class=
"conversation-loading"
>
加载中……
</div>
</div>
<div
class=
"input-wrap"
>
<input
type=
"text"
id=
"question-input"
placeholder=
"给deepseek发送消息"
>
</div>
</div>
<div
class=
"mask-container"
>
<div
class=
"mask-wrap"
>
<div
class=
"mask-title"
>
用户信息授权
</div>
<div
class=
"mask-content"
>
为了更好地提供服务,请授权用户信息
</div>
<div
class=
"mask-button"
>
授权登录
</div>
</div>
</div>
</body>
<script
type=
"text/javascript"
src=
"./js/jquery-1.11.3.js"
></script>
<script
type=
"text/javascript"
src=
"./js/index.js"
></script>
</html>
\ No newline at end of file
public/publicAccount/js/index.js
0 → 100644
View file @
6591bac2
$
(
function
()
{
// 判断是否已授权
let
tokenCode
=
localStorage
.
getItem
(
"tokenCode"
);
let
openId
=
""
;
let
question
=
""
;
let
answer
=
""
;
function
checkCode
()
{
if
(
!
tokenCode
)
{
let
searchCode
=
new
URLSearchParams
(
location
.
search
).
get
(
"code"
);
if
(
searchCode
)
{
localStorage
.
setItem
(
"tokenCode"
,
searchCode
);
tokenCode
=
searchCode
;
}
else
{
$
(
".mask-container"
).
show
();
}
}
}
// tokenCode = "041khhll29re5f4cntnl2hgE3E3khhl6";
checkCode
();
$
(
".mask-container .mask-button"
).
click
(()
=>
{
location
.
href
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx0abd4eaaac30fd6b&redirect_uri=http%3A%2F%2Fdeepseek.bridata.com/publicAccount%2F&response_type=code&scope=snsapi_userinfo#wechat_redirect"
;
})
// 获取用户信息
function
getUserInfo
()
{
$
.
ajax
({
url
:
"http://deepseek.bridata.com/api/wechat/pa/getUserInfo"
,
type
:
"post"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
code
:
tokenCode
}),
dataType
:
"json"
,
success
:
(
res
)
=>
{
// openId = res
}
})
}
getUserInfo
();
// 获取问答记录
let
page
=
1
;
function
getList
()
{
$
.
ajax
({
url
:
"http://deepseek.bridata.com/api/question/getQuesList"
,
type
:
"post"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
page
:
page
,
pageSize
:
5
,
openId
:
openId
}),
dataType
:
"json"
,
success
:
(
res
)
=>
{
let
conversationList
=
res
.
list
;
let
html
=
""
conversationList
.
forEach
(
item
=>
{
html
=
`<div class="conversation-item"><div class="conversation-item">
<div class="conversation-question">
<div class="question-data">
${
item
.
question
}
</div>
</div>
<div class="conversation-answer">
<div class="answer-data">
${
item
.
answer
}
</div>
</div></div>`
;
});
$
(
'.conversation-wrap'
).
html
(
html
+
$
(
'.conversation-wrap'
).
html
());
scrollBottom
();
}
})
}
// getList();
// 提交问答
$
(
"#question-input"
).
keypress
(
function
(
event
)
{
if
(
event
.
key
===
"Enter"
||
event
.
keyCode
===
13
)
{
event
.
preventDefault
();
question
=
$
(
this
).
val
();
if
(
question
)
{
$
(
'.conversation-loading'
).
show
();
$
(
this
).
attr
(
"disabled"
,
true
);
$
.
ajax
({
url
:
"https://dashscope.aliyuncs.com/api/v1/apps/6de1065c75074ee1a11238ab90c1aa34/completion"
,
type
:
"post"
,
headers
:
{
"Authorization"
:
"Bearer sk-0ff2fc43671f4ed28dd7c80289da04e7"
,
"Content-Type"
:
"application/json"
},
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
input
:
{
prompt
:
question
},
parameters
:
{},
debug
:
{}
}),
dataType
:
"json"
,
success
:
(
res
)
=>
{
answer
=
res
.
output
.
text
;
let
div
=
document
.
createElement
(
"div"
);
div
.
className
=
"conversation-item"
;
div
.
innerHTML
=
`<div class="conversation-item">
<div class="conversation-question">
<div class="question-data">
${
question
}
</div>
</div>
<div class="conversation-answer">
<div class="answer-data">
${
answer
}
</div>
</div>`
;
$
(
'.conversation-loading'
).
insertBefore
(
div
);
$
(
this
).
val
(
""
);
$
(
'.conversation-loading'
).
hide
();
scrollBottom
();
saveConversation
();
}
})
}
}
});
// 保存当前问答
function
saveConversation
()
{
$
.
ajax
({
url
:
"http://deepseek.bridata.com/api/question/createQuestion"
,
type
:
"post"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
openId
:
openId
,
question
:
question
,
answer
:
answer
}),
dataType
:
"json"
,
success
:
(
res
)
=>
{
question
=
""
;
answer
=
""
;
}
})
}
// 滚动到页面底部
function
scrollBottom
()
{
let
content
=
$
(
".conversation-wrap"
)[
0
];
content
.
scrollTo
({
top
:
content
.
scrollHeight
,
behavior
:
"smooth"
});
}
})
\ No newline at end of file
public/publicAccount/js/jquery-1.11.3.js
0 → 100644
View file @
6591bac2
This diff is collapsed.
Click to expand it.
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