立论接口

main
Heife 4 months ago
parent 482a2629d0
commit 6e4d1365de

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

@ -8,6 +8,7 @@ import java.io.Serializable;
* API
*/
@Data
// Serializable接口的作用是标记当前类可以通过序列化在网络中传播
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;

@ -0,0 +1,50 @@
package com.learning.newdemo.controller;
import com.learning.newdemo.common.Result;
import com.learning.newdemo.service.WxArgumentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("api/ai")
public class WxAIController {
@Autowired
private WxArgumentService wxArgumentService;
private String topic;
private String stance;
@PostMapping("/argument")
public Result<Map<String, Object>> getArgument(@RequestBody Map<String, String> params){
topic = params.get("topic");
stance = params.get("stance");
if(topic == null || stance == null){
return Result.error("立论主题或者内容为空");
}
try {
String argument = wxArgumentService.getArgument(topic, stance);
if (argument == null) {
return Result.error("立论获取失败");
}
Map<String, Object> data = new HashMap<>();
data.put("argument", argument);
return Result.success(data);
}catch (Exception e){
log.error("立论获取失败", e);
return Result.error("立论获取失败:" + e.getMessage());
}
}
}

@ -0,0 +1,9 @@
package com.learning.newdemo.service;
/**
*
*/
public interface WxArgumentService {
String getArgument(String topic, String stance);
}

@ -0,0 +1,150 @@
package com.learning.newdemo.service.impl;
import com.learning.newdemo.service.WxArgumentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
@Slf4j
public class WxArgumentServiceImpl implements WxArgumentService {
// 依赖注入
private final RestTemplate restTemplate;
// 使用@Value注解注入配置属性
@Value("${ai.argument.header.Authorization}")
private String authorizationHeader;
@Value("${ai.argument.body.message.role-sys}")
private String roleSys;
@Value("${ai.argument.body.message.content-sys}")
private String contentSys;
@Value("${ai.argument.body.message.role-user}")
private String roleUser;
@Value("${ai.argument.body.model}")
private String model;
@Value("${ai.argument.body.frequency_penalty}")
private int frequencyPenalty;
@Value("${ai.argument.body.max_tokens}")
private int maxTokens;
@Value("${ai.argument.body.presence_penalty}")
private int presencePenalty;
@Value("${ai.argument.body.response_format}")
private String responseFormatType;
@Value("${ai.argument.body.stop}")
private String stop;
@Value("${ai.argument.body.stream}")
private boolean stream;
@Value("${ai.argument.body.stream_options}")
private String streamOptions;
@Value("${ai.argument.body.temperature}")
private double temperature;
@Value("${ai.argument.body.top_p}")
private double topP;
@Value("${ai.argument.body.tools}")
private String tools;
@Value("${ai.argument.body.tool_choice}")
private String toolChoice;
@Value("${ai.argument.body.logprobs}")
private boolean logprobs;
@Value("${ai.argument.body.top_logprobs}")
private String topLogprobs;
@Value("${ai.argument.url}")
private String url;
public WxArgumentServiceImpl(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
@Override
public String getArgument(String topic, String stance) {
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Authorization", authorizationHeader);
// 构建请求体
String requestBody = String.format(
"{"
+ "\"messages\": ["
+ "{"
+ "\"role\": \"%s\","
+ "\"content\": \"%s\""
+ "},"
+ "{"
+ "\"role\": \"%s\","
+ "\"content\": \"%s\\n我的立场是%s\""
+ "}"
+ "],"
+ "\"model\": \"%s\","
+ "\"frequency_penalty\": %d,"
+ "\"max_tokens\": %d,"
+ "\"presence_penalty\": %d,"
+ "\"response_format\": {"
+ "\"type\": \"%s\""
+ "},"
+ "\"stop\": %s,"
+ "\"stream\": %b,"
+ "\"stream_options\": %s,"
+ "\"temperature\": %f,"
+ "\"top_p\": %f,"
+ "\"tools\": %s,"
+ "\"tool_choice\": \"%s\","
+ "\"logprobs\": %b,"
+ "\"top_logprobs\": %s"
+ "}",
roleSys,
contentSys,
roleUser,
topic,
stance,
model,
frequencyPenalty,
maxTokens,
presencePenalty,
responseFormatType,
stop,
stream,
streamOptions,
temperature,
topP,
tools,
toolChoice,
logprobs,
topLogprobs
);
log.info("请求体:{}", requestBody);
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
return response.getBody();
}catch(Exception e){
log.error("向AI获取立论失败",e);
return null;
}
}
}

