明树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
bb48e2fc
Commit
bb48e2fc
authored
Feb 18, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i
parent
4a58e950
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
index.js
index.js
+6
-6
No files found.
index.js
View file @
bb48e2fc
...
@@ -82,7 +82,7 @@ app.post('/wechat', async (req, res) => {
...
@@ -82,7 +82,7 @@ app.post('/wechat', async (req, res) => {
// 调用DeepSeek API
// 调用DeepSeek API
async
function
callDeepSeekAPI
(
prompt
)
{
async
function
callDeepSeekAPI
(
prompt
)
{
try
{
//
try {
const
response
=
await
axios
.
post
(
const
response
=
await
axios
.
post
(
'https://api.deepseek.com/v1/chat/completions'
,
'https://api.deepseek.com/v1/chat/completions'
,
{
{
...
@@ -98,12 +98,12 @@ async function callDeepSeekAPI(prompt) {
...
@@ -98,12 +98,12 @@ async function callDeepSeekAPI(prompt) {
timeout
:
50000
// 5秒超时
timeout
:
50000
// 5秒超时
}
}
);
);
console
.
log
(
response
,
"================================"
)
console
.
log
(
JSON
.
stringify
(
response
.
data
.
choices
)
,
"================================"
)
return
response
.
data
.
choices
[
0
].
message
.
content
.
trim
();
return
response
.
data
.
choices
[
0
].
message
.
content
.
trim
();
}
catch
(
error
)
{
//
} catch (error) {
console
.
error
(
'DeepSeek API Error:'
,
error
.
response
?.
data
||
error
.
message
);
//
console.error('DeepSeek API Error:', error.response?.data || error.message);
return
'服务暂时不可用,请稍后再试'
;
//
return '服务暂时不可用,请稍后再试';
}
//
}
}
}
// 构建文本响应XML
// 构建文本响应XML
...
...
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