Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ node_modules/
dist/
.vite/
.env.local

### Local environment ###
.env
**/.env
!.env.example
!**/.env.example
6 changes: 6 additions & 0 deletions bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<artifactId>bootstrap</artifactId>

<dependencies>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>com.nageoffer.ai</groupId>
<artifactId>framework</artifactId>
Expand Down
19 changes: 19 additions & 0 deletions bootstrap/resources/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
TZ=Asia/Shanghai

RAGENT_SERVER_HOST=127.0.0.1

RAGENT_PG_USER=postgres
RAGENT_PG_PASSWORD=change-me
RAGENT_PG_PORT=5432

RAGENT_REDIS_PASSWORD=change-me
RAGENT_REDIS_PORT=6379

RAGENT_ROCKETMQ_NAMESRV_PORT=9876

RAGENT_RUSTFS_PORT=9000
RAGENT_MILVUS_PORT=19530

# Model provider API keys
BAILIAN_API_KEY=change-me
SILICONFLOW_API_KEY=change-me
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @see FixedSizeOptions 固定大小切分配置
* @see TextBoundaryOptions 文本边界切分配置(结构感知等)
*/
public sealed interface ChunkingOptions permits FixedSizeOptions, TextBoundaryOptions {
public sealed interface ChunkingOptions permits FixedSizeOptions, TextBoundaryOptions { // permits 允许实现类

/**
* 将配置导出为 Map,用于 API 返回和配置校验
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public void subscribeQueueNotify() {

public void enqueue(String question, String conversationId, SseEmitter emitter, Runnable onAcquire) {
if (!Boolean.TRUE.equals(rateLimitProperties.getGlobalEnabled())) {
// 未开启全局并发限流,直接执行任务
chatEntryExecutor.execute(onAcquire);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@Slf4j
@Aspect
@Component
@Order(Ordered.HIGHEST_PRECEDENCE + 10)
@Order(Ordered.HIGHEST_PRECEDENCE + 10) // 确保在其他切面之前执行
@RequiredArgsConstructor
public class RagTraceAspect {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ public IPage<RagTraceRunVO> pageRuns(RagTraceRunPageRequest request) {
wrapper.eq(RagTraceRunDO::getStatus, request.getStatus());
}

IPage<RagTraceRunDO> pageResult = runMapper.selectPage(request, wrapper);
// 使用MyBatis-Plus标准分页构造方式,适配RagTraceRunPageRequest的分页参数结构
com.baomidou.mybatisplus.extension.plugins.pagination.Page<RagTraceRunDO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(request.getCurrent(), request.getSize());
IPage<RagTraceRunDO> pageResult = runMapper.selectPage(page, wrapper);


Map<String, String> usernameMap = loadUsernameMap(pageResult.getRecords());
return pageResult.convert(run -> toRunVO(run, usernameMap));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
import com.nageoffer.ai.ragent.framework.exception.ClientException;
import com.nageoffer.ai.ragent.user.service.AuthService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class AuthServiceImpl implements AuthService {
Expand All @@ -41,20 +43,27 @@ public class AuthServiceImpl implements AuthService {
public LoginVO login(LoginRequest requestParam) {
String username = requestParam.getUsername();
String password = requestParam.getPassword();
log.info("[login-debug] login start, username={}", username);
if (StrUtil.isBlank(username) || StrUtil.isBlank(password)) {
throw new ClientException("用户名或密码不能为空");
}
UserDO user = findByUsername(username);
log.info("[login-debug] user loaded, username={}, userExists={}, userId={}, role={}",
username, user != null, user != null ? user.getId() : null, user != null ? user.getRole() : null);
if (user == null || !passwordMatches(password, user.getPassword())) {
throw new ClientException("用户名或密码错误");
}
if (user.getId() == null) {
throw new ClientException("用户信息异常");
}
String loginId = user.getId().toString();
log.info("[login-debug] before StpUtil.login, loginId={}", loginId);
StpUtil.login(loginId);
log.info("[login-debug] after StpUtil.login, loginId={}", loginId);
String tokenValue = StpUtil.getTokenValue();
log.info("[login-debug] token generated, loginId={}, tokenPresent={}", loginId, StrUtil.isNotBlank(tokenValue));
String avatar = StrUtil.isBlank(user.getAvatar()) ? DEFAULT_AVATAR_URL : user.getAvatar();
return new LoginVO(loginId, user.getRole(), StpUtil.getTokenValue(), avatar);
return new LoginVO(loginId, user.getRole(), tokenValue, avatar);
}

@Override
Expand Down
24 changes: 24 additions & 0 deletions bootstrap/src/main/resources/application-server-middleware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
spring:
config:
activate:
on-profile: server-middleware

datasource:
username: ${RAGENT_PG_USER:ljh}
password: ${RAGENT_PG_PASSWORD:ljh123456}
url: jdbc:postgresql://${RAGENT_SERVER_HOST:192.168.30.213}:${RAGENT_PG_PORT:5432}/ragent?client_encoding=UTF8

data:
redis:
host: ${RAGENT_SERVER_HOST:192.168.30.213}
port: ${RAGENT_REDIS_PORT:6379}
password: ${RAGENT_REDIS_PASSWORD:ljh123456}

rocketmq:
name-server: ${RAGENT_SERVER_HOST:192.168.30.213}:${RAGENT_ROCKETMQ_NAMESRV_PORT:9876}

milvus:
uri: http://${RAGENT_SERVER_HOST:192.168.30.213}:${RAGENT_MILVUS_PORT:19530}

rustfs:
url: http://${RAGENT_SERVER_HOST:192.168.30.213}:${RAGENT_RUSTFS_PORT:9000}
22 changes: 22 additions & 0 deletions debug-login-submit-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# [OPEN] Debug Session: login-submit-error

## Symptom
- Frontend `http://localhost:5173/login` clicks login and shows "系统执行出错".

## Session
- sessionId: `login-submit-error`
- status: OPEN

## Hypotheses
1. Frontend login request URL or proxy target is incorrect.
2. Backend login endpoint throws a runtime exception.
3. Frontend request payload does not match backend contract.
4. Frontend response parsing fails after a nominally successful response.

## Evidence
- Pending runtime reproduction and request/response capture.

## Next Steps
1. Inspect frontend login page, auth service, and API base configuration.
2. Inspect backend login endpoint and exception path.
3. Reproduce and capture browser network evidence.
Loading