@ -43,7 +43,12 @@ public class WxUserServiceImpl implements WxUserService {
+ "&js_code=" + code
+ "&grant_type=authorization_code";
log.info("请求微信接口URL: {}", url);
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
String responseBody = response.getBody();
log.info("微信接口返回: {}", responseBody);
JSONObject json = JSONObject.parseObject(response.getBody());
// 获取openid

@ -19,6 +19,101 @@ wechat:
appid: wxf1f6d7657e01d48a
secret: fc356336a118366f27c384079688bc15
# AI接口配置
# AI接口配置
ai:
argument:
url: https://api.deepseek.com/chat/completions
header:
Authorization: "Bearer sk-53428f3b07ff426f8c11d988f649b5e7"
body:
message:
role-sys: system
content-sys: |
竞技辩论比赛立论撰写指南
你是一个华语辩论的爱好者,你要在接下来学习如何完成一场竞技辩论赛立论的撰写,并且成为一个专业的立论专家。当我给你输入任何一道辩题和持方时,你都能模仿我给你提供的数据,写出一篇完整的,自然段语言式的,辩论圈认可的立论。
一、立论稿的本质与功能
立论稿是辩论中系统阐述己方观点的开篇陈述,需具备:
1. 明确的定义判准
2. 完整的论证体系
3. 严谨的逻辑结构
4. 充分的论据支撑
二、标准结构(四段式黄金框架)
1. 定义与背景15%篇幅)
- 核心概念界定(引用权威定义)
- 讨论范围限定(时空/领域边界)
- 辩题现实意义(社会背景阐述)
- 辩题判断标准(整场比赛的判准)
2. 论证主体80%篇幅,一般为两个论点)
每一个论点单独成一个自然段,采用“金字塔结构”:
- 第一句是一个自然段的核心论点(一个核心论点句),论点句需要是一个完整的判断句。
- 后面进行论证展开(每个论点的背后都有一个完整的逻辑链闭环,完整地展开论点背后的逻辑,并穿插以下三种论据,来补充论证)
「前提→推理→结论」的三段式链条推理可以是A->B也可以是A->B->C,推理的过程依赖于论述的语言和三种论据①统计数据近3年权威报告②典型案例具名事件③专家观点学术/行业权威)
要求:展开的内容丰富,背后的逻辑链完整严谨准确
3. 价值升华5%篇幅)
概括前面的论证主体,然后一句话价值升华
三、专业写作要点
1. 概念界定原则
- 采用“属+种差”定义法
- 优先引用国家标准/学术定义
- 避免循环定义和主观表述
2. 论证规范要求
① 数据使用:
- 标明来源机构/年份/样本量
- 优先选用政府/学术机构数据
- 动态数据需注明统计时段
② 案例选取:
- 具名真实事件(时间+主体+结果)
- 排除虚构假设性案例
- 中外案例比例建议7:3
③论述语言:
- 避免过于学术化
- 避免过于生活化/口语化
- 使用精准的,规范严谨的自然语言
3. 语言表达技巧
- 一篇文章四个自然段,定义与背景一个自然段,每一个论点一个自然段,价值升华一个自然段
- 每一段控制在400汉字以内两个论点段控制在300汉字以上
- 关键术语首次出现加粗
- 避免修辞性设问
四、常见误区警示
1. 结构错误
× 混合使用不同论证模型
× 论点之间存在包含关系
× 价值升华与论证脱节
2. 论据问题
× 使用过期数据超过3年
× 案例缺乏公信力来源
× 专家引用断章取义
3. 表达缺陷
× 使用绝对化表述
× 专业术语堆砌
× 情感化修辞过度
role-user: user
model: deepseek-chat
frequency_penalty: 0
max_tokens: 2048
presence_penalty: 0
response_format: text
stop: []
stream: false
stream_options: []
temperature: 1
top_p: 1
tools: []
tool_choice: []
logprobs: false
top_logprobs: []
# JWT配置
jwt:
secret: yoursecretkey123456789abcdefghijklmnopqrstuvwxyz
@ -26,5 +121,5 @@ jwt:
# 服务端口配置
server:
port: 8080
port: 8000
address: 0.0.0.0

@ -19,6 +19,101 @@ wechat:
appid: wxf1f6d7657e01d48a
secret: fc356336a118366f27c384079688bc15
# AI接口配置
# AI接口配置
ai:
argument:
url: https://api.deepseek.com/chat/completions
header:
Authorization: "Bearer sk-53428f3b07ff426f8c11d988f649b5e7"
body:
message:
role-sys: system
content-sys: |
竞技辩论比赛立论撰写指南
你是一个华语辩论的爱好者,你要在接下来学习如何完成一场竞技辩论赛立论的撰写,并且成为一个专业的立论专家。当我给你输入任何一道辩题和持方时,你都能模仿我给你提供的数据,写出一篇完整的,自然段语言式的,辩论圈认可的立论。
一、立论稿的本质与功能
立论稿是辩论中系统阐述己方观点的开篇陈述,需具备:
1. 明确的定义判准
2. 完整的论证体系
3. 严谨的逻辑结构
4. 充分的论据支撑
二、标准结构(四段式黄金框架)
1. 定义与背景15%篇幅)
- 核心概念界定(引用权威定义)
- 讨论范围限定(时空/领域边界)
- 辩题现实意义(社会背景阐述)
- 辩题判断标准(整场比赛的判准)
2. 论证主体80%篇幅,一般为两个论点)
每一个论点单独成一个自然段,采用“金字塔结构”:
- 第一句是一个自然段的核心论点(一个核心论点句),论点句需要是一个完整的判断句。
- 后面进行论证展开(每个论点的背后都有一个完整的逻辑链闭环,完整地展开论点背后的逻辑,并穿插以下三种论据,来补充论证)
「前提→推理→结论」的三段式链条推理可以是A->B也可以是A->B->C,推理的过程依赖于论述的语言和三种论据①统计数据近3年权威报告②典型案例具名事件③专家观点学术/行业权威)
要求:展开的内容丰富,背后的逻辑链完整严谨准确
3. 价值升华5%篇幅)
概括前面的论证主体,然后一句话价值升华
三、专业写作要点
1. 概念界定原则
- 采用“属+种差”定义法
- 优先引用国家标准/学术定义
- 避免循环定义和主观表述
2. 论证规范要求
① 数据使用:
- 标明来源机构/年份/样本量
- 优先选用政府/学术机构数据
- 动态数据需注明统计时段
② 案例选取:
- 具名真实事件(时间+主体+结果)
- 排除虚构假设性案例
- 中外案例比例建议7:3
③论述语言:
- 避免过于学术化
- 避免过于生活化/口语化
- 使用精准的,规范严谨的自然语言
3. 语言表达技巧
- 一篇文章四个自然段,定义与背景一个自然段,每一个论点一个自然段,价值升华一个自然段
- 每一段控制在400汉字以内两个论点段控制在300汉字以上
- 关键术语首次出现加粗
- 避免修辞性设问
四、常见误区警示
1. 结构错误
× 混合使用不同论证模型
× 论点之间存在包含关系
× 价值升华与论证脱节
2. 论据问题
× 使用过期数据超过3年
× 案例缺乏公信力来源
× 专家引用断章取义
3. 表达缺陷
× 使用绝对化表述
× 专业术语堆砌
× 情感化修辞过度
role-user: user
model: deepseek-chat
frequency_penalty: 0
max_tokens: 2048
presence_penalty: 0
response_format: text
stop: []
stream: false
stream_options: []
temperature: 1
top_p: 1
tools: []
tool_choice: []
logprobs: false
top_logprobs: []
# JWT配置
jwt:
secret: yoursecretkey123456789abcdefghijklmnopqrstuvwxyz
@ -26,5 +121,5 @@ jwt:
# 服务端口配置
server:
port: 8080
port: 8000
address: 0.0.0.0
Loading…
Cancel
Save