Skip to content

The Unified and Autonomous Development Platform

feat: AI integration (OD-2651)

Robin Shen2619abc1353e
diff --git a/pom.xml b/pom.xml
index ad0c86b1ec..bc15015d2a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
<version>1.3.0</version>
</parent>
<artifactId>server</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
<packaging>pom</packaging>
<build>
<finalName>${project.groupId}.${project.artifactId}-${project.version}</finalName>
diff --git a/server-core/pom.xml b/server-core/pom.xml
index 08d55dcd62..5ca8353d3d 100644
--- a/server-core/pom.xml
+++ b/server-core/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<build>
<plugins>
diff --git a/server-core/src/main/java/io/onedev/server/CoreModule.java b/server-core/src/main/java/io/onedev/server/CoreModule.java
index 374a57d2be..27c159b807 100644
--- a/server-core/src/main/java/io/onedev/server/CoreModule.java
+++ b/server-core/src/main/java/io/onedev/server/CoreModule.java
@@ -267,7 +267,7 @@ import io.onedev.server.service.SshKeyService;
import io.onedev.server.service.SsoAccountService;
import io.onedev.server.service.SsoProviderService;
import io.onedev.server.service.StopwatchService;
-import io.onedev.server.service.TemporalFutureService;
+import io.onedev.server.service.ManagedFutureService;
import io.onedev.server.service.UrlService;
import io.onedev.server.service.UserAuthorizationService;
import io.onedev.server.service.UserEntitlementService;
@@ -354,7 +354,7 @@ import io.onedev.server.service.impl.DefaultSshKeyService;
import io.onedev.server.service.impl.DefaultSsoAccountService;
import io.onedev.server.service.impl.DefaultSsoProviderService;
import io.onedev.server.service.impl.DefaultStopwatchService;
-import io.onedev.server.service.impl.DefaultTemporalFutureService;
+import io.onedev.server.service.impl.DefaultManagedFutureService;
import io.onedev.server.service.impl.DefaultUrlService;
import io.onedev.server.service.impl.DefaultUserAuthorizationService;
import io.onedev.server.service.impl.DefaultUserEntitlementService;
@@ -733,7 +733,7 @@ public class CoreModule extends AbstractPluginModule {
bind(UploadService.class).to(DefaultUploadService.class);
bind(TaskFutureService.class).to(DefaultTaskFutureService.class);
- bind(TemporalFutureService.class).to(DefaultTemporalFutureService.class);
+ bind(ManagedFutureService.class).to(DefaultManagedFutureService.class);
}
private void configureBuild() {
diff --git a/server-core/src/main/java/io/onedev/server/ai/AiTask.java b/server-core/src/main/java/io/onedev/server/ai/AiTask.java
new file mode 100644
index 0000000000..50c210792a
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/AiTask.java
@@ -0,0 +1,42 @@
+package io.onedev.server.ai;
+
+import java.util.Collection;
+
+import org.jspecify.annotations.Nullable;
+
+public class AiTask {
+
+ private final String systemPrompt;
+
+ private final String userPrompt;
+
+ private final Collection<TaskTool> tools;
+
+ private final ResponseHandler responseHandler;
+
+ public AiTask(@Nullable String systemPrompt, String userPrompt, Collection<TaskTool> tools,
+ ResponseHandler responseHandler) {
+ this.systemPrompt = systemPrompt;
+ this.userPrompt = userPrompt;
+ this.tools = tools;
+ this.responseHandler = responseHandler;
+ }
+
+ @Nullable
+ public String getSystemPrompt() {
+ return systemPrompt;
+ }
+
+ public String getUserPrompt() {
+ return userPrompt;
+ }
+
+ public Collection<TaskTool> getTools() {
+ return tools;
+ }
+
+ public ResponseHandler getResponseHandler() {
+ return responseHandler;
+ }
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/service/ChatService.java b/server-core/src/main/java/io/onedev/server/ai/ChatService.java
similarity index 86%
rename from server-core/src/main/java/io/onedev/server/service/ChatService.java
rename to server-core/src/main/java/io/onedev/server/ai/ChatService.java
index d94ed9a69f..fe5dd69bef 100644
--- a/server-core/src/main/java/io/onedev/server/service/ChatService.java
+++ b/server-core/src/main/java/io/onedev/server/ai/ChatService.java
@@ -1,4 +1,4 @@
-package io.onedev.server.service;
+package io.onedev.server.ai;
import java.util.List;
@@ -8,6 +8,7 @@ import org.jspecify.annotations.Nullable;
import io.onedev.server.model.Chat;
import io.onedev.server.model.ChatMessage;
import io.onedev.server.model.User;
+import io.onedev.server.service.EntityService;
import io.onedev.server.service.support.ChatResponding;
import io.onedev.server.web.WebSession;
@@ -22,9 +23,9 @@ public interface ChatService extends EntityService<Chat> {
*
* @param page the page that the request is sent from
* @param request the request to send
- * @param timeout the timeout in seconds
+ * @param timeoutSeconds the timeout in seconds
*/
- void sendRequest(Page page, ChatMessage request, int timeout);
+ void sendRequest(Page page, ChatMessage request, int timeoutSeconds);
@Nullable
ChatResponding getResponding(WebSession session, Chat chat);
diff --git a/server-core/src/main/java/io/onedev/server/ai/ChatTool.java b/server-core/src/main/java/io/onedev/server/ai/ChatTool.java
index e5b17ec717..dc45775231 100644
--- a/server-core/src/main/java/io/onedev/server/ai/ChatTool.java
+++ b/server-core/src/main/java/io/onedev/server/ai/ChatTool.java
@@ -2,17 +2,18 @@ package io.onedev.server.ai;
import java.util.concurrent.CompletableFuture;
+import org.apache.shiro.subject.Subject;
import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.jspecify.annotations.Nullable;
import com.fasterxml.jackson.databind.JsonNode;
import dev.langchain4j.agent.tool.ToolSpecification;
-import io.onedev.server.web.websocket.ChatToolExecution;
public interface ChatTool {
ToolSpecification getSpecification();
- CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments);
-
+ CompletableFuture<ToolExecutionResult> execute(@Nullable IPartialPageRequestHandler handler, Subject subject, JsonNode arguments);
+
}
diff --git a/server-core/src/main/java/io/onedev/server/ai/ChatToolAware.java b/server-core/src/main/java/io/onedev/server/ai/ChatToolAware.java
index 7455428a04..7e0c55f50f 100644
--- a/server-core/src/main/java/io/onedev/server/ai/ChatToolAware.java
+++ b/server-core/src/main/java/io/onedev/server/ai/ChatToolAware.java
@@ -1,10 +1,10 @@
package io.onedev.server.ai;
import java.io.Serializable;
-import java.util.Collection;
+import java.util.List;
public interface ChatToolAware extends Serializable {
- Collection<ChatTool> getChatTools();
+ List<ChatTool> getChatTools();
}
diff --git a/server-core/src/main/java/io/onedev/server/ai/ChatToolUtils.java b/server-core/src/main/java/io/onedev/server/ai/ChatToolUtils.java
deleted file mode 100644
index aa0c46f3ab..0000000000
--- a/server-core/src/main/java/io/onedev/server/ai/ChatToolUtils.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.onedev.server.ai;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jgit.lib.ObjectId;
-import org.jspecify.annotations.Nullable;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import io.onedev.commons.utils.LinearRange;
-import io.onedev.commons.utils.PlanarRange;
-import io.onedev.commons.utils.StringUtils;
-import io.onedev.server.OneDev;
-import io.onedev.server.git.BlobIdent;
-import io.onedev.server.git.BlobIdentFilter;
-import io.onedev.server.git.service.GitService;
-import io.onedev.server.model.Project;
-import io.onedev.server.util.IgnoreLinearRangeMixin;
-import io.onedev.server.util.IgnorePlanarRangeMixin;
-
-public class ChatToolUtils {
-
- public static String convertToJson(Object data) {
- try {
- var mapper = OneDev.getInstance(ObjectMapper.class).copy();
- mapper.addMixIn(PlanarRange.class, IgnorePlanarRangeMixin.class);
- mapper.addMixIn(LinearRange.class, IgnoreLinearRangeMixin.class);
- return mapper.writeValueAsString(data);
- } catch (JsonProcessingException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static String getFilesAndFolders(Project project, ObjectId commitId, @Nullable String path) {
- var gitService = OneDev.getInstance(GitService.class);
- if (path != null) {
- var blobIdent = gitService.getBlobIdent(project, commitId, path);
- if (blobIdent == null)
- return convertToJson(Map.of("successful", false, "failReason", "Folder not found"));
- if (!blobIdent.isTree())
- return convertToJson(Map.of("successful", false, "failReason", "Not a folder"));
- path = StringUtils.strip(path.replace('\\', '/'), "/");
- }
- List<BlobIdent> children = gitService.getChildren(project, commitId,
- path, BlobIdentFilter.ALL, false);
- var filesAndFolders = new ArrayList<Map<String, Object>>();
- for (var child : children) {
- var fileAndFolder = new HashMap<String, Object>();
- fileAndFolder.put("name", child.getName());
- fileAndFolder.put("type", child.isTree() ? "folder" : "file");
- filesAndFolders.add(fileAndFolder);
- }
- return convertToJson(Map.of("successful", true, "filesAndFolders", filesAndFolders));
- }
-
-}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/CodeCommentHelper.java b/server-core/src/main/java/io/onedev/server/ai/CodeCommentHelper.java
new file mode 100644
index 0000000000..28878ab53e
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/CodeCommentHelper.java
@@ -0,0 +1,53 @@
+package io.onedev.server.ai;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.onedev.server.OneDev;
+import io.onedev.server.model.CodeComment;
+import io.onedev.server.model.CodeCommentReply;
+
+public class CodeCommentHelper {
+
+ private static ObjectMapper getObjectMapper() {
+ return OneDev.getInstance(ObjectMapper.class);
+ }
+
+ public static Map<String, Object> getDetail(CodeComment comment) {
+ var typeReference = new TypeReference<LinkedHashMap<String, Object>>() {};
+ var summary = getObjectMapper().convertValue(comment, typeReference);
+ summary.remove("id");
+ summary.remove("uuid");
+ summary.remove("userId");
+ summary.put("user", comment.getUser().getName());
+ summary.put("project", comment.getProject().getPath());
+ summary.put("filePath", comment.getMark().getPath());
+ summary.put("fromLineNumber", comment.getMark().getRange().getFromRow() + 1);
+ summary.put("toLineNumber", comment.getMark().getRange().getToRow() + 1);
+ summary.remove("lastActivity");
+ summary.remove("replyCount");
+ summary.remove("compareContext");
+ summary.remove("mark");
+ return summary;
+ }
+
+ public static List<Map<String, Object>> getReplies(CodeComment comment) {
+ var replies = new ArrayList<Map<String, Object>>();
+ comment.getReplies().stream().sorted(Comparator.comparing(CodeCommentReply::getId)).forEach(reply -> {
+ var replyMap = new HashMap<String, Object>();
+ replyMap.put("user", reply.getUser().getName());
+ replyMap.put("date", reply.getDate());
+ replyMap.put("content", reply.getContent());
+ replies.add(replyMap);
+ });
+ return replies;
+ }
+
+}
diff --git a/server-core/src/main/java/io/onedev/server/ai/DefaultChatService.java b/server-core/src/main/java/io/onedev/server/ai/DefaultChatService.java
new file mode 100644
index 0000000000..e4b46a9416
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/DefaultChatService.java
@@ -0,0 +1,541 @@
+package io.onedev.server.ai;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.util.ThreadContext;
+import org.apache.wicket.Application;
+import org.apache.wicket.Page;
+import org.apache.wicket.protocol.ws.WebSocketSettings;
+import org.apache.wicket.protocol.ws.api.registry.PageIdKey;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.joda.time.DateTime;
+import org.quartz.CronScheduleBuilder;
+import org.quartz.ScheduleBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hazelcast.cp.IAtomicLong;
+
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.data.message.SystemMessage;
+import dev.langchain4j.data.message.UserMessage;
+import dev.langchain4j.model.chat.request.ChatRequest;
+import dev.langchain4j.model.chat.response.ChatResponse;
+import dev.langchain4j.model.chat.response.PartialResponse;
+import dev.langchain4j.model.chat.response.PartialResponseContext;
+import dev.langchain4j.model.chat.response.PartialThinking;
+import dev.langchain4j.model.chat.response.PartialThinkingContext;
+import dev.langchain4j.model.chat.response.PartialToolCall;
+import dev.langchain4j.model.chat.response.PartialToolCallContext;
+import dev.langchain4j.model.chat.response.StreamingChatResponseHandler;
+import dev.langchain4j.model.chat.response.StreamingHandle;
+import io.onedev.commons.utils.ExplicitException;
+import io.onedev.commons.utils.StringUtils;
+import io.onedev.server.cluster.ClusterService;
+import io.onedev.server.event.Listen;
+import io.onedev.server.event.system.SystemStarting;
+import io.onedev.server.exception.ExceptionUtils;
+import io.onedev.server.model.Chat;
+import io.onedev.server.model.ChatMessage;
+import io.onedev.server.model.User;
+import io.onedev.server.persistence.SessionService;
+import io.onedev.server.persistence.TransactionService;
+import io.onedev.server.persistence.annotation.Sessional;
+import io.onedev.server.persistence.annotation.Transactional;
+import io.onedev.server.persistence.dao.EntityCriteria;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.SettingService;
+import io.onedev.server.service.impl.BaseEntityService;
+import io.onedev.server.service.support.ChatResponding;
+import io.onedev.server.taskschedule.SchedulableTask;
+import io.onedev.server.taskschedule.TaskScheduler;
+import io.onedev.server.util.concurrent.BatchWorkExecutionService;
+import io.onedev.server.util.concurrent.BatchWorker;
+import io.onedev.server.util.concurrent.Prioritized;
+import io.onedev.server.web.SessionListener;
+import io.onedev.server.web.WebSession;
+import io.onedev.server.web.page.base.BasePage;
+import io.onedev.server.web.websocket.AiToolExecution;
+import io.onedev.server.web.websocket.WebSocketService;
+
+@Singleton
+public class DefaultChatService extends BaseEntityService<Chat> implements ChatService, SessionListener, SchedulableTask {
+
+ private static final Logger logger = LoggerFactory.getLogger(DefaultChatService.class);
+
+ private static final int MAX_HISTORY_MESSAGES = 25;
+
+ private static final int MAX_HISTORY_MESSAGE_LEN = 1024;
+
+ private static final int HOUSE_KEEPING_PRIORITY = 50;
+
+ @Inject
+ private ExecutorService executorService;
+
+ @Inject
+ private TransactionService transactionService;
+
+ @Inject
+ private WebSocketService webSocketService;
+
+ @Inject
+ private SessionService sessionService;
+
+ @Inject
+ private ClusterService clusterService;
+
+ @Inject
+ private Application application;
+
+ @Inject
+ private SettingService settingService;
+
+ @Inject
+ private TaskScheduler taskScheduler;
+
+ @Inject
+ private BatchWorkExecutionService batchWorkExecutionService;
+
+ private volatile String taskId;
+
+ /*
+ * Use cluster wide id for anonymous chats and messages as we use id to route
+ * websocket observable changes to correct connections
+ */
+ private volatile IAtomicLong nextAnonymousChatId;
+
+ private volatile IAtomicLong nextAnonymousChatMessageId;
+
+ private final Map<String, Map<Long, ChatRespondingImpl>> respondings = new ConcurrentHashMap<>();
+
+ @Override
+ public List<Chat> query(User user, User ai, String term, int count) {
+ EntityCriteria<Chat> criteria = EntityCriteria.of(Chat.class);
+ criteria.add(Restrictions.eq(Chat.PROP_USER, user));
+ criteria.add(Restrictions.eq(Chat.PROP_AI, ai));
+ criteria.add(Restrictions.ilike(Chat.PROP_TITLE, "%" + term + "%"));
+ criteria.addOrder(Order.desc(Chat.PROP_ID));
+ return query(criteria);
+ }
+
+ @Override
+ public void createOrUpdate(Chat chat) {
+ dao.persist(chat);
+ }
+
+ @Sessional
+ @Override
+ public ChatResponding getResponding(WebSession session, Chat chat) {
+ return getResponding(session.getId(), chat.getId());
+ }
+
+ @Transactional
+ @Override
+ public void sendRequest(Page page, ChatMessage request, int timeoutSeconds) {
+ var toolSpecifications = ((BasePage) page).findChatTools()
+ .stream()
+ .map(ChatTool::getSpecification)
+ .collect(Collectors.toList());
+
+ ToolUtils.filterDuplications(toolSpecifications);
+
+ WebSession session = (WebSession) page.getSession();
+ var sessionId = page.getSession().getId();
+ var pageKey = new PageIdKey(page.getPageId());
+
+ var requestId = request.getId();
+ var chatId = request.getChat().getId();
+ var anonymous = request.getChat().getUser() == null;
+
+ var modelSetting = request.getChat().getAi().getAiSetting().getModelSetting();
+ var streamingChatModel = modelSetting.getStreamingChatModel();
+ var chatModel = modelSetting.getChatModel();
+
+ var messages = request.getChat().getSortedMessages()
+ .stream()
+ .collect(Collectors.toList());
+
+ if (messages.size() > MAX_HISTORY_MESSAGES)
+ messages = messages.subList(messages.size()-MAX_HISTORY_MESSAGES, messages.size());
+
+ var langchain4jMessages = new ArrayList<dev.langchain4j.data.message.ChatMessage>();
+ langchain4jMessages.add(new SystemMessage("Your name is %s".formatted(request.getChat().getAi().getName())));
+ var systemPrompt = request.getChat().getAi().getAiSetting().getSystemPrompt();
+ if (systemPrompt != null)
+ langchain4jMessages.add(new SystemMessage(systemPrompt));
+ langchain4jMessages.addAll(messages.stream()
+ .map(it -> {
+ var content = it.getContent();
+ if (!it.equals(request))
+ content = StringUtils.abbreviate(content, MAX_HISTORY_MESSAGE_LEN);
+ if (it.isRequest())
+ return (dev.langchain4j.data.message.ChatMessage) new UserMessage(content);
+ else
+ return (dev.langchain4j.data.message.ChatMessage) new AiMessage(content);
+ })
+ .collect(Collectors.toList()));
+
+ var responseFuture = new CompletableFuture<String>();
+ var executionFuture = executorService.submit(new Runnable() {
+
+ private StreamingChatResponseHandler newResponseHandler(Subject subject) {
+ return new StreamingChatResponseHandler() {
+
+ private final Set<String> loggedToolCalls = new HashSet<>();
+
+ private void updateRespondingContent(StreamingHandle streamingHandle, String partialContent) {
+ ThreadContext.bind(subject);
+ if (responseFuture.isDone()) {
+ streamingHandle.cancel();
+ } else {
+ var responding = getResponding(sessionId, chatId, requestId);
+ if (responding != null) {
+ var content = responding.getContent();
+ if (content == null)
+ content = "";
+ content += partialContent;
+ responding.content = content;
+ webSocketService.notifyObservableChange(Chat.getPartialResponseObservable(chatId), null);
+ }
+ }
+ }
+
+ @Override
+ public void onPartialResponse(PartialResponse partialResponse, PartialResponseContext context) {
+ updateRespondingContent(context.streamingHandle(), partialResponse.text());
+ }
+
+ @Override
+ public void onPartialThinking(PartialThinking partialThinking, PartialThinkingContext context) {
+ updateRespondingContent(context.streamingHandle(), partialThinking.text());
+ }
+
+ @Override
+ public void onPartialToolCall(PartialToolCall partialToolCall, PartialToolCallContext context) {
+ ThreadContext.bind(subject);
+ if (responseFuture.isDone()) {
+ context.streamingHandle().cancel();
+ } else {
+ var toolCallId = partialToolCall.id();
+ if (toolCallId != null && loggedToolCalls.add(toolCallId)) {
+ var responding = getResponding(sessionId, chatId, requestId);
+ if (responding != null) {
+ var content = responding.getContent();
+ if (content == null)
+ content = "";
+ else
+ content += "\n\n";
+
+ content += "<div class='text-muted'>Calling tool \"" + partialToolCall.name() + "\"...</div>\n\n";
+
+ responding.content = content;
+ webSocketService.notifyObservableChange(Chat.getPartialResponseObservable(chatId), null);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onCompleteResponse(ChatResponse completeResponse) {
+ ThreadContext.bind(subject);
+ sessionService.runAsync(() -> {
+ try {
+ var aiMessage = completeResponse.aiMessage();
+ if (aiMessage.hasToolExecutionRequests()) {
+ langchain4jMessages.add(aiMessage);
+ var toolRequests = aiMessage.toolExecutionRequests();
+ var connectionRegistry = WebSocketSettings.Holder.get(application).getConnectionRegistry();
+ var connection = connectionRegistry.getConnection(application, sessionId, pageKey);
+ if (connection == null || !connection.isOpen())
+ throw new ExplicitException("Conversation context lost");
+ for (var toolRequest: toolRequests) {
+ String toolName = toolRequest.name();
+ try {
+ var toolExecution = new AiToolExecution(toolName, ToolUtils.getToolArguments(toolRequest));
+ connection.sendMessage(toolExecution);
+ var toolExecutionFuture = toolExecution.getFuture();
+ if (toolExecutionFuture == null)
+ throw new ExplicitException("Tool not found: " + toolName);
+ while (!responseFuture.isDone()) {
+ try {
+ var toolExecutionResult = toolExecutionFuture.get(1, TimeUnit.SECONDS);
+ toolExecutionResult.addToMessages(langchain4jMessages, toolRequest);
+ break;
+ } catch (TimeoutException e) {
+ } catch (CancellationException e) {
+ // may get cancelled in DefaultManagedFutureService
+ throw new ExplicitException("Timed out calling tool: " + toolName);
+ }
+ }
+ } catch (Throwable t) {
+ ToolUtils.handleCallException(toolName, t);
+ }
+ }
+
+ var handler = newResponseHandler(SecurityUtils.getSubject());
+ var langchain4jChatRequest = ChatRequest.builder()
+ .messages(new ArrayList<>(langchain4jMessages))
+ .toolSpecifications(toolSpecifications)
+ .build();
+ streamingChatModel.chat(langchain4jChatRequest, handler);
+ } else {
+ responseFuture.complete(aiMessage.text());
+ }
+ } catch (Throwable t) {
+ responseFuture.completeExceptionally(t);
+ }
+ });
+ }
+
+ @Override
+ public void onError(Throwable error) {
+ ThreadContext.bind(subject);
+ responseFuture.completeExceptionally(error);
+ }
+
+ };
+ }
+
+ private void createResponse(String content, boolean error) {
+ var responding = getResponding(sessionId, chatId, requestId);
+ if (responding != null) {
+ transactionService.run(() -> {
+ var response = new ChatMessage();
+ response.setError(error);
+ response.setContent(content);
+ if (anonymous) {
+ var chat = SerializationUtils.clone(checkNotNull(session.getAnonymousChats().get(chatId)));
+ response.setChat(chat);
+ response.setId(nextAnonymousChatMessageId());
+ chat.getMessages().add(response);
+ session.getAnonymousChats().put(chatId, chat);
+ } else {
+ response.setChat(load(chatId));
+ dao.persist(response);
+ }
+ webSocketService.notifyObservableChange(Chat.getNewMessagesObservable(chatId), null);
+ });
+ };
+ }
+
+ private void createIncompleteResponse(String reason) {
+ var responding = getResponding(sessionId, chatId, requestId);
+ if (responding != null) {
+ var content = responding.getContent();
+ if (content == null)
+ content = "";
+ else
+ content += "\n\n";
+ content += "<b class='text text-danger'>" + reason + "</b>";
+ createResponse(content, false);
+ }
+ }
+
+ @Override
+ public void run() {
+ var handler = newResponseHandler(SecurityUtils.getSubject());
+ try {
+ var langchain4jChatRequest = ChatRequest.builder()
+ .messages(langchain4jMessages.stream()
+ .map(msg -> (dev.langchain4j.data.message.ChatMessage) msg)
+ .collect(Collectors.toList()))
+ .toolSpecifications(toolSpecifications)
+ .build();
+
+ streamingChatModel.chat(langchain4jChatRequest, handler);
+ transactionService.run(() -> {
+ var chat = anonymous ? checkNotNull(session.getAnonymousChats().get(chatId)) : load(chatId);
+ var requests = chat.getMessages().stream().filter(it->it.isRequest()).collect(Collectors.toList());
+ if (requests.size() == 1) {
+ var prompt = "Summarize below message as a compact title (only title, no comments or other text): \n\n" + requests.get(0).getContent();
+ var title = chatModel.chat(new UserMessage(prompt)).aiMessage().text();
+ if (StringUtils.isNotBlank(title)) {
+ if (anonymous) {
+ chat = SerializationUtils.clone(chat);
+ chat.setTitle(title);
+ session.getAnonymousChats().put(chatId, chat);
+ } else {
+ chat.setTitle(title);
+ dao.persist(chat);
+ }
+ webSocketService.notifyObservableChange(Chat.getChangeObservable(chatId), null);
+ }
+ }
+ });
+ var response = responseFuture.get(timeoutSeconds, TimeUnit.SECONDS);
+ if (StringUtils.isBlank(response))
+ throw new ExplicitException("Received empty response");
+ createResponse(response, false);
+ } catch (Throwable e) {
+ if (ExceptionUtils.find(e, InterruptedException.class) != null) {
+ createIncompleteResponse("Conversation cancelled");
+ } else if (ExceptionUtils.find(e, TimeoutException.class) != null) {
+ createIncompleteResponse("Conversation timed out");
+ } else {
+ var explicitException = ExceptionUtils.find(e, ExplicitException.class);
+ if (explicitException != null) {
+ createResponse(explicitException.getMessage(), true);
+ } else {
+ createResponse("Error getting chat response, check server log for details", true);
+ logger.error("Error getting chat response", e);
+ }
+ }
+ } finally {
+ responseFuture.cancel(false);
+ var respondingsOfSession = respondings.get(sessionId);
+ if (respondingsOfSession != null) {
+ var responding = respondingsOfSession.get(chatId);
+ if (responding != null) {
+ respondingsOfSession.computeIfPresent(chatId, (k, v)-> {
+ if (v.requestId.equals(requestId))
+ return null;
+ else
+ return v;
+ });
+ webSocketService.notifyObservableChange(Chat.getPartialResponseObservable(chatId), null);
+ }
+ }
+ }
+ }
+ });
+
+ var previousResponding = respondings.computeIfAbsent(sessionId, it->new ConcurrentHashMap<>()).put(chatId, new ChatRespondingImpl(requestId, executionFuture));
+ if (previousResponding != null)
+ previousResponding.cancel();
+ }
+
+ private ChatRespondingImpl getResponding(String sessionId, Long chatId) {
+ var respondingsOfSession = respondings.get(sessionId);
+ if (respondingsOfSession != null) {
+ return respondingsOfSession.get(chatId);
+ }
+ return null;
+ }
+
+ private ChatRespondingImpl getResponding(String sessionId, Long chatId, Long requestId) {
+ var responding = getResponding(sessionId, chatId);
+ if (responding != null && responding.requestId.equals(requestId))
+ return responding;
+ else
+ return null;
+ }
+
+ @Listen
+ public void on(SystemStarting event) {
+ nextAnonymousChatId = clusterService.getHazelcastInstance().getCPSubsystem().getAtomicLong("nextAnonymousChatId");
+ nextAnonymousChatMessageId = clusterService.getHazelcastInstance().getCPSubsystem().getAtomicLong("nextAnonymousChatMessageId");
+ if (clusterService.isLeaderServer()) {
+ nextAnonymousChatId.set(1L);
+ nextAnonymousChatMessageId.set(1L);
+ }
+ }
+
+ @Listen
+ public void on(io.onedev.server.event.system.SystemStarted event) {
+ taskId = taskScheduler.schedule(this);
+ }
+
+ @Listen
+ public void on(io.onedev.server.event.system.SystemStopping event) {
+ if (taskId != null)
+ taskScheduler.unschedule(taskId);
+ }
+
+ @Override
+ public long nextAnonymousChatId() {
+ return nextAnonymousChatId.getAndIncrement();
+ }
+
+ @Override
+ public long nextAnonymousChatMessageId() {
+ return nextAnonymousChatMessageId.getAndIncrement();
+ }
+
+ @Override
+ public void sessionCreated(String sessionId) {
+ }
+
+ @Override
+ public void sessionDestroyed(String sessionId) {
+ var respondingsOfSession = respondings.remove(sessionId);
+ if (respondingsOfSession != null) {
+ for (var responding : respondingsOfSession.values())
+ responding.cancel();
+ }
+ }
+
+ @Sessional
+ @Override
+ public void execute() {
+ batchWorkExecutionService.submit(new BatchWorker("chat-cleanup") {
+
+ @Override
+ public void doWorks(List<Prioritized> works) {
+ transactionService.run(() -> {
+ var preserveDays = settingService.getAiSetting().getChatPreserveDays();
+ var threshold = new DateTime().minusDays(preserveDays).toDate();
+ var criteria = newCriteria();
+ criteria.add(Restrictions.lt(Chat.PROP_DATE, threshold));
+ var deletedCount = 0;
+ for (var chat: query(criteria)) {
+ delete(chat);
+ deletedCount++;
+ }
+ if (deletedCount > 0)
+ logger.info("Deleted {} chat(s) older than {} days", deletedCount, preserveDays);
+ });
+ }
+
+ }, new Prioritized(HOUSE_KEEPING_PRIORITY));
+ }
+
+ @Override
+ public ScheduleBuilder<?> getScheduleBuilder() {
+ return CronScheduleBuilder.dailyAtHourAndMinute(0, 0);
+ }
+
+ private static class ChatRespondingImpl implements ChatResponding {
+
+ private final Long requestId;
+
+ private final Future<?> future;
+
+ private volatile String content;
+
+ ChatRespondingImpl(Long requestId, Future<?> future) {
+ this.requestId = requestId;
+ this.future = future;
+ }
+
+ @Override
+ public String getContent() {
+ return content;
+ }
+
+ @Override
+ public void cancel() {
+ future.cancel(true);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/McpHelperResource.java b/server-core/src/main/java/io/onedev/server/ai/McpHelperResource.java
index 70ef10c368..86cb86f934 100644
--- a/server-core/src/main/java/io/onedev/server/ai/McpHelperResource.java
+++ b/server-core/src/main/java/io/onedev/server/ai/McpHelperResource.java
@@ -88,8 +88,6 @@ import io.onedev.server.model.support.issue.field.spec.userchoicefield.UserChoic
import io.onedev.server.model.support.issue.transitionspec.ManualSpec;
import io.onedev.server.model.support.pullrequest.AutoMerge;
import io.onedev.server.model.support.pullrequest.MergeStrategy;
-import io.onedev.server.model.support.pullrequest.changedata.PullRequestApproveData;
-import io.onedev.server.model.support.pullrequest.changedata.PullRequestRequestedForChangesData;
import io.onedev.server.rest.annotation.Api;
import io.onedev.server.rest.resource.support.RestConstants;
import io.onedev.server.search.entity.EntityQuery;
@@ -1204,37 +1202,16 @@ public class McpHelperResource {
var pullRequest = getPullRequest(currentProject, pullRequestReference);
- var oldCommitHash = pullRequest.getBaseCommitHash();
- if (sinceLastReview) {
- Date sinceDate = null;
- for (var change: pullRequest.getChanges()) {
- if ((sinceDate == null || change.getDate().after(sinceDate))
- && change.getUser().equals(user)
- && (change.getData() instanceof PullRequestApproveData || change.getData() instanceof PullRequestRequestedForChangesData)) {
- sinceDate = change.getDate();
- }
- }
- for (var comment: pullRequest.getComments()) {
- if ((sinceDate == null || comment.getDate().after(sinceDate))
- && comment.getUser().equals(user)) {
- sinceDate = comment.getDate();
- }
- }
- if (sinceDate != null) {
- for (PullRequestUpdate update: pullRequest.getSortedUpdates()) {
- if (update.getDate().before(sinceDate))
- oldCommitHash = update.getHeadCommitHash();
- }
- }
- }
- var newCommitHash = pullRequest.getLatestUpdate().getHeadCommitHash();
- var comparisonBase = pullRequestService.getComparisonBase(
- pullRequest, ObjectId.fromString(oldCommitHash), ObjectId.fromString(newCommitHash));
+ var oldCommitId = ObjectId.fromString(pullRequest.getBaseCommitHash());
+ if (sinceLastReview)
+ oldCommitId = pullRequestReviewService.getLastReviewedCommit(pullRequest, user);
+ var newCommitId = ObjectId.fromString(pullRequest.getLatestUpdate().getHeadCommitHash());
+ var comparisonBase = pullRequestService.getComparisonBase(pullRequest, oldCommitId, newCommitId);
var patchInfo = new HashMap<String, String>();
patchInfo.put("projectId", pullRequest.getProject().getId().toString());
patchInfo.put("oldCommitHash", comparisonBase.name());
- patchInfo.put("newCommitHash", newCommitHash);
+ patchInfo.put("newCommitHash", newCommitId.name());
return patchInfo;
}
diff --git a/server-core/src/main/java/io/onedev/server/ai/ResponseHandler.java b/server-core/src/main/java/io/onedev/server/ai/ResponseHandler.java
new file mode 100644
index 0000000000..9cb336c8a3
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/ResponseHandler.java
@@ -0,0 +1,9 @@
+package io.onedev.server.ai;
+
+import io.onedev.server.model.User;
+
+public interface ResponseHandler {
+
+ void onResponse(User ai, String response);
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/TaskTool.java b/server-core/src/main/java/io/onedev/server/ai/TaskTool.java
new file mode 100644
index 0000000000..8a1c5e04a0
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/TaskTool.java
@@ -0,0 +1,15 @@
+package io.onedev.server.ai;
+
+import org.apache.shiro.subject.Subject;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import dev.langchain4j.agent.tool.ToolSpecification;
+
+public interface TaskTool {
+
+ ToolSpecification getSpecification();
+
+ ToolExecutionResult execute(Subject subject, JsonNode arguments);
+
+}
diff --git a/server-core/src/main/java/io/onedev/server/ai/ToolExecutionResult.java b/server-core/src/main/java/io/onedev/server/ai/ToolExecutionResult.java
new file mode 100644
index 0000000000..c6574f715e
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/ToolExecutionResult.java
@@ -0,0 +1,33 @@
+package io.onedev.server.ai;
+
+import java.util.List;
+
+import dev.langchain4j.agent.tool.ToolExecutionRequest;
+import dev.langchain4j.data.message.ChatMessage;
+import dev.langchain4j.data.message.SystemMessage;
+import dev.langchain4j.data.message.ToolExecutionResultMessage;
+
+public class ToolExecutionResult {
+
+ private final String content;
+
+ private final boolean asSystemMessage;
+
+ public ToolExecutionResult(String content, boolean asSystemMessage) {
+ this.content = content;
+ this.asSystemMessage = asSystemMessage;
+ }
+
+ public void addToMessages(List<ChatMessage> messages, ToolExecutionRequest toolRequest) {
+ if (asSystemMessage) {
+ messages.add(new SystemMessage(content));
+ var toolResultMessage = ToolExecutionResultMessage.from(
+ toolRequest.id(), toolRequest.name(), "Result returned as system message");
+ messages.add(toolResultMessage);
+ } else {
+ var toolResultMessage = ToolExecutionResultMessage.from(
+ toolRequest.id(), toolRequest.name(), content);
+ messages.add(toolResultMessage);
+ }
+ }
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/ToolUtils.java b/server-core/src/main/java/io/onedev/server/ai/ToolUtils.java
new file mode 100644
index 0000000000..bdc2413f27
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/ToolUtils.java
@@ -0,0 +1,230 @@
+package io.onedev.server.ai;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
+import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.eclipse.jgit.lib.ObjectId;
+import org.jspecify.annotations.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import dev.langchain4j.agent.tool.ToolExecutionRequest;
+import dev.langchain4j.agent.tool.ToolSpecification;
+import io.onedev.commons.utils.ExplicitException;
+import io.onedev.commons.utils.LinearRange;
+import io.onedev.commons.utils.PlanarRange;
+import io.onedev.commons.utils.StringUtils;
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.tools.GetDiffPatch;
+import io.onedev.server.ai.tools.GetFileContent;
+import io.onedev.server.ai.tools.QueryCodeSnippets;
+import io.onedev.server.ai.tools.QuerySymbolDefinitions;
+import io.onedev.server.exception.ExceptionUtils;
+import io.onedev.server.git.BlobIdent;
+import io.onedev.server.git.BlobIdentFilter;
+import io.onedev.server.git.service.GitService;
+import io.onedev.server.model.Project;
+import io.onedev.server.service.PullRequestService;
+import io.onedev.server.util.IgnoreLinearRangeMixin;
+import io.onedev.server.util.IgnorePlanarRangeMixin;
+
+public class ToolUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(ToolUtils.class);
+
+ private static ObjectMapper getObjectMapper() {
+ return OneDev.getInstance(ObjectMapper.class).copy();
+ }
+
+ public static String convertToJson(Object data) {
+ try {
+ var mapper = getObjectMapper().copy();
+ mapper.addMixIn(PlanarRange.class, IgnorePlanarRangeMixin.class);
+ mapper.addMixIn(LinearRange.class, IgnoreLinearRangeMixin.class);
+ return mapper.writeValueAsString(data);
+ } catch (JsonProcessingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static String getFilesAndFolders(Project project, ObjectId commitId, @Nullable String path) {
+ var gitService = OneDev.getInstance(GitService.class);
+ if (path != null) {
+ var blobIdent = gitService.getBlobIdent(project, commitId, path);
+ if (blobIdent == null)
+ return convertToJson(Map.of("successful", false, "failReason", "Folder not found"));
+ if (!blobIdent.isTree())
+ return convertToJson(Map.of("successful", false, "failReason", "Not a folder"));
+ path = StringUtils.strip(path.replace('\\', '/'), "/");
+ }
+ List<BlobIdent> children = gitService.getChildren(project, commitId,
+ path, BlobIdentFilter.ALL, false);
+ var filesAndFolders = new ArrayList<Map<String, Object>>();
+ for (var child : children) {
+ var fileAndFolder = new HashMap<String, Object>();
+ fileAndFolder.put("name", child.getName());
+ fileAndFolder.put("type", child.isTree() ? "folder" : "file");
+ filesAndFolders.add(fileAndFolder);
+ }
+ return convertToJson(Map.of("successful", true, "filesAndFolders", filesAndFolders));
+ }
+
+ public static JsonNode getToolArguments(ToolExecutionRequest toolExecutionRequest) {
+ var objectMapper = getObjectMapper();
+ if (toolExecutionRequest.arguments() == null)
+ return objectMapper.createObjectNode();
+
+ try {
+ return objectMapper.readTree(toolExecutionRequest.arguments());
+ } catch (JsonProcessingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void handleCallException(String toolName, Throwable exception) {
+ if (ExceptionUtils.find(exception, UnauthorizedException.class) != null)
+ throw new ExplicitException("Permission denied calling tool: " + toolName);
+ var explicitException = ExceptionUtils.find(exception, ExplicitException.class);
+ if (explicitException != null)
+ throw explicitException;
+ logger.error("Error calling tool: " + toolName, exception);
+ throw new ExplicitException("Error calling tool '" + toolName + "', check server log for details");
+ }
+
+ public static ChatTool wrapForChat(TaskTool taskTool) {
+ return new ChatTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return taskTool.getSpecification();
+ }
+
+ @Override
+ public CompletableFuture<ToolExecutionResult> execute(@Nullable IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
+ return CompletableFuture.completedFuture(taskTool.execute(subject, arguments));
+ }
+ };
+ }
+
+ public static List<ChatTool> wrapForChat(List<TaskTool> taskTools) {
+ return taskTools.stream()
+ .map(ToolUtils::wrapForChat)
+ .collect(Collectors.toList());
+ }
+
+ public static List<String> required(boolean inDiffContext, String... arguments) {
+ if (inDiffContext) {
+ var list = new ArrayList<String>(List.of(arguments));
+ list.add("oldRevision");
+ return list;
+ } else {
+ return List.of(arguments);
+ }
+ }
+
+ public static List<TaskTool> getDiffTools(Long projectId, ObjectId oldCommitId, ObjectId newCommitId, @Nullable Long pullRequestId) {
+ ObjectId comparisonBase;
+ if (pullRequestId != null) {
+ var pullRequestService = OneDev.getInstance(PullRequestService.class);
+ var request = pullRequestService.load(pullRequestId);
+ comparisonBase = pullRequestService.getComparisonBase(request, oldCommitId, newCommitId);
+ } else {
+ comparisonBase = oldCommitId;
+ }
+ return List.of(
+ new GetFileContent(true) {
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected ObjectId getCommitId(boolean oldRevision) {
+ return oldRevision ? comparisonBase : newCommitId;
+ }
+ },
+ new QuerySymbolDefinitions(true) {
+
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected ObjectId getCommitId(boolean oldRevision) {
+ return oldRevision ? comparisonBase : newCommitId;
+ }
+ },
+ new QueryCodeSnippets(true) {
+
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected ObjectId getCommitId(boolean oldRevision) {
+ return oldRevision ? comparisonBase : newCommitId;
+ }
+ },
+ new GetDiffPatch() {
+
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected ObjectId getOldCommitId() {
+ return comparisonBase;
+ }
+
+ @Override
+ protected ObjectId getNewCommitId() {
+ return newCommitId;
+ }
+
+ }
+ /*
+ new AddCodeComment(true) {
+
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected Long getPullRequestId() {
+ return pullRequestId;
+ }
+
+ @Override
+ protected ObjectId getCommitId(boolean oldRevision) {
+ return oldRevision ? oldCommitId : newCommitId;
+ }
+ }
+ */
+ );
+ }
+
+ public static void filterDuplications(List<ToolSpecification> toolSpecifications) {
+ var seenNames = new HashSet<String>();
+ for (var it = toolSpecifications.iterator(); it.hasNext();) {
+ if (!seenNames.add(it.next().name()))
+ it.remove();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddCodeCommentReply.java b/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddCodeCommentReply.java
new file mode 100644
index 0000000000..c3fb2f93ec
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddCodeCommentReply.java
@@ -0,0 +1,32 @@
+package io.onedev.server.ai.responsehandlers;
+
+import java.util.Date;
+
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.ResponseHandler;
+import io.onedev.server.model.CodeCommentReply;
+import io.onedev.server.model.User;
+import io.onedev.server.service.CodeCommentReplyService;
+import io.onedev.server.service.CodeCommentService;
+
+public class AddCodeCommentReply implements ResponseHandler {
+
+ private final Long commentId;
+
+ public AddCodeCommentReply(Long commentId) {
+ this.commentId = commentId;
+ }
+
+ @Override
+ public void onResponse(User ai, String response) {
+ var comment = OneDev.getInstance(CodeCommentService.class).load(commentId);
+ var reply = new CodeCommentReply();
+ reply.setComment(comment);
+ reply.setContent(response);
+ reply.setUser(ai);
+ reply.setDate(new Date());
+ reply.setCompareContext(comment.getCompareContext());
+ OneDev.getInstance(CodeCommentReplyService.class).create(reply);
+ }
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddIssueComment.java b/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddIssueComment.java
new file mode 100644
index 0000000000..c516cac168
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddIssueComment.java
@@ -0,0 +1,31 @@
+package io.onedev.server.ai.responsehandlers;
+
+import java.util.Date;
+
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.ResponseHandler;
+import io.onedev.server.model.IssueComment;
+import io.onedev.server.model.User;
+import io.onedev.server.service.IssueCommentService;
+import io.onedev.server.service.IssueService;
+
+public class AddIssueComment implements ResponseHandler {
+
+ private final Long issueId;
+
+ public AddIssueComment(Long issueId) {
+ this.issueId = issueId;
+ }
+
+ @Override
+ public void onResponse(User ai, String response) {
+ var issue = OneDev.getInstance(IssueService.class).load(issueId);
+ var comment = new IssueComment();
+ comment.setIssue(issue);
+ comment.setContent(response);
+ comment.setUser(ai);
+ comment.setDate(new Date());
+ OneDev.getInstance(IssueCommentService.class).create(comment);
+ }
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddPullRequestComment.java b/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddPullRequestComment.java
new file mode 100644
index 0000000000..71ff24c4be
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/responsehandlers/AddPullRequestComment.java
@@ -0,0 +1,31 @@
+package io.onedev.server.ai.responsehandlers;
+
+import java.util.Date;
+
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.ResponseHandler;
+import io.onedev.server.model.PullRequestComment;
+import io.onedev.server.model.User;
+import io.onedev.server.service.PullRequestCommentService;
+import io.onedev.server.service.PullRequestService;
+
+public class AddPullRequestComment implements ResponseHandler {
+
+ private final Long pullRequestId;
+
+ public AddPullRequestComment(Long pullRequestId) {
+ this.pullRequestId = pullRequestId;
+ }
+
+ @Override
+ public void onResponse(User ai, String response) {
+ var pullRequest = OneDev.getInstance(PullRequestService.class).load(pullRequestId);
+ var comment = new PullRequestComment();
+ comment.setRequest(pullRequest);
+ comment.setContent(response);
+ comment.setUser(ai);
+ comment.setDate(new Date());
+ OneDev.getInstance(PullRequestCommentService.class).create(comment);
+ }
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/AddCodeComment.java b/server-core/src/main/java/io/onedev/server/ai/tools/AddCodeComment.java
new file mode 100644
index 0000000000..ee58a93191
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/AddCodeComment.java
@@ -0,0 +1,161 @@
+package io.onedev.server.ai.tools;
+
+import static io.onedev.server.ai.ToolUtils.convertToJson;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
+import org.eclipse.jgit.lib.ObjectId;
+import org.jspecify.annotations.Nullable;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import dev.langchain4j.agent.tool.ToolSpecification;
+import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
+import io.onedev.commons.utils.LinearRange;
+import io.onedev.commons.utils.PlanarRange;
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.ToolUtils;
+import io.onedev.server.git.BlobIdent;
+import io.onedev.server.model.CodeComment;
+import io.onedev.server.model.PullRequest;
+import io.onedev.server.model.support.CompareContext;
+import io.onedev.server.model.support.Mark;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.CodeCommentService;
+import io.onedev.server.service.ProjectService;
+import io.onedev.server.service.PullRequestService;
+
+/*
+ * This tool is not used currently. To use it effectively, we need to add the ability to
+ * get existing code comments also.
+ */
+public abstract class AddCodeComment implements TaskTool {
+
+ private final boolean inDiffContext;
+
+ public AddCodeComment(boolean inDiffContext) {
+ this.inDiffContext = inDiffContext;
+ }
+
+ @Override
+ public ToolSpecification getSpecification() {
+ var paramsBuilder = JsonObjectSchema.builder().addStringProperty("comment").description("Comment to add");
+
+ if (inDiffContext)
+ paramsBuilder.addBooleanProperty("oldRevision").description("Specify whether the code snippet being commented is from the old revision");
+
+ paramsBuilder
+ .addStringProperty("filePath").description("Path of the file containing the code snippet to comment")
+ .addIntegerProperty("fromLineNumber").description("Start line number of the code snippet to comment")
+ .addIntegerProperty("toLineNumber").description("End line number of the code snippet to comment")
+ .required(ToolUtils.required(inDiffContext, "comment", "filePath", "fromLineNumber", "toLineNumber"));
+ if (inDiffContext)
+ paramsBuilder.addBooleanProperty("oldRevision").description("Specify whether the code snippet being commented is from the old revision");
+ return ToolSpecification.builder()
+ .name("addCodeComment")
+ .description("Add a comment to a code snippet")
+ .parameters(paramsBuilder.build())
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ var user = SecurityUtils.getUser(subject);
+ if (!SecurityUtils.canReadCode(subject, project) || user == null)
+ throw new UnauthorizedException();
+
+ if (arguments.get("comment") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'comment' is required")), false);
+ var content = arguments.get("comment").asText();
+ if (inDiffContext && arguments.get("oldRevision") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'oldRevision' is required")), false);
+ var oldRevision = arguments.get("oldRevision") != null ? arguments.get("oldRevision").asBoolean() : false;
+ if (arguments.get("filePath") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'filePath' is required")), false);
+ var filePath = arguments.get("filePath").asText();
+ if (arguments.get("fromLineNumber") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'fromLineNumber' is required")), false);
+ var fromLineNumber = arguments.get("fromLineNumber").asInt();
+ if (arguments.get("toLineNumber") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'toLineNumber' is required")), false);
+ var toLineNumber = arguments.get("toLineNumber").asInt();
+ if (fromLineNumber > toLineNumber)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'fromLineNumber' must be less than or equal to 'toLineNumber'")), false);
+ if (fromLineNumber <= 0)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'fromLineNumber' must be greater than 0")), false);
+
+ var oldCommitId = getCommitId(true);
+ var newCommitId = getCommitId(false);
+
+ PullRequest request = null;
+ ObjectId comparisonBase;
+ if (getPullRequestId() != null) {
+ var pullRequestService = OneDev.getInstance(PullRequestService.class);
+ request = pullRequestService.load(getPullRequestId());
+ comparisonBase = pullRequestService.getComparisonBase(request, oldCommitId, newCommitId);
+ } else {
+ comparisonBase = oldCommitId;
+ }
+
+ var comment = new CodeComment();
+ comment.setUUID(UUID.randomUUID().toString());
+ comment.setProject(project);
+ comment.setUser(user);
+
+ var commitHash = oldRevision? comparisonBase.name() : newCommitId.name();
+ var blob = project.getBlob(new BlobIdent(commitHash, filePath), false);
+ if (blob == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "File not found")), false);
+ if (blob.getText() == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Not a text file")), false);
+ var lines = blob.getText().getLines();
+ if (toLineNumber > lines.size())
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'toLineNumber' must not exceed number of lines in the file")), false);
+ var mark = new Mark();
+ mark.setCommitHash(commitHash);
+ mark.setPath(filePath);
+ mark.setRange(new PlanarRange(fromLineNumber-1, 0, toLineNumber-1, lines.get(toLineNumber-1).length()));
+ if (request == null) {
+ /*
+ * Outside of pull request, no one will be notified of the comment. So we automatically
+ * mention authors of commented lines
+ */
+ StringBuilder mentions = new StringBuilder();
+ for (var author: project.getAuthors(filePath, ObjectId.fromString(commitHash),
+ new LinearRange(mark.getRange().getFromRow(), mark.getRange().getToRow()))) {
+ mentions.append("@").append(author.getName()).append(" ");
+ }
+ content = mentions.toString() + content;
+ }
+ comment.setContent(content);
+ if (request != null) {
+ mark = mark.permanentize(project, oldCommitId, newCommitId, comparisonBase);
+ if (mark == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Invalid patch section to comment on")), false);
+ }
+ comment.setMark(mark);
+
+ var compareContext = new CompareContext();
+ compareContext.setPullRequest(request);
+ compareContext.setOldCommitHash(oldCommitId.name());
+ compareContext.setNewCommitHash(newCommitId.name());
+ comment.setCompareContext(compareContext);
+
+ OneDev.getInstance(CodeCommentService.class).create(comment);
+ return new ToolExecutionResult(convertToJson(Map.of("successful", true)), false);
+ }
+
+ protected abstract Long getProjectId();
+
+ @Nullable
+ protected abstract Long getPullRequestId();
+
+ protected abstract ObjectId getCommitId(boolean oldRevision);
+
+}
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/GetBuildSpecEditInstructions.java b/server-core/src/main/java/io/onedev/server/ai/tools/GetBuildSpecEditInstructions.java
new file mode 100644
index 0000000000..3165eaec9e
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/GetBuildSpecEditInstructions.java
@@ -0,0 +1,73 @@
+package io.onedev.server.ai.tools;
+
+import java.util.ArrayList;
+
+import org.apache.shiro.subject.Subject;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Joiner;
+
+import dev.langchain4j.agent.tool.ToolSpecification;
+import io.onedev.server.ai.BuildSpecSchema;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.buildspec.job.JobVariable;
+
+public class GetBuildSpecEditInstructions implements TaskTool {
+
+ private final boolean withSaveInstruction;
+
+ public GetBuildSpecEditInstructions(boolean withSaveInstruction) {
+ this.withSaveInstruction = withSaveInstruction;
+ }
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getBuildSpecEditInstructions")
+ .description("Get instructions on how to edit CI/CD spec")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var variables = new ArrayList<String>();
+ for (JobVariable variable: JobVariable.values()) {
+ variables.add("- @%s@".formatted(variable.name().toLowerCase()));
+ }
+ variables.add("- @secret:<job secret name>@ (get value of specified job secret)");
+ variables.add("- @file:<workspace file path>@ (get content of specified workspace file generated in previous steps)");
+
+ var instructions = """
+ OneDev CI/CD spec is a yaml file conforming to below schema:
+
+ <!SCHEMA BEGIN!>
+ %s
+ <!SCHEMA END!>
+
+ Available variables that can be used in CI/CD spec:
+ %s
+
+ When editing CI/CD spec, remember that:
+
+ 1. Files in job workspace are shared between different steps. So you can generate workspace files in one step, and use them in another step.
+ 2. If command step is used, turn on the "run in container" if possible, unless requested by user explicitly
+ 3. Different steps run in isolated environments (only job workspace is shared). So it will not work installing dependencies in one step, and run commands relying on them in another step. You should put them in a single step unless requested by user explicitly
+ 4. If cache step is used:
+ 4.1 It should be placed before the step building or testing the project
+ 4.2 If the project has lock files (package.json, pom.xml, etc.):
+ 4.2.1 A generate checksum step should be placed before the cache step, to generate checksum of all relevant lock files and store it in a file named checksum.txt
+ 4.2.2 The key property should be configured as <keyname>-@file:checksum.txt@
+ 4.2.3 The load keys property should be configured as <keyname>
+ 4.2.4 The upload strategy property should be configured as UPLOAD_IF_NOT_HIT
+ 5. If user wants to pass files between different jobs, one job should publish files via the publish artifact step, and another jobs can then download them into job workspace via job dependency
+ 6. Call tools such as getRootFilesAndFolders, getFilesAndSubfolders and getTextContent to get project structure, and figure out what docker image and commands to use to build or test the project if requested by user"""
+ .formatted(BuildSpecSchema.get(), Joiner.on("\n").join(variables));
+
+ if (withSaveInstruction)
+ instructions += "\n7. After editing the CI/CD spec, call saveBuildSpec tool to save the result. If saving fails, fix errors according to error messages and schema above and save again";
+
+ return new ToolExecutionResult(instructions, true);
+ }
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/GetDiffPatch.java b/server-core/src/main/java/io/onedev/server/ai/tools/GetDiffPatch.java
new file mode 100644
index 0000000000..b74322ba91
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/GetDiffPatch.java
@@ -0,0 +1,51 @@
+package io.onedev.server.ai.tools;
+
+import static io.onedev.server.ai.ToolUtils.convertToJson;
+
+import java.util.Map;
+
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
+import org.eclipse.jgit.lib.ObjectId;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import dev.langchain4j.agent.tool.ToolSpecification;
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.git.service.GitService;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.ProjectService;
+
+public abstract class GetDiffPatch implements TaskTool {
+
+ private static final int MAX_PATCH_SIZE = 1024 * 1024;
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getDiffPatch")
+ .description("Get diff patch between old and new revisions in json format")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+ var patch = OneDev.getInstance(GitService.class).getPatch(project, getOldCommitId(), getNewCommitId());
+ if (patch.length() > MAX_PATCH_SIZE)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Patch is too large")), false);
+ else
+ return new ToolExecutionResult(convertToJson(Map.of("successful", true, "patch", patch)), false);
+ }
+
+ protected abstract Long getProjectId();
+
+ protected abstract ObjectId getOldCommitId();
+
+ protected abstract ObjectId getNewCommitId();
+
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/GetFileContent.java b/server-core/src/main/java/io/onedev/server/ai/tools/GetFileContent.java
index 20dcc4fbc5..428260c364 100644
--- a/server-core/src/main/java/io/onedev/server/ai/tools/GetFileContent.java
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/GetFileContent.java
@@ -1,12 +1,11 @@
package io.onedev.server.ai.tools;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static java.util.concurrent.CompletableFuture.completedFuture;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import com.fasterxml.jackson.databind.JsonNode;
@@ -15,54 +14,70 @@ import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import io.onedev.commons.utils.StringUtils;
import io.onedev.server.OneDev;
-import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.ToolUtils;
import io.onedev.server.git.service.GitService;
-import io.onedev.server.model.Project;
-import io.onedev.server.web.websocket.ChatToolExecution;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.ProjectService;
-public abstract class GetFileContent implements ChatTool {
+public abstract class GetFileContent implements TaskTool {
private static final int MAX_FILE_LENGTH = 500000;
+ private final boolean inDiffContext;
+
+ public GetFileContent(boolean inDiffContext) {
+ this.inDiffContext = inDiffContext;
+ }
+
@Override
public ToolSpecification getSpecification() {
+ var paramsBuilder = JsonObjectSchema.builder().addStringProperty("filePath").description("Text file path to get content");
+ if (inDiffContext)
+ paramsBuilder.addBooleanProperty("oldRevision").description("Specify whether to get file content from old revision");
+ paramsBuilder.required(ToolUtils.required(inDiffContext, "filePath"));
+
return ToolSpecification.builder()
.name("getFileContent")
.description("Get content of specified text file in json format")
- .parameters(JsonObjectSchema.builder()
- .addStringProperty("filePath").description("Text file path to get content")
- .addBooleanProperty("oldRevision").description("Optionally specify whether to get file content in old revision in a diff context")
- .required("filePath").build())
+ .parameters(paramsBuilder.build())
.build();
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+
if (arguments.get("filePath") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'filePath' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'filePath' is required")), false);
var filePath = arguments.get("filePath").asText();
+ if (inDiffContext && arguments.get("oldRevision") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'oldRevision' is required")), false);
var oldRevision = arguments.get("oldRevision") != null ? arguments.get("oldRevision").asBoolean() : false;
filePath = StringUtils.strip(filePath.replace('\\', '/'), "/");
- var blobIdent = OneDev.getInstance(GitService.class).getBlobIdent(getProject(), getCommitId(oldRevision), filePath);
+ var blobIdent = OneDev.getInstance(GitService.class).getBlobIdent(project, getCommitId(oldRevision), filePath);
if (blobIdent == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "File not found")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "File not found")), false);
if (!blobIdent.isFile())
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Not a file")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Not a file")), false);
- var blob = getProject().getBlob(blobIdent, true);
+ var blob = project.getBlob(blobIdent, true);
if (blob.getText() != null) {
var content = blob.getText().getContent();
if (content.length() > MAX_FILE_LENGTH)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "File is too large")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "File is too large")), false);
else
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", true, "fileContent", content)), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", true, "fileContent", content)), false);
} else {
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Not a text file")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Not a text file")), false);
}
}
- protected abstract Project getProject();
+ protected abstract Long getProjectId();
protected abstract ObjectId getCommitId(boolean oldRevision);
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/GetFilesAndSubfolders.java b/server-core/src/main/java/io/onedev/server/ai/tools/GetFilesAndSubfolders.java
index cf3effb6b2..7ddd91f4a1 100644
--- a/server-core/src/main/java/io/onedev/server/ai/tools/GetFilesAndSubfolders.java
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/GetFilesAndSubfolders.java
@@ -1,24 +1,25 @@
package io.onedev.server.ai.tools;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static io.onedev.server.ai.ChatToolUtils.getFilesAndFolders;
-import static java.util.concurrent.CompletableFuture.completedFuture;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
+import static io.onedev.server.ai.ToolUtils.getFilesAndFolders;
import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import com.fasterxml.jackson.databind.JsonNode;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
-import io.onedev.server.ai.ChatTool;
-import io.onedev.server.model.Project;
-import io.onedev.server.web.websocket.ChatToolExecution;
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.ProjectService;
-public abstract class GetFilesAndSubfolders implements ChatTool {
+public abstract class GetFilesAndSubfolders implements TaskTool {
@Override
public ToolSpecification getSpecification() {
@@ -27,24 +28,26 @@ public abstract class GetFilesAndSubfolders implements ChatTool {
.description("List all files and subfolders under specified folder in json format")
.parameters(JsonObjectSchema.builder()
.addStringProperty("folderPath").description("Folder path to list all files and subfolders")
- .addBooleanProperty("oldRevision").description("Optionally specify whether to list files and subfolders in old revision in a diff context")
.required("folderPath").build())
.build();
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+
if (arguments.get("folderPath") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'folderPath' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'folderPath' is required")), false);
var folderPath = arguments.get("folderPath").asText();
- var oldRevision = arguments.get("oldRevision") != null ? arguments.get("oldRevision").asBoolean() : false;
- var resultData = Map.of("successful", true, "filesAndSubfolders", getFilesAndFolders(getProject(), getCommitId(oldRevision), folderPath));
- return completedFuture(new ChatToolExecution.Result(convertToJson(resultData), false));
+ var resultData = Map.of("successful", true, "filesAndSubfolders", getFilesAndFolders(project, getCommitId(), folderPath));
+ return new ToolExecutionResult(convertToJson(resultData), false);
}
- protected abstract Project getProject();
+ protected abstract Long getProjectId();
- protected abstract ObjectId getCommitId(boolean oldRevision);
+ protected abstract ObjectId getCommitId();
}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/GetHighlightedText.java b/server-core/src/main/java/io/onedev/server/ai/tools/GetHighlightedText.java
index 3296788cd4..b50915d251 100644
--- a/server-core/src/main/java/io/onedev/server/ai/tools/GetHighlightedText.java
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/GetHighlightedText.java
@@ -1,24 +1,22 @@
package io.onedev.server.ai.tools;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static java.util.concurrent.CompletableFuture.completedFuture;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
import java.util.HashMap;
import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.shiro.subject.Subject;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Joiner;
import dev.langchain4j.agent.tool.ToolSpecification;
import io.onedev.commons.utils.PlanarRange;
-import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
import io.onedev.server.web.util.DiffPlanarRange;
-import io.onedev.server.web.websocket.ChatToolExecution;
-public class GetHighlightedText implements ChatTool {
+public class GetHighlightedText implements TaskTool {
private static final String HIGHLIGHT_BEGIN = "[HIGHLIGHT_BEGIN]";
@@ -43,26 +41,26 @@ public class GetHighlightedText implements ChatTool {
return ToolSpecification.builder()
.name("getHighlightedTextInformation")
.description("""
- Get information of highlighted text in json format, including highlighted text itself,
- path of the file containing highlighted text, and content of the file containing highlighted text
+ Get information of highlighted text in json format, including highlighted text,
+ file path and content containing highlighted text
""")
.build();
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
var map = new HashMap<String, Object>();
map.put("highlightedText", Joiner.on('\n').join(highlightRange.getContent(fileContent)));
- map.put("pathOfFileContainingHighlightedText", filePath);
- map.put("contentOfFileContainingHighlightedText", Joiner.on('\n').join(highlightRange.getContext(fileContent, HIGHLIGHT_BEGIN, HIGHLIGHT_END, OMITTED_LINES, 0, Integer.MAX_VALUE, Integer.MAX_VALUE)));
+ map.put("filePath", filePath);
+ map.put("fileContent", Joiner.on('\n').join(highlightRange.getContext(fileContent, HIGHLIGHT_BEGIN, HIGHLIGHT_END, OMITTED_LINES, 0, Integer.MAX_VALUE, Integer.MAX_VALUE)));
if (highlightRange instanceof DiffPlanarRange diffPlanarRange)
map.put("oldRevision", diffPlanarRange.isLeftSide());
map.put("note", """
- 1. Highlighted text is between %s and %s in content of the file containing it
+ 1. Highlighted text is between %s and %s in file content
2. If property 'oldRevision' is available, it means that text is highlighted in a diff context, and this flag
- should be passed back to tools with this argument when calling them
- """.formatted(HIGHLIGHT_BEGIN, HIGHLIGHT_END));
- return completedFuture(new ChatToolExecution.Result(convertToJson(map), false));
+ should be passed back to tools with this argument when calling them"""
+ .formatted(HIGHLIGHT_BEGIN, HIGHLIGHT_END));
+ return new ToolExecutionResult(convertToJson(map), false);
}
}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/GetRootFilesAndFolders.java b/server-core/src/main/java/io/onedev/server/ai/tools/GetRootFilesAndFolders.java
index 32e2ffdb3f..d3ef9faaf3 100644
--- a/server-core/src/main/java/io/onedev/server/ai/tools/GetRootFilesAndFolders.java
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/GetRootFilesAndFolders.java
@@ -1,41 +1,39 @@
package io.onedev.server.ai.tools;
-import static java.util.concurrent.CompletableFuture.completedFuture;
-
-import java.util.concurrent.CompletableFuture;
-
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import com.fasterxml.jackson.databind.JsonNode;
import dev.langchain4j.agent.tool.ToolSpecification;
-import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
-import io.onedev.server.ai.ChatTool;
-import io.onedev.server.ai.ChatToolUtils;
-import io.onedev.server.model.Project;
-import io.onedev.server.web.websocket.ChatToolExecution;
-
-public abstract class GetRootFilesAndFolders implements ChatTool {
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.ToolUtils;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.ProjectService;
+
+public abstract class GetRootFilesAndFolders implements TaskTool {
@Override
public ToolSpecification getSpecification() {
return ToolSpecification.builder()
.name("getRootFilesAndFolders")
.description("List files and folders under repository root in json format")
- .parameters(JsonObjectSchema.builder()
- .addBooleanProperty("oldRevision").description("Optionally specify whether to list root files and folders in old revision in a diff context")
- .build())
.build();
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- return completedFuture(new ChatToolExecution.Result(ChatToolUtils.getFilesAndFolders(getProject(), getCommitId(false), null), false));
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+ return new ToolExecutionResult(ToolUtils.getFilesAndFolders(project, getCommitId(), null), false);
}
- protected abstract Project getProject();
+ protected abstract Long getProjectId();
- protected abstract ObjectId getCommitId(boolean oldRevision);
+ protected abstract ObjectId getCommitId();
}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/QueryCodeSnippets.java b/server-core/src/main/java/io/onedev/server/ai/tools/QueryCodeSnippets.java
index fa6f609887..0a6f4c9862 100644
--- a/server-core/src/main/java/io/onedev/server/ai/tools/QueryCodeSnippets.java
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/QueryCodeSnippets.java
@@ -1,14 +1,13 @@
package io.onedev.server.ai.tools;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static java.util.concurrent.CompletableFuture.completedFuture;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import com.fasterxml.jackson.databind.JsonNode;
@@ -17,17 +16,18 @@ import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import io.onedev.commons.utils.ExceptionUtils;
import io.onedev.server.OneDev;
-import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.ToolUtils;
import io.onedev.server.git.service.GitService;
-import io.onedev.server.model.Project;
import io.onedev.server.search.code.CodeSearchService;
import io.onedev.server.search.code.query.BlobQuery;
import io.onedev.server.search.code.query.TextQuery;
import io.onedev.server.search.code.query.TooGeneralQueryException;
-import io.onedev.server.web.websocket.ChatToolExecution;
-import io.onedev.server.web.websocket.ChatToolExecution.Result;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.ProjectService;
-public abstract class QueryCodeSnippets implements ChatTool {
+public abstract class QueryCodeSnippets implements TaskTool {
private static final int PAGE_SIZE = 25;
@@ -39,36 +39,50 @@ public abstract class QueryCodeSnippets implements ChatTool {
private static final String OMITTED_LINES = "...OMITTED LINES...";
-
+ private final boolean inDiffContext;
+
+ public QueryCodeSnippets(boolean inDiffContext) {
+ this.inDiffContext = inDiffContext;
+ }
+
@Override
public ToolSpecification getSpecification() {
+ var paramsBuilder = JsonObjectSchema.builder()
+ .addStringProperty("regularExpression").description("Perl-compatible regular expression to query code")
+ .addBooleanProperty("caseSensitive").description("Whether to match code snippets case-sensitively");
+
+ if (inDiffContext)
+ paramsBuilder.addBooleanProperty("oldRevision").description("Specify whether to query code snippets from old revision");
+
+ paramsBuilder.addIntegerProperty("currentPage").description("Current page for the query. First page is 1")
+ .required(ToolUtils.required(inDiffContext, "regularExpression", "caseSensitive", "currentPage"));
+
return ToolSpecification.builder()
.name("queryCodeSnippets")
.description("Query code snippets matching specified perl-compatible regular expression and return result in json format")
- .parameters(JsonObjectSchema.builder()
- .addStringProperty("regularExpression").description("Perl-compatible regular expression to query code")
- .addBooleanProperty("caseSensitive").description("Whether to match code snippets case-sensitively")
- .addBooleanProperty("oldRevision").description("Optionally specify whether to query code snippets in old revision in a diff context")
- .addIntegerProperty("currentPage").description("Current page for the query. First page is 1")
- .required("regularExpression", "caseSensitive", "currentPage")
- .build())
+ .parameters(paramsBuilder.build())
.build();
}
@Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+
if (arguments.get("regularExpression") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'regularExpression' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'regularExpression' is required")), false);
var regularExpression = arguments.get("regularExpression").asText();
if (arguments.get("caseSensitive") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'caseSensitive' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'caseSensitive' is required")), false);
var caseSensitive = arguments.get("caseSensitive").asBoolean();
+ if (inDiffContext && arguments.get("oldRevision") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'oldRevision' is required")), false);
var oldRevision = arguments.get("oldRevision") != null ? arguments.get("oldRevision").asBoolean() : false;
if (arguments.get("currentPage") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'currentPage' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'currentPage' is required")), false);
var currentPage = arguments.get("currentPage").asInt();
- var project = getProject();
var commitId = getCommitId(oldRevision);
try {
BlobQuery query = new TextQuery.Builder(regularExpression)
@@ -98,20 +112,20 @@ public abstract class QueryCodeSnippets implements ChatTool {
"successful", true,
"codeSnippets", codeSnippets,
"hasMorePages", textHits.size() > toIndex);
- return completedFuture(new ChatToolExecution.Result(convertToJson(resultData), false));
+ return new ToolExecutionResult(convertToJson(resultData), false);
} catch (RuntimeException e) {
if (ExceptionUtils.find(e, TooGeneralQueryException.class) != null) {
var resultData = Map.of(
"successful", false,
"failReason", "Regular expression is too short or too general, try a more specific one");
- return completedFuture(new ChatToolExecution.Result(convertToJson(resultData), false));
+ return new ToolExecutionResult(convertToJson(resultData), false);
} else {
throw e;
}
}
}
- protected abstract Project getProject();
+ protected abstract Long getProjectId();
protected abstract ObjectId getCommitId(boolean oldRevision);
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/QueryFilePaths.java b/server-core/src/main/java/io/onedev/server/ai/tools/QueryFilePaths.java
index 27df277b80..84d5cbf3cb 100644
--- a/server-core/src/main/java/io/onedev/server/ai/tools/QueryFilePaths.java
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/QueryFilePaths.java
@@ -1,14 +1,13 @@
package io.onedev.server.ai.tools;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static java.util.concurrent.CompletableFuture.completedFuture;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import com.fasterxml.jackson.databind.JsonNode;
@@ -16,17 +15,17 @@ import com.fasterxml.jackson.databind.JsonNode;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import io.onedev.server.OneDev;
-import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
import io.onedev.server.exception.ExceptionUtils;
-import io.onedev.server.model.Project;
import io.onedev.server.search.code.CodeSearchService;
import io.onedev.server.search.code.query.BlobQuery;
import io.onedev.server.search.code.query.FileQuery;
import io.onedev.server.search.code.query.TooGeneralQueryException;
-import io.onedev.server.web.websocket.ChatToolExecution;
-import io.onedev.server.web.websocket.ChatToolExecution.Result;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.ProjectService;
-public abstract class QueryFilePaths implements ChatTool {
+public abstract class QueryFilePaths implements TaskTool {
private static final int PAGE_SIZE = 25;
@@ -38,7 +37,6 @@ public abstract class QueryFilePaths implements ChatTool {
.parameters(JsonObjectSchema.builder()
.addStringProperty("fileNamePattern").description("File name pattern to query paths (supports wildcards * and ?)")
.addBooleanProperty("caseSensitive").description("Whether to match file names case-sensitively")
- .addBooleanProperty("oldRevision").description("Optionally specify whether to query file paths in old revision in a diff context")
.addIntegerProperty("currentPage").description("Current page for the query. First page is 1")
.required("fileNamePattern", "caseSensitive", "currentPage")
.build())
@@ -46,16 +44,19 @@ public abstract class QueryFilePaths implements ChatTool {
}
@Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+
if (arguments.get("fileNamePattern") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'fileNamePattern' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'fileNamePattern' is required")), false);
var fileNamePattern = arguments.get("fileNamePattern").asText();
if (arguments.get("caseSensitive") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'caseSensitive' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'caseSensitive' is required")), false);
var caseSensitive = arguments.get("caseSensitive").asBoolean();
- var oldRevision = arguments.get("oldRevision") != null ? arguments.get("oldRevision").asBoolean() : false;
if (arguments.get("currentPage") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'currentPage' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'currentPage' is required")), false);
var currentPage = arguments.get("currentPage").asInt();
try {
@@ -63,7 +64,7 @@ public abstract class QueryFilePaths implements ChatTool {
.caseSensitive(caseSensitive)
.count(currentPage * PAGE_SIZE + 1)
.build();
- var fileHits = OneDev.getInstance(CodeSearchService.class).search(getProject(), getCommitId(oldRevision), query);
+ var fileHits = OneDev.getInstance(CodeSearchService.class).search(project, getCommitId(), query);
int fromIndex = (currentPage - 1) * PAGE_SIZE;
int toIndex = Math.min(currentPage * PAGE_SIZE, fileHits.size());
@@ -75,21 +76,21 @@ public abstract class QueryFilePaths implements ChatTool {
"successful", true,
"filePaths", filePaths,
"hasMorePages", fileHits.size() > toIndex);
- return completedFuture(new ChatToolExecution.Result(convertToJson(resultData), false));
+ return new ToolExecutionResult(convertToJson(resultData), false);
} catch (RuntimeException e) {
if (ExceptionUtils.find(e, TooGeneralQueryException.class) != null) {
var resultData = Map.of(
"successful", false,
"failReason", "File name pattern is too short or too general, try a more specific one");
- return completedFuture(new ChatToolExecution.Result(convertToJson(resultData), false));
+ return new ToolExecutionResult(convertToJson(resultData), false);
} else {
throw e;
}
}
}
- protected abstract Project getProject();
+ protected abstract Long getProjectId();
- protected abstract ObjectId getCommitId(boolean oldRevision);
+ protected abstract ObjectId getCommitId();
}
diff --git a/server-core/src/main/java/io/onedev/server/ai/tools/QuerySymbolDefinitions.java b/server-core/src/main/java/io/onedev/server/ai/tools/QuerySymbolDefinitions.java
index 7686e68c6b..333a688030 100644
--- a/server-core/src/main/java/io/onedev/server/ai/tools/QuerySymbolDefinitions.java
+++ b/server-core/src/main/java/io/onedev/server/ai/tools/QuerySymbolDefinitions.java
@@ -1,12 +1,11 @@
package io.onedev.server.ai.tools;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static java.util.concurrent.CompletableFuture.completedFuture;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import com.fasterxml.jackson.databind.JsonNode;
@@ -14,48 +13,65 @@ import com.fasterxml.jackson.databind.JsonNode;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import io.onedev.server.OneDev;
-import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.ToolUtils;
import io.onedev.server.exception.ExceptionUtils;
-import io.onedev.server.model.Project;
import io.onedev.server.search.code.CodeSearchService;
import io.onedev.server.search.code.query.BlobQuery;
import io.onedev.server.search.code.query.SymbolQuery;
import io.onedev.server.search.code.query.TooGeneralQueryException;
-import io.onedev.server.web.websocket.ChatToolExecution;
-import io.onedev.server.web.websocket.ChatToolExecution.Result;
+import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.ProjectService;
-public abstract class QuerySymbolDefinitions implements ChatTool {
+public abstract class QuerySymbolDefinitions implements TaskTool {
private static final int PAGE_SIZE = 25;
+ private final boolean inDiffContext;
+
+ public QuerySymbolDefinitions(boolean inDiffContext) {
+ this.inDiffContext = inDiffContext;
+ }
+
@Override
public ToolSpecification getSpecification() {
+ var paramsBuilder = JsonObjectSchema.builder()
+ .addStringProperty("symbolNamePattern").description("Symbol name pattern to query definitions (supports wildcards * and ?)")
+ .addBooleanProperty("caseSensitive").description("Whether to match symbol names case-sensitively")
+ .addStringProperty("fileNamePatterns").description("Optionally specify file name patterns to query definitions in. Pattern supports wildcards * and ?. Multiple patterns should be separated by comma");
+
+ if (inDiffContext)
+ paramsBuilder.addBooleanProperty("oldRevision").description("Specify whether to query definitions from old revision");
+
+ paramsBuilder
+ .addIntegerProperty("currentPage").description("Current page for the query. First page is 1")
+ .required(ToolUtils.required(inDiffContext, "symbolNamePattern", "caseSensitive", "currentPage"));
return ToolSpecification.builder()
.name("querySymbolDefinitions")
.description("Query definitions of specified symbol name pattern (supports wildcards * and ?) and return result in json format")
- .parameters(JsonObjectSchema.builder()
- .addStringProperty("symbolNamePattern").description("Symbol name pattern to query definitions (supports wildcards * and ?)")
- .addBooleanProperty("caseSensitive").description("Whether to match symbol names case-sensitively")
- .addStringProperty("fileNamePatterns").description("Optionally specify file name patterns to query definitions in. Pattern supports wildcards * and ?. Multiple patterns should be separated by comma")
- .addBooleanProperty("oldRevision").description("Optionally specify whether to query definitions in old revision in a diff context")
- .addIntegerProperty("currentPage").description("Current page for the query. First page is 1")
- .required("symbolNamePattern", "caseSensitive", "currentPage")
- .build())
+ .parameters(paramsBuilder.build())
.build();
}
@Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var project = OneDev.getInstance(ProjectService.class).load(getProjectId());
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+
if (arguments.get("symbolNamePattern") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'symbolNamePattern' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'symbolNamePattern' is required")), false);
var symbolNamePattern = arguments.get("symbolNamePattern").asText();
if (arguments.get("caseSensitive") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'caseSensitive' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'caseSensitive' is required")), false);
var caseSensitive = arguments.get("caseSensitive").asBoolean();
var fileNamePatterns = arguments.get("fileNamePatterns") != null ? arguments.get("fileNamePatterns").asText() : null;
+ if (inDiffContext && arguments.get("oldRevision") == null)
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'oldRevision' is required")), false);
var oldRevision = arguments.get("oldRevision") != null ? arguments.get("oldRevision").asBoolean() : false;
if (arguments.get("currentPage") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'currentPage' is required")), false));
+ return new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'currentPage' is required")), false);
var currentPage = arguments.get("currentPage").asInt();
try {
@@ -65,27 +81,27 @@ public abstract class QuerySymbolDefinitions implements ChatTool {
.local(false)
.count(currentPage * PAGE_SIZE + 1)
.build();
- var symbolHits = OneDev.getInstance(CodeSearchService.class).search(getProject(), getCommitId(oldRevision), query);
+ var symbolHits = OneDev.getInstance(CodeSearchService.class).search(project, getCommitId(oldRevision), query);
int fromIndex = (currentPage - 1) * PAGE_SIZE;
int toIndex = Math.min(currentPage * PAGE_SIZE, symbolHits.size());
var result = Map.of(
"successful", true,
"definitions", symbolHits.subList(fromIndex, toIndex),
"hasMorePages", symbolHits.size() > toIndex);
- return completedFuture(new ChatToolExecution.Result(convertToJson(result), false));
+ return new ToolExecutionResult(convertToJson(result), false);
} catch (RuntimeException e) {
if (ExceptionUtils.find(e, TooGeneralQueryException.class) != null) {
var resultData = Map.of(
"successful", false,
"failReason", "Symbol name pattern is too short or too general, try a more specific one");
- return completedFuture(new ChatToolExecution.Result(convertToJson(resultData), false));
+ return new ToolExecutionResult(convertToJson(resultData), false);
} else {
throw e;
}
}
}
- protected abstract Project getProject();
+ protected abstract Long getProjectId();
protected abstract ObjectId getCommitId(boolean oldRevision);
diff --git a/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.java b/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.java
index 550f39412e..4d88641416 100644
--- a/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.java
+++ b/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.java
@@ -8424,4 +8424,22 @@ public class DataMigrator {
}
}
+ private void migrate217(File dataDir, Stack<Integer> versions) {
+ for (File file : dataDir.listFiles()) {
+ if (file.getName().startsWith("Settings.xml")) {
+ VersionedXmlDoc dom = VersionedXmlDoc.fromFile(file);
+ for (Element element : dom.getRootElement().elements()) {
+ var keyElement = element.element("key");
+ if (keyElement.getTextTrim().equals("AI")) {
+ Element valueElement = element.element("value");
+ if (valueElement != null) {
+ valueElement.addElement("chatPreserveDays").setText("30");
+ }
+ }
+ }
+ dom.writeToFile(file, false);
+ }
+ }
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/model/AiTask.java b/server-core/src/main/java/io/onedev/server/model/AiTask.java
deleted file mode 100644
index 0bdebdd10d..0000000000
--- a/server-core/src/main/java/io/onedev/server/model/AiTask.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.onedev.server.model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-
-import io.onedev.server.ai.ChatToolAware;
-
-@Entity
-public class AiTask extends AbstractEntity {
-
- public static final int MAX_INSTRUCTION_LEN = 100000;
-
- @ManyToOne(fetch=FetchType.LAZY)
- @JoinColumn(nullable=false)
- private User ai;
-
- @Column(nullable=false, length=MAX_INSTRUCTION_LEN)
- private String instruction;
-
- @Lob
- @Column(nullable=false, length=65535)
- private ChatToolAware environment;
-
- public User getAi() {
- return ai;
- }
-
- public void setAi(User ai) {
- this.ai = ai;
- }
-
- public String getInstruction() {
- return instruction;
- }
-
- public void setInstruction(String instruction) {
- this.instruction = instruction;
- }
-
- public ChatToolAware getEnvironment() {
- return environment;
- }
-
- public void setEnvironment(ChatToolAware environment) {
- this.environment = environment;
- }
-
-}
diff --git a/server-core/src/main/java/io/onedev/server/model/CodeComment.java b/server-core/src/main/java/io/onedev/server/model/CodeComment.java
index 4b4bc5830d..a47267c363 100644
--- a/server-core/src/main/java/io/onedev/server/model/CodeComment.java
+++ b/server-core/src/main/java/io/onedev/server/model/CodeComment.java
@@ -1,5 +1,6 @@
package io.onedev.server.model;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
import static io.onedev.server.model.CodeComment.PROP_CREATE_DATE;
import static io.onedev.server.search.entity.EntitySort.Direction.DESCENDING;
@@ -13,7 +14,6 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import org.jspecify.annotations.Nullable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
@@ -26,14 +26,21 @@ import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
+import org.jspecify.annotations.Nullable;
+import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import dev.langchain4j.agent.tool.ToolSpecification;
import io.onedev.server.OneDev;
+import io.onedev.server.ai.CodeCommentHelper;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
import io.onedev.server.attachment.AttachmentStorageSupport;
-import io.onedev.server.service.UserService;
import io.onedev.server.git.service.GitService;
import io.onedev.server.model.support.CompareContext;
import io.onedev.server.model.support.LastActivity;
@@ -41,6 +48,8 @@ import io.onedev.server.model.support.Mark;
import io.onedev.server.model.support.ProjectBelonging;
import io.onedev.server.search.entity.SortField;
import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.CodeCommentService;
+import io.onedev.server.service.UserService;
import io.onedev.server.xodus.VisitInfoService;
@Entity
@@ -313,4 +322,54 @@ public class CodeComment extends ProjectBelonging implements AttachmentStorageSu
return new ArrayList<>(participants);
}
+ public List<TaskTool> getTools() {
+ var commentId = getId();
+ return List.of(
+ new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getCurrentCodeComment")
+ .description("""
+ Get info of current code comment in json format. Commented code is highlighted \
+ and its information can be obtained via relevant tools""")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var comment = getCodeComment(commentId);
+ if (!SecurityUtils.canReadCode(subject, comment.getProject()))
+ throw new UnauthorizedException();
+ return new ToolExecutionResult(convertToJson(CodeCommentHelper.getDetail(comment)), false);
+ }
+
+ },
+ new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getCurrentCodeCommentReplies")
+ .description("Get replies of current code comment in json format")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var comment = getCodeComment(commentId);
+ if (!SecurityUtils.canReadCode(subject, comment.getProject()))
+ throw new UnauthorizedException();
+ return new ToolExecutionResult(convertToJson(CodeCommentHelper.getReplies(comment)), false);
+ }
+
+ }
+ );
+ }
+
+ private static CodeComment getCodeComment(Long commentId) {
+ return OneDev.getInstance(CodeCommentService.class).load(commentId);
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/model/Issue.java b/server-core/src/main/java/io/onedev/server/model/Issue.java
index 3137a9eeef..5332de9b58 100644
--- a/server-core/src/main/java/io/onedev/server/model/Issue.java
+++ b/server-core/src/main/java/io/onedev/server/model/Issue.java
@@ -1,6 +1,7 @@
package io.onedev.server.model;
import static com.fasterxml.jackson.annotation.JsonProperty.Access.READ_ONLY;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
import static io.onedev.server.model.AbstractEntity.PROP_NUMBER;
import static io.onedev.server.model.Issue.PROP_BOARD_POSITION;
import static io.onedev.server.model.Issue.PROP_COMMENT_COUNT;
@@ -57,6 +58,8 @@ import javax.persistence.UniqueConstraint;
import javax.validation.ValidationException;
import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
import org.hibernate.annotations.Cache;
@@ -65,12 +68,17 @@ import org.hibernate.annotations.DynamicUpdate;
import org.jspecify.annotations.Nullable;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import dev.langchain4j.agent.tool.ToolSpecification;
import edu.emory.mathcs.backport.java.util.Collections;
import io.onedev.commons.utils.ExplicitException;
import io.onedev.server.OneDev;
+import io.onedev.server.ai.IssueHelper;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
import io.onedev.server.annotation.Editable;
import io.onedev.server.attachment.AttachmentStorageSupport;
import io.onedev.server.buildspecmodel.inputspec.Input;
@@ -88,6 +96,7 @@ import io.onedev.server.rest.annotation.Api;
import io.onedev.server.search.entity.IssueSortField;
import io.onedev.server.security.SecurityUtils;
import io.onedev.server.service.GroupService;
+import io.onedev.server.service.IssueService;
import io.onedev.server.service.PullRequestService;
import io.onedev.server.service.SettingService;
import io.onedev.server.service.UrlService;
@@ -1354,4 +1363,50 @@ public class Issue extends ProjectBelonging implements AttachmentStorageSupport
return Emojis.getInstance().apply(getTitle()) + " (" + getReference().toString(currentProject)+ ")";
}
+ public List<TaskTool> getTools() {
+ var issueId = getId();
+ return List.of(new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getCurrentIssue")
+ .description("Get info of current issue in json format")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var issue = getIssue(issueId);
+ if (!SecurityUtils.canAccessIssue(subject, issue))
+ throw new UnauthorizedException();
+ return new ToolExecutionResult(convertToJson(IssueHelper.getDetail(issue.getProject(), issue)), false);
+ }
+
+ },
+ new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getCurrentIssueComments")
+ .description("Get comments of current issue in json format")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var issue = getIssue(issueId);
+ if (!SecurityUtils.canAccessIssue(subject, issue))
+ throw new UnauthorizedException();
+ return new ToolExecutionResult(convertToJson(IssueHelper.getComments(issue)), false);
+ }
+
+ });
+ }
+
+ private static Issue getIssue(Long issueId) {
+ return OneDev.getInstance(IssueService.class).load(issueId);
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/model/Project.java b/server-core/src/main/java/io/onedev/server/model/Project.java
index 4f9b96781c..fc0db54198 100644
--- a/server-core/src/main/java/io/onedev/server/model/Project.java
+++ b/server-core/src/main/java/io/onedev/server/model/Project.java
@@ -2003,6 +2003,23 @@ public class Project extends AbstractEntity implements LabelSupport<ProjectLabel
public File getDir() {
return OneDev.getInstance(ProjectService.class).getProjectDir(getId());
}
+
+ public Collection<ProjectEntitlement> getEntitlements() {
+ return entitlements;
+ }
+
+ public void setEntitlements(Collection<ProjectEntitlement> entitlements) {
+ this.entitlements = entitlements;
+ }
+
+ public boolean isEntitledToAi(User ai) {
+ if (ai.getAiSetting().isEntitleToAll())
+ return true;
+ var hierarchyProjects = new ArrayList<Project>();
+ hierarchyProjects.addAll(getAncestors());
+ hierarchyProjects.add(this);
+ return hierarchyProjects.stream().anyMatch(it -> it.getEntitlements().stream().anyMatch(it2 -> it2.getAi().equals(ai)));
+ }
public static String encodePathAsRepoName(String projectPath) {
return projectPath.replace("/", FAKED_GITHUB_REPO_PATH_SEPARATOR);
diff --git a/server-core/src/main/java/io/onedev/server/model/PullRequest.java b/server-core/src/main/java/io/onedev/server/model/PullRequest.java
index 6e8e3a59ad..52ffe32ab9 100644
--- a/server-core/src/main/java/io/onedev/server/model/PullRequest.java
+++ b/server-core/src/main/java/io/onedev/server/model/PullRequest.java
@@ -1,6 +1,9 @@
package io.onedev.server.model;
import static com.fasterxml.jackson.annotation.JsonProperty.Access.READ_ONLY;
+import static io.onedev.server.ai.PullRequestHelper.getDetail;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
+import static io.onedev.server.ai.ToolUtils.getDiffTools;
import static io.onedev.server.model.AbstractEntity.PROP_NUMBER;
import static io.onedev.server.model.PullRequest.PROP_CLOSE_DAY;
import static io.onedev.server.model.PullRequest.PROP_CLOSE_MONTH;
@@ -64,6 +67,8 @@ import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
import org.hibernate.annotations.DynamicUpdate;
@@ -71,13 +76,19 @@ import org.jspecify.annotations.Nullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import dev.langchain4j.agent.tool.ToolSpecification;
import io.onedev.server.OneDev;
+import io.onedev.server.ai.PullRequestHelper;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolExecutionResult;
import io.onedev.server.attachment.AttachmentStorageSupport;
import io.onedev.server.entityreference.EntityReference;
import io.onedev.server.entityreference.PullRequestReference;
+import io.onedev.server.exception.PullRequestReviewRejectedException;
import io.onedev.server.git.GitUtils;
import io.onedev.server.git.service.CommitMessageError;
import io.onedev.server.git.service.GitService;
@@ -94,6 +105,7 @@ import io.onedev.server.model.support.pullrequest.MergeStrategy;
import io.onedev.server.rest.annotation.Api;
import io.onedev.server.search.entity.SortField;
import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.PullRequestReviewService;
import io.onedev.server.service.PullRequestService;
import io.onedev.server.service.UserService;
import io.onedev.server.util.BranchSemantic;
@@ -1485,4 +1497,125 @@ public class PullRequest extends ProjectBelonging
}
}
+ public List<TaskTool> getTools() {
+ var projectId = getProject().getId();
+ var requestId = getId();
+ var oldCommitId = ObjectId.fromString(getBaseCommitHash());
+ var newCommitId = ObjectId.fromString(getLatestUpdate().getHeadCommitHash());
+
+ var tools = new ArrayList<TaskTool>(List.of(
+ new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getCurrentPullRequest")
+ .description("Get info of current OneDev pull request in json format")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var request = getPullRequest(requestId);
+ var project = request.getProject();
+ if (!SecurityUtils.canReadCode(subject, project))
+ throw new UnauthorizedException();
+ return new ToolExecutionResult(convertToJson(getDetail(project, request)), false);
+ }
+
+ },
+ new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getCurrentPullRequestComments")
+ .description("Get comments of current OneDev pull request in json format")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var request = getPullRequest(requestId);
+ if (!SecurityUtils.canReadCode(subject, request.getProject()))
+ throw new UnauthorizedException();
+ return new ToolExecutionResult(convertToJson(PullRequestHelper.getComments(request)), false);
+ }
+
+ },
+ new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("approvePullRequest")
+ .description("Approve current OneDev pull request")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var request = getPullRequest(requestId);
+ var user = SecurityUtils.getUser(subject);
+ if (!SecurityUtils.canReadCode(subject, request.getProject()) || user == null)
+ throw new UnauthorizedException();
+
+ try {
+ getPullRequestReviewService().review(user, request, true, null);
+ return new ToolExecutionResult(convertToJson(Map.of("successful", true)), false);
+ } catch (PullRequestReviewRejectedException e) {
+ var data = Map.of(
+ "successful", false,
+ "failReason", "You are not a reviewer and is not allowed to approve this pull request. Add your option as comment instead");
+ return new ToolExecutionResult(convertToJson(data), false);
+ }
+ }
+
+ },
+ new TaskTool() {
+
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("requestChangesForPullRequest")
+ .description("Request changes for current OneDev pull request")
+ .build();
+ }
+
+ @Override
+ public ToolExecutionResult execute(Subject subject, JsonNode arguments) {
+ var request = getPullRequest(requestId);
+ var user = SecurityUtils.getUser(subject);
+ if (!SecurityUtils.canReadCode(subject, request.getProject()) || user == null)
+ throw new UnauthorizedException();
+
+ try {
+ getPullRequestReviewService().review(user, request, false, null);
+ return new ToolExecutionResult(convertToJson(Map.of("successful", true)), false);
+ } catch (PullRequestReviewRejectedException e) {
+ var data = Map.of(
+ "successful", false,
+ "failReason", "You are not a reviewer and is not allowed to request changes for this pull request. Add your option as comment instead");
+ return new ToolExecutionResult(convertToJson(data), false);
+ }
+ }
+
+ }
+ ));
+ tools.addAll(getDiffTools(projectId, oldCommitId, newCommitId, requestId));
+ return tools;
+ }
+
+ private static PullRequestService getPullRequestService() {
+ return OneDev.getInstance(PullRequestService.class);
+ }
+
+ private static PullRequestReviewService getPullRequestReviewService() {
+ return OneDev.getInstance(PullRequestReviewService.class);
+ }
+
+ private static PullRequest getPullRequest(Long requestId) {
+ return getPullRequestService().load(requestId);
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/model/User.java b/server-core/src/main/java/io/onedev/server/model/User.java
index aae463ac8b..67197c1acd 100644
--- a/server-core/src/main/java/io/onedev/server/model/User.java
+++ b/server-core/src/main/java/io/onedev/server/model/User.java
@@ -6,6 +6,7 @@ import static io.onedev.server.model.User.Type.AI;
import static io.onedev.server.model.User.Type.SERVICE;
import static io.onedev.server.security.SecurityUtils.asPrincipals;
import static io.onedev.server.security.SecurityUtils.asUserPrincipal;
+import static io.onedev.server.security.SecurityUtils.isAdministrator;
import java.util.ArrayList;
import java.util.Collection;
@@ -570,7 +571,7 @@ public class User extends AbstractEntity implements AuthenticationInfo {
@Editable(order=50, description = "" +
"Ordinary: Normal account<br>" +
"Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>" +
- "AI: AI account (working in progress)")
+ "AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request")
public Type getType() {
return type;
}
@@ -1183,28 +1184,42 @@ public class User extends AbstractEntity implements AuthenticationInfo {
var aiUserFacades = userCache.values().stream()
.filter(it -> it.getType() == AI && !it.isDisabled() && !it.getId().equals(getId()))
.collect(Collectors.toList());
- if (aiUserFacades.stream().allMatch(it->it.isEntitleToAll())) {
+ if (isAdministrator(asSubject())) {
entitledAis = aiUserFacades.stream()
.sorted(Comparator.comparing(UserFacade::getDisplayName))
.map(it -> userService.load(it.getId()))
.collect(Collectors.toList());
} else {
- var entitledAiSet = aiUserFacades.stream()
- .filter(it->it.isEntitleToAll())
- .map(it -> userService.load(it.getId()))
- .collect(Collectors.toSet());
- getAiEntitlements().stream().forEach(it -> entitledAiSet.add(it.getAI()));
-
- for (var group: getGroups()) {
- group.getEntitlements().stream().forEach(it -> entitledAiSet.add(it.getAi()));
- }
- entitledAis = new ArrayList<User>(entitledAiSet);
- entitledAis.sort(Comparator.comparing(User::getDisplayName));
+ if (aiUserFacades.stream().allMatch(it->it.isEntitleToAll())) {
+ entitledAis = aiUserFacades.stream()
+ .sorted(Comparator.comparing(UserFacade::getDisplayName))
+ .map(it -> userService.load(it.getId()))
+ .collect(Collectors.toList());
+ } else {
+ var entitledAiSet = aiUserFacades.stream()
+ .filter(it->it.isEntitleToAll())
+ .map(it -> userService.load(it.getId()))
+ .collect(Collectors.toSet());
+ getAiEntitlements().stream().forEach(it -> entitledAiSet.add(it.getAI()));
+
+ for (var group: getGroups()) {
+ group.getEntitlements().stream().forEach(it -> entitledAiSet.add(it.getAi()));
+ }
+ entitledAis = new ArrayList<User>(entitledAiSet);
+ entitledAis.sort(Comparator.comparing(User::getDisplayName));
+ }
}
}
return entitledAis;
}
+ public boolean isEntitledToAi(User ai) {
+ return isAdministrator(asSubject())
+ || ai.getAiSetting().isEntitleToAll()
+ || getAiEntitlements().stream().anyMatch(it -> it.getAI().equals(ai))
+ || getGroups().stream().anyMatch(it -> it.getEntitlements().stream().anyMatch(it2 -> it2.getAi().equals(ai)));
+ }
+
public UserFacade getFacade() {
return new UserFacade(getId(), getName(), getFullName(), getType(), isDisabled(), getAiSetting().isEntitleToAll());
}
diff --git a/server-core/src/main/java/io/onedev/server/model/support/AiSetting.java b/server-core/src/main/java/io/onedev/server/model/support/AiSetting.java
index 1387c12fb1..3bf64f8129 100644
--- a/server-core/src/main/java/io/onedev/server/model/support/AiSetting.java
+++ b/server-core/src/main/java/io/onedev/server/model/support/AiSetting.java
@@ -10,7 +10,7 @@ public class AiSetting implements Serializable {
private AiModelSetting modelSetting;
- private boolean entitleToAll = true;
+ private boolean entitleToAll;
private String systemPrompt;
diff --git a/server-core/src/main/java/io/onedev/server/model/support/Mark.java b/server-core/src/main/java/io/onedev/server/model/support/Mark.java
index 70f292cacf..071b9aa350 100644
--- a/server-core/src/main/java/io/onedev/server/model/support/Mark.java
+++ b/server-core/src/main/java/io/onedev/server/model/support/Mark.java
@@ -106,6 +106,18 @@ public class Mark implements Serializable {
public BlobIdent getBlobIdent() {
return new BlobIdent(commitHash, path);
}
+
+ @Nullable
+ public Mark permanentize(Project project, ObjectId oldCommitId, ObjectId newCommitId, ObjectId comparisonBase) {
+ if (getCommitHash().equals(comparisonBase.name())) {
+ return mapTo(project, oldCommitId);
+ } else if (getCommitHash().equals(oldCommitId.name())
+ || getCommitHash().equals(newCommitId.name())) {
+ return this;
+ } else {
+ return null;
+ }
+ }
@Nullable
public Mark mapTo(Project project, ObjectId commitId) {
diff --git a/server-core/src/main/java/io/onedev/server/model/support/administration/AiSetting.java b/server-core/src/main/java/io/onedev/server/model/support/administration/AiSetting.java
index f877d33bb1..d2dc8256d9 100644
--- a/server-core/src/main/java/io/onedev/server/model/support/administration/AiSetting.java
+++ b/server-core/src/main/java/io/onedev/server/model/support/administration/AiSetting.java
@@ -2,10 +2,13 @@ package io.onedev.server.model.support.administration;
import java.io.Serializable;
+import javax.validation.constraints.Min;
+
import org.jspecify.annotations.Nullable;
import dev.langchain4j.model.chat.ChatModel;
import io.onedev.server.annotation.Editable;
+import io.onedev.server.annotation.OmitName;
import io.onedev.server.model.support.AiModelSetting;
@Editable
@@ -15,8 +18,12 @@ public class AiSetting implements Serializable {
public static final String PROP_LITE_MODEL_SETTING = "liteModelSetting";
+ public static final String PROP_CHAT_PRESERVE_DAYS = "chatPreserveDays";
+
private AiModelSetting liteModelSetting;
+ private int chatPreserveDays = 30;
+
@Editable(order=100)
@Nullable
public AiModelSetting getLiteModelSetting() {
@@ -32,4 +39,15 @@ public class AiSetting implements Serializable {
return liteModelSetting != null ? liteModelSetting.getChatModel() : null;
}
+ @Editable(order=200)
+ @Min(value = 1, message = "At least 1 day should be specified")
+ @OmitName
+ public int getChatPreserveDays() {
+ return chatPreserveDays;
+ }
+
+ public void setChatPreserveDays(int chatPreserveDays) {
+ this.chatPreserveDays = chatPreserveDays;
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/notification/CodeCommentNotificationManager.java b/server-core/src/main/java/io/onedev/server/notification/CodeCommentNotificationManager.java
index 40f22e1950..66cc2c4b18 100644
--- a/server-core/src/main/java/io/onedev/server/notification/CodeCommentNotificationManager.java
+++ b/server-core/src/main/java/io/onedev/server/notification/CodeCommentNotificationManager.java
@@ -1,9 +1,22 @@
package io.onedev.server.notification;
+import static io.onedev.server.notification.NotificationUtils.getEmailBody;
+import static java.util.stream.Collectors.toSet;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jspecify.annotations.Nullable;
+
import com.google.common.collect.Lists;
+
import io.onedev.commons.utils.StringUtils;
-import io.onedev.server.service.CodeCommentMentionService;
-import io.onedev.server.service.UserService;
+import io.onedev.server.ai.AiTask;
+import io.onedev.server.ai.responsehandlers.AddCodeCommentReply;
import io.onedev.server.event.Listen;
import io.onedev.server.event.project.codecomment.CodeCommentEdited;
import io.onedev.server.event.project.codecomment.CodeCommentEvent;
@@ -14,20 +27,15 @@ import io.onedev.server.model.CodeCommentStatusChange;
import io.onedev.server.model.User;
import io.onedev.server.model.support.EntityComment;
import io.onedev.server.persistence.annotation.Transactional;
+import io.onedev.server.service.CodeCommentMentionService;
+import io.onedev.server.service.UserService;
import io.onedev.server.util.commenttext.MarkdownText;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import static io.onedev.server.notification.NotificationUtils.getEmailBody;
-import static java.util.stream.Collectors.toSet;
-
@Singleton
public class CodeCommentNotificationManager {
+ private static final int AI_TASK_TIMEOUT_SECONDS = 300;
+
@Inject
private MailService mailService;
@@ -53,16 +61,32 @@ public class CodeCommentNotificationManager {
if (markdown != null) {
for (String userName : new MentionParser().parseMentions(markdown.getRendered())) {
- User user = userService.findByName(userName);
- if (user != null) {
- mentionService.mention(comment, user);
- notifyUsers.add(user);
+ User mentionedUser = userService.findByName(userName);
+ if (mentionedUser != null) {
+ mentionService.mention(comment, mentionedUser);
+ if (mentionedUser.getType() == User.Type.AI) {
+ if (!(event instanceof CodeCommentEdited) && isAiEntitled(event.getUser(), comment, mentionedUser)) {
+ String systemPrompt = """
+ You are mentioned in a code comment. The content mentioning you is presented as user prompt. \
+ Use existing replies as conversation context. Call relevant tools to get information about \
+ the code comment if necessary.""";
+ var task = new AiTask(
+ systemPrompt.formatted(mentionedUser.getName()),
+ event.getTextBody(),
+ comment.getTools(),
+ new AddCodeCommentReply(comment.getId()));
+ userService.execute(mentionedUser, task, AI_TASK_TIMEOUT_SECONDS);
+ }
+ } else {
+ notifyUsers.add(mentionedUser);
+ }
}
}
}
Set<String> emailAddresses = notifyUsers.stream()
.filter(it -> it.isOrdinary()
+ && it.getType() != User.Type.AI
&& (!it.equals(event.getUser()) || it.isNotifyOwnEvents())
&& it.getPrimaryEmailAddress() != null
&& it.getPrimaryEmailAddress().isVerified())
@@ -92,4 +116,23 @@ public class CodeCommentNotificationManager {
}
}
}
+
+ private boolean isAiEntitled(@Nullable User user, CodeComment comment, User ai) {
+ if (user != null && user.isOrdinary()) {
+ if (user.isEntitledToAi(ai)) {
+ return true;
+ } else {
+ new AddCodeCommentReply(comment.getId()).onResponse(user, "@%s sorry but you are not entitled to access me".formatted(user.getName()));
+ return false;
+ }
+ } else {
+ if (comment.getProject().isEntitledToAi(ai)) {
+ return true;
+ } else {
+ new AddCodeCommentReply(comment.getId()).onResponse(ai, "Sorry but this project is not entitled to access me");
+ return false;
+ }
+ }
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/notification/IssueNotificationManager.java b/server-core/src/main/java/io/onedev/server/notification/IssueNotificationManager.java
index cff2401e4d..5ca4352c6a 100644
--- a/server-core/src/main/java/io/onedev/server/notification/IssueNotificationManager.java
+++ b/server-core/src/main/java/io/onedev/server/notification/IssueNotificationManager.java
@@ -1,8 +1,28 @@
package io.onedev.server.notification;
+import static io.onedev.server.notification.NotificationUtils.getEmailBody;
+import static io.onedev.server.notification.NotificationUtils.isNotified;
+import static io.onedev.server.util.EmailAddressUtils.describe;
+import static org.unbescape.html.HtmlEscape.escapeHtml5;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.mail.internet.InternetAddress;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jspecify.annotations.Nullable;
+
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import io.onedev.server.service.*;
+
+import io.onedev.server.ai.AiTask;
+import io.onedev.server.ai.responsehandlers.AddIssueComment;
import io.onedev.server.event.Listen;
import io.onedev.server.event.project.issue.IssueCommentCreated;
import io.onedev.server.event.project.issue.IssueEvent;
@@ -10,7 +30,12 @@ import io.onedev.server.event.project.issue.IssueOpened;
import io.onedev.server.event.project.issue.IssuesMoved;
import io.onedev.server.mail.MailService;
import io.onedev.server.markdown.MentionParser;
-import io.onedev.server.model.*;
+import io.onedev.server.model.EmailAddress;
+import io.onedev.server.model.Group;
+import io.onedev.server.model.Issue;
+import io.onedev.server.model.IssueComment;
+import io.onedev.server.model.IssueWatch;
+import io.onedev.server.model.User;
import io.onedev.server.model.support.NamedQuery;
import io.onedev.server.model.support.QueryPersonalization;
import io.onedev.server.persistence.annotation.Transactional;
@@ -19,26 +44,24 @@ import io.onedev.server.search.entity.QueryWatchBuilder;
import io.onedev.server.search.entity.issue.IssueQuery;
import io.onedev.server.search.entity.issue.IssueQueryParseOption;
import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.IssueAuthorizationService;
+import io.onedev.server.service.IssueMentionService;
+import io.onedev.server.service.IssueQueryPersonalizationService;
+import io.onedev.server.service.IssueService;
+import io.onedev.server.service.IssueWatchService;
+import io.onedev.server.service.SettingService;
+import io.onedev.server.service.UrlService;
+import io.onedev.server.service.UserService;
import io.onedev.server.util.ProjectScope;
import io.onedev.server.util.commenttext.MarkdownText;
import io.onedev.server.web.asset.emoji.Emojis;
import io.onedev.server.xodus.VisitInfoService;
-import org.apache.commons.lang3.StringUtils;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import javax.mail.internet.InternetAddress;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static io.onedev.server.notification.NotificationUtils.getEmailBody;
-import static io.onedev.server.notification.NotificationUtils.isNotified;
-import static io.onedev.server.util.EmailAddressUtils.describe;
-import static org.unbescape.html.HtmlEscape.escapeHtml5;
@Singleton
public class IssueNotificationManager {
+ private static final int AI_TASK_TIMEOUT_SECONDS = 300;
+
@Inject
private MailService mailService;
@@ -176,7 +199,7 @@ public class IssueNotificationManager {
if (user != null) {
if (!user.isNotifyOwnEvents() || isNotified(notifiedEmailAddresses, user))
notifiedUsers.add(user);
- if (!user.isSystem() && user.getType() != User.Type.SERVICE)
+ if (!user.isSystem() && user.getType() != User.Type.AI)
watchService.watch(issue, user, true);
}
@@ -195,19 +218,23 @@ public class IssueNotificationManager {
String threadingReferences = String.format("<you-in-field-%s-%s@onedev>", entry.getKey(), issue.getUUID());
for (User member: entry.getValue().getMembers()) {
if (!member.equals(user)) {
- EmailAddress emailAddress = member.getPrimaryEmailAddress();
- if (emailAddress != null && emailAddress.isVerified()) {
- mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
- Lists.newArrayList(), Lists.newArrayList(), subject,
- getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
- getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
- replyAddress, senderName, threadingReferences);
+ if (member.getType() != User.Type.AI) {
+ EmailAddress emailAddress = member.getPrimaryEmailAddress();
+ if (emailAddress != null && emailAddress.isVerified()) {
+ mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
+ Lists.newArrayList(), Lists.newArrayList(), subject,
+ getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
+ getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
+ replyAddress, senderName, threadingReferences);
+ }
+ } else if (isAiEntitled(user, issue, member)) {
+ new AddIssueComment(issue.getId()).onResponse(member, "I don't know how to work as role '%s' yet".formatted(entry.getKey()));
}
}
}
for (User member: entry.getValue().getMembers()) {
- if (member.getType() != User.Type.SERVICE)
+ if (member.getType() != User.Type.AI)
watchService.watch(issue, member, true);
authorizationService.authorize(issue, member);
}
@@ -224,19 +251,23 @@ public class IssueNotificationManager {
String threadingReferences = String.format("<you-in-field-%s-%s@onedev>", entry.getKey(), issue.getUUID());
for (User member: entry.getValue()) {
if (!member.equals(user)) {
- EmailAddress emailAddress = member.getPrimaryEmailAddress();
- if (emailAddress != null && emailAddress.isVerified()) {
- mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
- Lists.newArrayList(), Lists.newArrayList(), subject,
- getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
- getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
- replyAddress, senderName, threadingReferences);
- }
+ if (member.getType() != User.Type.AI) {
+ EmailAddress emailAddress = member.getPrimaryEmailAddress();
+ if (emailAddress != null && emailAddress.isVerified()) {
+ mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
+ Lists.newArrayList(), Lists.newArrayList(), subject,
+ getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
+ getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
+ replyAddress, senderName, threadingReferences);
+ }
+ } else if (isAiEntitled(user, issue, member)) {
+ new AddIssueComment(issue.getId()).onResponse(member, "I don't know how to work as role '%s' yet".formatted(entry.getKey()));
+ }
}
}
for (User each: entry.getValue()) {
- if (each.getType() != User.Type.SERVICE)
+ if (each.getType() != User.Type.AI)
watchService.watch(issue, each, true);
authorizationService.authorize(issue, each);
}
@@ -249,23 +280,38 @@ public class IssueNotificationManager {
User mentionedUser = userService.findByName(userName);
if (mentionedUser != null) {
mentionService.mention(issue, mentionedUser);
- if (mentionedUser.getType() != User.Type.SERVICE)
- watchService.watch(issue, mentionedUser, true);
authorizationService.authorize(issue, mentionedUser);
- if (!isNotified(notifiedEmailAddresses, mentionedUser)) {
- String subject = String.format(
- "[Issue %s] (Mentioned You) %s",
- issue.getReference(),
- emojis.apply(issue.getTitle()));
- String threadingReferences = String.format("<mentioned-%s@onedev>", issue.getUUID());
-
- EmailAddress emailAddress = mentionedUser.getPrimaryEmailAddress();
- if (emailAddress != null && emailAddress.isVerified()) {
- mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
- Sets.newHashSet(), Sets.newHashSet(), subject,
- getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
- getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
- replyAddress, senderName, threadingReferences);
+ if (mentionedUser.getType() != User.Type.AI)
+ watchService.watch(issue, mentionedUser, true);
+ if (!isNotified(notifiedEmailAddresses, mentionedUser)) {
+ if (mentionedUser.getType() != User.Type.AI) {
+ String subject = String.format(
+ "[Issue %s] (Mentioned You) %s",
+ issue.getReference(),
+ emojis.apply(issue.getTitle()));
+ String threadingReferences = String.format("<mentioned-%s@onedev>", issue.getUUID());
+
+ EmailAddress emailAddress = mentionedUser.getPrimaryEmailAddress();
+ if (emailAddress != null && emailAddress.isVerified()) {
+ mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
+ Sets.newHashSet(), Sets.newHashSet(), subject,
+ getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
+ getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
+ replyAddress, senderName, threadingReferences);
+ }
+ } else if (isAiEntitled(user, issue, mentionedUser)) {
+ if (event instanceof IssueOpened || event instanceof IssueCommentCreated) {
+ var systemPrompt = """
+ You are mentioned in an issue. The content mentioning you is presented as user prompt. \
+ Use existing comments as conversation context. Call relevant tools to get information \
+ about the issue if necessary""";
+ var task = new AiTask(
+ systemPrompt.formatted(mentionedUser.getName()),
+ event.getTextBody(),
+ issue.getTools(),
+ new AddIssueComment(issue.getId()));
+ userService.execute(mentionedUser, task, AI_TASK_TIMEOUT_SECONDS);
+ }
}
notifiedUsers.add(mentionedUser);
}
@@ -389,4 +435,22 @@ public class IssueNotificationManager {
}
}
+ private boolean isAiEntitled(@Nullable User user, Issue issue, User ai) {
+ if (user != null && user.isOrdinary()) {
+ if (user.isEntitledToAi(ai)) {
+ return true;
+ } else {
+ new AddIssueComment(issue.getId()).onResponse(user, "@%s sorry but you are not entitled to access me".formatted(user.getName()));
+ return false;
+ }
+ } else {
+ if (issue.getProject().isEntitledToAi(ai)) {
+ return true;
+ } else {
+ new AddIssueComment(issue.getId()).onResponse(ai, "Sorry but this project is not entitled to access me");
+ return false;
+ }
+ }
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java b/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java
index a1a4736344..e34f398cae 100644
--- a/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java
+++ b/server-core/src/main/java/io/onedev/server/notification/PullRequestNotificationManager.java
@@ -1,17 +1,51 @@
package io.onedev.server.notification;
+import static io.onedev.server.notification.NotificationUtils.getEmailBody;
+import static io.onedev.server.notification.NotificationUtils.isNotified;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.WordUtils;
+import org.apache.shiro.authz.Permission;
+import org.jspecify.annotations.Nullable;
+
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import io.onedev.server.service.PullRequestMentionService;
-import io.onedev.server.service.PullRequestWatchService;
-import io.onedev.server.service.SettingService;
-import io.onedev.server.service.UserService;
+
+import io.onedev.server.ai.AiTask;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.responsehandlers.AddCodeCommentReply;
+import io.onedev.server.ai.responsehandlers.AddPullRequestComment;
import io.onedev.server.event.Listen;
-import io.onedev.server.event.project.pullrequest.*;
+import io.onedev.server.event.project.pullrequest.PullRequestAssigned;
+import io.onedev.server.event.project.pullrequest.PullRequestChanged;
+import io.onedev.server.event.project.pullrequest.PullRequestCodeCommentCreated;
+import io.onedev.server.event.project.pullrequest.PullRequestCodeCommentEvent;
+import io.onedev.server.event.project.pullrequest.PullRequestCodeCommentReplyCreated;
+import io.onedev.server.event.project.pullrequest.PullRequestCommentCreated;
+import io.onedev.server.event.project.pullrequest.PullRequestEvent;
+import io.onedev.server.event.project.pullrequest.PullRequestOpened;
+import io.onedev.server.event.project.pullrequest.PullRequestReviewRequested;
+import io.onedev.server.event.project.pullrequest.PullRequestUpdated;
import io.onedev.server.mail.MailService;
import io.onedev.server.markdown.MentionParser;
-import io.onedev.server.model.*;
+import io.onedev.server.model.EmailAddress;
+import io.onedev.server.model.PullRequest;
+import io.onedev.server.model.PullRequestAssignment;
+import io.onedev.server.model.PullRequestReview;
import io.onedev.server.model.PullRequestReview.Status;
+import io.onedev.server.model.PullRequestWatch;
+import io.onedev.server.model.User;
import io.onedev.server.model.support.NamedQuery;
import io.onedev.server.model.support.QueryPersonalization;
import io.onedev.server.model.support.pullrequest.changedata.PullRequestApproveData;
@@ -24,24 +58,19 @@ import io.onedev.server.search.entity.QueryWatchBuilder;
import io.onedev.server.search.entity.pullrequest.PullRequestQuery;
import io.onedev.server.security.permission.ProjectPermission;
import io.onedev.server.security.permission.ReadCode;
+import io.onedev.server.service.PullRequestMentionService;
+import io.onedev.server.service.PullRequestWatchService;
+import io.onedev.server.service.SettingService;
+import io.onedev.server.service.UserService;
import io.onedev.server.util.commenttext.MarkdownText;
import io.onedev.server.web.asset.emoji.Emojis;
import io.onedev.server.xodus.VisitInfoService;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.text.WordUtils;
-import org.apache.shiro.authz.Permission;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static io.onedev.server.notification.NotificationUtils.getEmailBody;
-import static io.onedev.server.notification.NotificationUtils.isNotified;
@Singleton
public class PullRequestNotificationManager {
+ private static final int AI_TASK_TIMEOUT_SECONDS = 300;
+
@Inject
private MailService mailService;
@@ -131,7 +160,7 @@ public class PullRequestNotificationManager {
if (user != null) {
if (!user.isNotifyOwnEvents() || isNotified(notifiedEmailAddresses, user))
notifiedUsers.add(user);
- if (!user.isSystem() && user.getType() != User.Type.SERVICE)
+ if (!user.isSystem() && user.getType() != User.Type.AI)
watchService.watch(request, user, true);
}
@@ -144,7 +173,7 @@ public class PullRequestNotificationManager {
notifiedUsers.add(committer);
}
for (User each : committers) {
- if (!each.isSystem() && each.getType() != User.Type.SERVICE)
+ if (!each.isSystem() && each.getType() != User.Type.AI)
watchService.watch(request, each, true);
}
}
@@ -182,20 +211,27 @@ public class PullRequestNotificationManager {
|| changeData instanceof PullRequestRequestedForChangesData
|| changeData instanceof PullRequestDiscardData)
&& request.getSubmitter() != null && !notifiedUsers.contains(request.getSubmitter())) {
- String subject = String.format(
- "[Pull Request %s] (%s) %s",
- request.getReference(),
- WordUtils.capitalize(changeData.getActivity()),
- emojis.apply(request.getTitle()));
- String threadingReferences = String.format("<%s-%s@onedev>",
- changeData.getActivity().replace(' ', '-'), request.getUUID());
- EmailAddress emailAddress = request.getSubmitter().getPrimaryEmailAddress();
- if (emailAddress != null && emailAddress.isVerified()) {
- mailService.sendMailAsync(Lists.newArrayList(emailAddress.getValue()),
- Lists.newArrayList(), Lists.newArrayList(), subject,
- getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
- getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
- replyAddress, senderName, threadingReferences);
+ if (request.getSubmitter().getType() != User.Type.AI) {
+ String subject = String.format(
+ "[Pull Request %s] (%s) %s",
+ request.getReference(),
+ WordUtils.capitalize(changeData.getActivity()),
+ emojis.apply(request.getTitle()));
+ String threadingReferences = String.format("<%s-%s@onedev>",
+ changeData.getActivity().replace(' ', '-'), request.getUUID());
+ EmailAddress emailAddress = request.getSubmitter().getPrimaryEmailAddress();
+ if (emailAddress != null && emailAddress.isVerified()) {
+ mailService.sendMailAsync(Lists.newArrayList(emailAddress.getValue()),
+ Lists.newArrayList(), Lists.newArrayList(), subject,
+ getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
+ getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
+ replyAddress, senderName, threadingReferences);
+ }
+ } else if (changeData instanceof PullRequestRequestedForChangesData
+ && isAiEntitled(user, request, request.getSubmitter())) {
+ new AddPullRequestComment(request.getId()).onResponse(
+ request.getSubmitter(),
+ "I don't know how to improve the pull request yet");
}
notifiedUsers.add(request.getSubmitter());
}
@@ -206,53 +242,72 @@ public class PullRequestNotificationManager {
}
for (User assignee : assignees) {
- if (assignee.getType() != User.Type.SERVICE)
+ if (assignee.getType() != User.Type.AI)
watchService.watch(request, assignee, true);
if (!notifiedUsers.contains(assignee)) {
- String subject = String.format(
- "[Pull Request %s] (Assigned) %s",
- request.getReference(),
- emojis.apply(request.getTitle()));
- String threadingReferences = String.format("<assigned-%s@onedev>", request.getUUID());
- String assignmentSummary;
- if (user != null)
- assignmentSummary = user.getDisplayName() + " assigned to you";
- else
- assignmentSummary = "Assigned to you";
- EmailAddress emailAddress = assignee.getPrimaryEmailAddress();
- if (emailAddress != null && emailAddress.isVerified()) {
- mailService.sendMailAsync(Lists.newArrayList(emailAddress.getValue()),
- Lists.newArrayList(), Lists.newArrayList(), subject,
- getEmailBody(true, event, assignmentSummary, event.getHtmlBody(), url, replyable, null),
- getEmailBody(false, event, assignmentSummary, event.getTextBody(), url, replyable, null),
- replyAddress, senderName, threadingReferences);
+ if (assignee.getType() != User.Type.AI) {
+ String subject = String.format(
+ "[Pull Request %s] (Assigned) %s",
+ request.getReference(),
+ emojis.apply(request.getTitle()));
+ String threadingReferences = String.format("<assigned-%s@onedev>", request.getUUID());
+ String assignmentSummary;
+ if (user != null)
+ assignmentSummary = user.getDisplayName() + " assigned to you";
+ else
+ assignmentSummary = "Assigned to you";
+ EmailAddress emailAddress = assignee.getPrimaryEmailAddress();
+ if (emailAddress != null && emailAddress.isVerified()) {
+ mailService.sendMailAsync(Lists.newArrayList(emailAddress.getValue()),
+ Lists.newArrayList(), Lists.newArrayList(), subject,
+ getEmailBody(true, event, assignmentSummary, event.getHtmlBody(), url, replyable, null),
+ getEmailBody(false, event, assignmentSummary, event.getTextBody(), url, replyable, null),
+ replyAddress, senderName, threadingReferences);
+ }
+ } else if (isAiEntitled(user, request, assignee)) {
+ new AddPullRequestComment(request.getId()).onResponse(assignee, "I don't know how to work as assignee yet");
}
notifiedUsers.add(assignee);
}
}
for (User reviewer : reviewers) {
- if (reviewer.getType() != User.Type.SERVICE)
+ if (reviewer.getType() != User.Type.AI)
watchService.watch(request, reviewer, true);
if (!notifiedUsers.contains(reviewer)) {
- String subject = String.format(
+ if (reviewer.getType() != User.Type.AI) {
+ String subject = String.format(
"[Pull Request %s] (Review Request) %s",
request.getReference(),
emojis.apply(request.getTitle()));
- String threadingReferences = String.format("<review-invitation-%s@onedev>", request.getUUID());
- String reviewInvitationSummary;
- if (user != null)
- reviewInvitationSummary = user.getDisplayName() + " requested review from you";
- else
- reviewInvitationSummary = "Requested review from you";
-
- EmailAddress emailAddress = reviewer.getPrimaryEmailAddress();
- if (emailAddress != null && emailAddress.isVerified()) {
- mailService.sendMailAsync(Lists.newArrayList(emailAddress.getValue()),
- Lists.newArrayList(), Lists.newArrayList(), subject,
- getEmailBody(true, event, reviewInvitationSummary, event.getHtmlBody(), url, replyable, null),
- getEmailBody(false, event, reviewInvitationSummary, event.getTextBody(), url, replyable, null),
- replyAddress, senderName, threadingReferences);
+ String threadingReferences = String.format("<review-invitation-%s@onedev>", request.getUUID());
+ String reviewInvitationSummary;
+ if (user != null)
+ reviewInvitationSummary = user.getDisplayName() + " requested review from you";
+ else
+ reviewInvitationSummary = "Requested review from you";
+
+ EmailAddress emailAddress = reviewer.getPrimaryEmailAddress();
+ if (emailAddress != null && emailAddress.isVerified()) {
+ mailService.sendMailAsync(Lists.newArrayList(emailAddress.getValue()),
+ Lists.newArrayList(), Lists.newArrayList(), subject,
+ getEmailBody(true, event, reviewInvitationSummary, event.getHtmlBody(), url, replyable, null),
+ getEmailBody(false, event, reviewInvitationSummary, event.getTextBody(), url, replyable, null),
+ replyAddress, senderName, threadingReferences);
+ }
+ } else if (isAiEntitled(null, request, reviewer)) {
+ var task = new AiTask(
+ null,
+ """
+ Review current pull request for major issues (ignore styling/format/documentation issues) \
+ introduced in the change. Check full content of relevant files to understand the change \
+ if necessary. Check existing comments for conversation context. Approve the pull request \
+ if you are satisfied with it, or request for changes if you think it needs more work. \
+ Summarize found issues in response and for each issue, make sure to quote relevant code \
+ snippets if applicable""",
+ request.getTools(),
+ new AddPullRequestComment(request.getId()));
+ userService.execute(reviewer, task, AI_TASK_TIMEOUT_SECONDS);
}
notifiedUsers.add(reviewer);
}
@@ -264,22 +319,52 @@ public class PullRequestNotificationManager {
User mentionedUser = userService.findByName(userName);
if (mentionedUser != null) {
mentionService.mention(request, mentionedUser);
- if (mentionedUser.getType() != User.Type.SERVICE)
+ if (mentionedUser.getType() != User.Type.AI)
watchService.watch(request, mentionedUser, true);
if (!isNotified(notifiedEmailAddresses, mentionedUser)) {
- String subject = String.format(
- "[Pull Request %s] (Mentioned You) %s",
- request.getReference(),
- emojis.apply(request.getTitle()));
- String threadingReferences = String.format("<mentioned-%s@onedev>", request.getUUID());
-
- EmailAddress emailAddress = mentionedUser.getPrimaryEmailAddress();
- if (emailAddress != null && emailAddress.isVerified()) {
- mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
- Sets.newHashSet(), Sets.newHashSet(), subject,
- getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
- getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
- replyAddress, senderName, threadingReferences);
+ if (mentionedUser.getType() != User.Type.AI) {
+ String subject = String.format(
+ "[Pull Request %s] (Mentioned You) %s",
+ request.getReference(),
+ emojis.apply(request.getTitle()));
+ String threadingReferences = String.format("<mentioned-%s@onedev>", request.getUUID());
+
+ EmailAddress emailAddress = mentionedUser.getPrimaryEmailAddress();
+ if (emailAddress != null && emailAddress.isVerified()) {
+ mailService.sendMailAsync(Sets.newHashSet(emailAddress.getValue()),
+ Sets.newHashSet(), Sets.newHashSet(), subject,
+ getEmailBody(true, event, summary, event.getHtmlBody(), url, replyable, null),
+ getEmailBody(false, event, summary, event.getTextBody(), url, replyable, null),
+ replyAddress, senderName, threadingReferences);
+ }
+ } else if (isAiEntitled(user, request, mentionedUser)) {
+ if (event instanceof PullRequestOpened || event instanceof PullRequestCommentCreated) {
+ var systemPrompt = """
+ You are mentioned in a pull request. The content mentioning you is presented as user \
+ prompt. Use existing comments as conversation context. Call relevant tools to get \
+ information about the pull request if necessary""";
+ var task = new AiTask(
+ systemPrompt.formatted(mentionedUser.getName()),
+ event.getTextBody(),
+ request.getTools(),
+ new AddPullRequestComment(request.getId()));
+ userService.execute(mentionedUser, task, AI_TASK_TIMEOUT_SECONDS);
+ } else if (event instanceof PullRequestCodeCommentCreated || event instanceof PullRequestCodeCommentReplyCreated) {
+ String systemPrompt = """
+ You are mentioned in a pull request code comment. The content mentioning you is presented \
+ as user prompt. Use existing comments as conversation context. Call relevant tools to get \
+ information about the code comment and pull request if necessary""";
+ var tools = new ArrayList<TaskTool>(request.getTools());
+ var codeCommentEvent = (PullRequestCodeCommentEvent) event;
+ var comment = codeCommentEvent.getComment();
+ tools.addAll(comment.getTools());
+ var task = new AiTask(
+ systemPrompt.formatted(mentionedUser.getName()),
+ event.getTextBody(),
+ tools,
+ new AddCodeCommentReply(comment.getId()));
+ userService.execute(mentionedUser, task, AI_TASK_TIMEOUT_SECONDS);
+ }
}
notifiedUsers.add(mentionedUser);
}
@@ -329,4 +414,22 @@ public class PullRequestNotificationManager {
}
}
+ private boolean isAiEntitled(@Nullable User user, PullRequest request, User ai) {
+ if (user != null && user.isOrdinary()) {
+ if (user.isEntitledToAi(ai)) {
+ return true;
+ } else {
+ new AddPullRequestComment(request.getId()).onResponse(user, "@%s sorry but you are not entitled to access me".formatted(user.getName()));
+ return false;
+ }
+ } else {
+ if (request.getProject().isEntitledToAi(ai)) {
+ return true;
+ } else {
+ new AddPullRequestComment(request.getId()).onResponse(ai, "Sorry but this project is not entitled to access me");
+ return false;
+ }
+ }
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/security/SecurityUtils.java b/server-core/src/main/java/io/onedev/server/security/SecurityUtils.java
index 3aad5c2d4a..412a5a3f21 100644
--- a/server-core/src/main/java/io/onedev/server/security/SecurityUtils.java
+++ b/server-core/src/main/java/io/onedev/server/security/SecurityUtils.java
@@ -488,7 +488,11 @@ public class SecurityUtils extends org.apache.shiro.SecurityUtils {
}
public static boolean canAccessLog(Build build) {
- return getSubject().isPermitted(new ProjectPermission(build.getProject(),
+ return canAccessLog(getSubject(), build);
+ }
+
+ public static boolean canAccessLog(Subject subject, Build build) {
+ return subject.isPermitted(new ProjectPermission(build.getProject(),
new JobPermission(build.getJobName(), new AccessBuildLog())));
}
diff --git a/server-core/src/main/java/io/onedev/server/service/ManagedFutureService.java b/server-core/src/main/java/io/onedev/server/service/ManagedFutureService.java
new file mode 100644
index 0000000000..d5b1d58457
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/service/ManagedFutureService.java
@@ -0,0 +1,55 @@
+package io.onedev.server.service;
+
+import java.util.Date;
+import java.util.concurrent.Future;
+import java.util.function.Consumer;
+
+import org.jspecify.annotations.Nullable;
+
+/**
+ * Service for managing futures with automatic timeout handling and cleanup
+ */
+public interface ManagedFutureService {
+
+ /**
+ * Add a future with specified timeout and optional callback when timeout occurs.
+ *
+ * @param futureId unique identifier for the future
+ * @param future the future to manage
+ * @param timeout when the future should be considered timed out
+ * @param onTimeout optional callback invoked when timeout occurs (before cancellation)
+ */
+ <T> void addFuture(String futureId, Future<T> future, Date timeout, @Nullable Consumer<Future<T>> onTimeout);
+
+ /**
+ * Add a future with specified timeout in seconds and no timeout callback.
+ */
+ default <T> void addFuture(String futureId, Future<T> future, int timeoutSeconds) {
+ addFuture(futureId, future, new Date(System.currentTimeMillis() + timeoutSeconds * 1000L), null);
+ }
+
+ /**
+ * Add a future with specified timeout in seconds and a timeout callback.
+ */
+ default <T> void addFuture(String futureId, Future<T> future, int timeoutSeconds, @Nullable Consumer<Future<T>> onTimeout) {
+ addFuture(futureId, future, new Date(System.currentTimeMillis() + timeoutSeconds * 1000L), onTimeout);
+ }
+
+ /**
+ * Remove and return a future by its ID.
+ *
+ * @return the future, or null if not found
+ */
+ @Nullable
+ <T> Future<T> removeFuture(String futureId);
+
+ /**
+ * Get a future without removing it.
+ *
+ * @return the future, or null if not found
+ */
+ @Nullable
+ <T> Future<T> getFuture(String futureId);
+
+}
+
diff --git a/server-core/src/main/java/io/onedev/server/service/PullRequestReviewService.java b/server-core/src/main/java/io/onedev/server/service/PullRequestReviewService.java
index b00a8cc27b..b4ffe47bb1 100644
--- a/server-core/src/main/java/io/onedev/server/service/PullRequestReviewService.java
+++ b/server-core/src/main/java/io/onedev/server/service/PullRequestReviewService.java
@@ -2,6 +2,7 @@ package io.onedev.server.service;
import java.util.Collection;
+import org.eclipse.jgit.lib.ObjectId;
import org.jspecify.annotations.Nullable;
import io.onedev.server.model.PullRequest;
@@ -16,4 +17,6 @@ public interface PullRequestReviewService extends EntityService<PullRequestRevie
void createOrUpdate(User user, PullRequestReview review);
+ ObjectId getLastReviewedCommit(PullRequest request, User user);
+
}
diff --git a/server-core/src/main/java/io/onedev/server/service/PullRequestService.java b/server-core/src/main/java/io/onedev/server/service/PullRequestService.java
index 611d038908..2ab6329c25 100644
--- a/server-core/src/main/java/io/onedev/server/service/PullRequestService.java
+++ b/server-core/src/main/java/io/onedev/server/service/PullRequestService.java
@@ -78,6 +78,19 @@ public interface PullRequestService extends EntityService<PullRequest> {
@Nullable Criteria<PullRequest> pullRequestCriteria,
@Nullable Date startDate, @Nullable Date endDate, StatsGroup statsGroup);
+ /**
+ * When compare oldCommitId and newCommitId in context of pull request, assume below scenario:
+ * 1. Pull request is created
+ * 2. Add some commits to target branch
+ * 3. Merge target branch into source branch
+ * When show pull request changes in this case, we compare newCommitId with the comparison base
+ * instead of oldCommitId to exclude commits added in step 2
+ *
+ * @param request
+ * @param oldCommitId
+ * @param newCommitId
+ * @return
+ */
ObjectId getComparisonBase(PullRequest request, ObjectId oldCommitId, ObjectId newCommitId);
List<PullRequest> query(User submitter, Date fromDate, Date toDate);
diff --git a/server-core/src/main/java/io/onedev/server/service/TemporalFutureService.java b/server-core/src/main/java/io/onedev/server/service/TemporalFutureService.java
deleted file mode 100644
index 8cc094a839..0000000000
--- a/server-core/src/main/java/io/onedev/server/service/TemporalFutureService.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package io.onedev.server.service;
-
-import java.util.concurrent.CompletableFuture;
-
-import org.jspecify.annotations.Nullable;
-
-public interface TemporalFutureService {
-
- <T> void addFuture(String futureId, CompletableFuture<T> future);
-
- @Nullable
- <T> CompletableFuture<T> removeFuture(String futureId);
-
-}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/service/UserService.java b/server-core/src/main/java/io/onedev/server/service/UserService.java
index 62aba503d5..494a65134d 100644
--- a/server-core/src/main/java/io/onedev/server/service/UserService.java
+++ b/server-core/src/main/java/io/onedev/server/service/UserService.java
@@ -5,6 +5,7 @@ import java.util.List;
import org.jspecify.annotations.Nullable;
+import io.onedev.server.ai.AiTask;
import io.onedev.server.model.User;
import io.onedev.server.util.facade.UserCache;
import io.onedev.server.util.facade.UserFacade;
@@ -94,7 +95,9 @@ public interface UserService extends EntityService<User> {
List<User> query(@Nullable String term, int firstResult, int maxResults);
int count(String term);
-
+
+ void execute(User ai, AiTask task, int timeoutSeconds);
+
UserCache cloneCache();
}
diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java
index d1a0a3edc1..6ebd8ef2ce 100644
--- a/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java
+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java
@@ -324,7 +324,7 @@ public class DefaultIssueService extends BaseEntityService<Issue> implements Iss
CriteriaBuilder builder = getSession().getCriteriaBuilder();
CriteriaQuery<Issue> criteriaQuery = builder.createQuery(Issue.class);
Root<Issue> root = criteriaQuery.from(Issue.class);
-
+
criteriaQuery.where(buildPredicates(subject, projectScope, issueQuery.getCriteria(), criteriaQuery, builder, root));
var criteria = issueQuery.getCriteria();
List<javax.persistence.criteria.Order> preferOrders = new ArrayList<>();
diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultManagedFutureService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultManagedFutureService.java
new file mode 100644
index 0000000000..cabb7b740e
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultManagedFutureService.java
@@ -0,0 +1,120 @@
+package io.onedev.server.service.impl;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Future;
+import java.util.function.Consumer;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jspecify.annotations.Nullable;
+import org.quartz.ScheduleBuilder;
+import org.quartz.SimpleScheduleBuilder;
+
+import io.onedev.server.event.Listen;
+import io.onedev.server.event.system.SystemStarted;
+import io.onedev.server.event.system.SystemStopping;
+import io.onedev.server.service.ManagedFutureService;
+import io.onedev.server.taskschedule.SchedulableTask;
+import io.onedev.server.taskschedule.TaskScheduler;
+
+@Singleton
+public class DefaultManagedFutureService implements ManagedFutureService, SchedulableTask {
+
+ private final Map<String, ManagedFuture<?>> futures = new ConcurrentHashMap<>();
+
+ private final TaskScheduler taskScheduler;
+
+ private volatile String taskId;
+
+ @Inject
+ public DefaultManagedFutureService(TaskScheduler taskScheduler) {
+ this.taskScheduler = taskScheduler;
+ }
+
+ @Listen
+ public void on(SystemStarted event) {
+ taskId = taskScheduler.schedule(this);
+ }
+
+ @Listen
+ public void on(SystemStopping event) {
+ if (taskId != null)
+ taskScheduler.unschedule(taskId);
+ }
+
+ @Override
+ public void execute() {
+ var now = new Date();
+ for (var it = futures.entrySet().iterator(); it.hasNext();) {
+ var entry = it.next();
+ var managed = entry.getValue();
+ if (managed.timeout.before(now)) {
+ if (managed.onTimeout != null) {
+ try {
+ managed.invokeCallback();
+ } catch (Exception e) {
+ // Ignore callback exceptions during cleanup
+ }
+ }
+ managed.future.cancel(true);
+ it.remove();
+ }
+ }
+ }
+
+ @Override
+ public ScheduleBuilder<?> getScheduleBuilder() {
+ return SimpleScheduleBuilder.repeatMinutelyForever();
+ }
+
+ @Override
+ public <T> void addFuture(String futureId, Future<T> future, Date timeout, @Nullable Consumer<Future<T>> onTimeout) {
+ futures.put(futureId, new ManagedFuture<>(future, timeout, onTimeout));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Future<T> removeFuture(String futureId) {
+ var managed = futures.remove(futureId);
+ if (managed != null)
+ return (Future<T>) managed.future;
+ else
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Future<T> getFuture(String futureId) {
+ var managed = futures.get(futureId);
+ if (managed != null)
+ return (Future<T>) managed.future;
+ else
+ return null;
+ }
+
+ private static class ManagedFuture<T> {
+
+ final Future<T> future;
+
+ final Date timeout;
+
+ final Consumer<Future<T>> onTimeout;
+
+ ManagedFuture(Future<T> future, Date timeout, Consumer<Future<T>> onTimeout) {
+ this.future = future;
+ this.timeout = timeout;
+ this.onTimeout = onTimeout;
+ }
+
+ void invokeCallback() {
+ if (onTimeout != null)
+ onTimeout.accept(future);
+ }
+
+ }
+
+}
+
diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultPullRequestReviewService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultPullRequestReviewService.java
index 4bfa72f50f..075ef2e816 100644
--- a/server-core/src/main/java/io/onedev/server/service/impl/DefaultPullRequestReviewService.java
+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultPullRequestReviewService.java
@@ -2,6 +2,7 @@ package io.onedev.server.service.impl;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -10,6 +11,8 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.Root;
+import org.eclipse.jgit.lib.ObjectId;
+
import io.onedev.server.event.ListenerRegistry;
import io.onedev.server.event.project.pullrequest.PullRequestReviewRequested;
import io.onedev.server.event.project.pullrequest.PullRequestReviewerRemoved;
@@ -94,4 +97,31 @@ public class DefaultPullRequestReviewService extends BaseEntityService<PullReque
changeService.create(change, note);
}
+ @Sessional
+ @Override
+ public ObjectId getLastReviewedCommit(PullRequest request, User user) {
+ var oldCommitHash = request.getBaseCommitHash();
+ Date sinceDate = null;
+ for (var change: request.getChanges()) {
+ if ((sinceDate == null || change.getDate().after(sinceDate))
+ && change.getUser().equals(user)
+ && (change.getData() instanceof PullRequestApproveData || change.getData() instanceof PullRequestRequestedForChangesData)) {
+ sinceDate = change.getDate();
+ }
+ }
+ for (var comment: request.getComments()) {
+ if ((sinceDate == null || comment.getDate().after(sinceDate))
+ && comment.getUser().equals(user)) {
+ sinceDate = comment.getDate();
+ }
+ }
+ if (sinceDate != null) {
+ for (var update: request.getSortedUpdates()) {
+ if (update.getDate().before(sinceDate))
+ oldCommitHash = update.getHeadCommitHash();
+ }
+ }
+ return ObjectId.fromString(oldCommitHash);
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultTemporalFutureService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultTemporalFutureService.java
deleted file mode 100644
index 2c4d63a001..0000000000
--- a/server-core/src/main/java/io/onedev/server/service/impl/DefaultTemporalFutureService.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package io.onedev.server.service.impl;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.apache.commons.lang3.tuple.Pair;
-import org.quartz.ScheduleBuilder;
-import org.quartz.SimpleScheduleBuilder;
-
-import io.onedev.server.event.Listen;
-import io.onedev.server.event.system.SystemStarted;
-import io.onedev.server.event.system.SystemStopping;
-import io.onedev.server.service.TemporalFutureService;
-import io.onedev.server.taskschedule.SchedulableTask;
-import io.onedev.server.taskschedule.TaskScheduler;
-
-@Singleton
-public class DefaultTemporalFutureService implements TemporalFutureService, SchedulableTask {
-
- private static final int CLEANUP_TIMEOUT = 1000*60; // in milliseconds
-
- private final Map<String, Pair<CompletableFuture<?>, Date>> futureAndDates = new ConcurrentHashMap<>();
-
- @Inject
- private TaskScheduler taskScheduler;
-
- private volatile String cleanupTaskId;
-
- @Listen
- public void on(SystemStarted event) {
- cleanupTaskId = taskScheduler.schedule(this);
- }
-
- @Listen
- public void on(SystemStopping event) {
- if (cleanupTaskId != null)
- taskScheduler.unschedule(cleanupTaskId);
- }
-
- @Override
- public void execute() {
- var expireDate = new Date(System.currentTimeMillis() - CLEANUP_TIMEOUT);
- for (var it = futureAndDates.entrySet().iterator(); it.hasNext();) {
- var futureAndDate = it.next().getValue();
- if (futureAndDate.getRight().before(expireDate)) {
- futureAndDate.getLeft().cancel(true);
- it.remove();
- }
- }
- }
-
- @Override
- public ScheduleBuilder<?> getScheduleBuilder() {
- return SimpleScheduleBuilder.repeatMinutelyForever();
- }
-
- @Override
- public <T> void addFuture(String futureId, CompletableFuture<T> future) {
- futureAndDates.put(futureId, Pair.of(future, new Date()));
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> CompletableFuture<T> removeFuture(String futureId) {
- var futureAndDate = futureAndDates.remove(futureId);
- if (futureAndDate != null)
- return (CompletableFuture<T>) futureAndDate.getLeft();
- else
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultUserService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultUserService.java
index b14aa55b5a..f0621bd366 100644
--- a/server-core/src/main/java/io/onedev/server/service/impl/DefaultUserService.java
+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultUserService.java
@@ -1,9 +1,14 @@
package io.onedev.server.service.impl;
+import static io.onedev.server.ai.ToolUtils.getToolArguments;
import static io.onedev.server.model.User.Type.SERVICE;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -16,10 +21,21 @@ import javax.persistence.criteria.Subquery;
import org.hibernate.ReplicationMode;
import org.hibernate.criterion.Restrictions;
import org.hibernate.query.Query;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.hazelcast.core.HazelcastInstance;
+import dev.langchain4j.data.message.ChatMessage;
+import dev.langchain4j.data.message.SystemMessage;
+import dev.langchain4j.data.message.UserMessage;
+import dev.langchain4j.model.chat.request.ChatRequest;
+import io.onedev.commons.utils.ExceptionUtils;
+import io.onedev.commons.utils.ExplicitException;
+import io.onedev.server.ai.AiTask;
+import io.onedev.server.ai.TaskTool;
+import io.onedev.server.ai.ToolUtils;
import io.onedev.server.cluster.ClusterService;
import io.onedev.server.event.Listen;
import io.onedev.server.event.entity.EntityPersisted;
@@ -32,12 +48,15 @@ import io.onedev.server.model.User;
import io.onedev.server.model.support.code.BranchProtection;
import io.onedev.server.model.support.code.TagProtection;
import io.onedev.server.persistence.IdService;
+import io.onedev.server.persistence.SessionService;
import io.onedev.server.persistence.TransactionService;
import io.onedev.server.persistence.annotation.Sessional;
import io.onedev.server.persistence.annotation.Transactional;
import io.onedev.server.persistence.dao.EntityCriteria;
+import io.onedev.server.security.SecurityUtils;
import io.onedev.server.service.EmailAddressService;
import io.onedev.server.service.IssueFieldService;
+import io.onedev.server.service.ManagedFutureService;
import io.onedev.server.service.ProjectService;
import io.onedev.server.service.SettingService;
import io.onedev.server.service.UserService;
@@ -48,6 +67,8 @@ import io.onedev.server.util.usage.Usage;
@Singleton
public class DefaultUserService extends BaseEntityService<User> implements UserService {
+ private static final Logger logger = LoggerFactory.getLogger(DefaultUserService.class);
+
@Inject
private ProjectService projectService;
@@ -68,6 +89,15 @@ public class DefaultUserService extends BaseEntityService<User> implements UserS
@Inject
private ClusterService clusterService;
+
+ @Inject
+ private ExecutorService executorService;
+
+ @Inject
+ private SessionService sessionService;
+
+ @Inject
+ private ManagedFutureService managedFutureService;
private volatile UserCache cache;
@@ -476,6 +506,7 @@ public class DefaultUserService extends BaseEntityService<User> implements UserS
cache.put(user.getId(), user.getFacade());
}
+
private Predicate[] getPredicates(CriteriaBuilder builder, CriteriaQuery<?> query,
Root<User> root, String term) {
if (term != null) {
@@ -537,6 +568,87 @@ public class DefaultUserService extends BaseEntityService<User> implements UserS
return null;
}
+ @Sessional
+ @Override
+ public void execute(User ai, AiTask task, int timeoutSeconds) {
+ Preconditions.checkState(ai.getType() == User.Type.AI);
+ var taskId = UUID.randomUUID().toString();
+ var subject = ai.asSubject();
+ var aiSetting = ai.getAiSetting();
+ transactionService.runAfterCommit(() -> {
+ var future = executorService.submit(() -> {
+ try {
+ var chatModel = aiSetting.getModelSetting().getChatModel();
+ var messages = new ArrayList<ChatMessage>();
+ messages.add(new SystemMessage("Your name is %s".formatted(ai.getName())));
+ if (aiSetting.getSystemPrompt() != null)
+ messages.add(new SystemMessage(aiSetting.getSystemPrompt()));
+ if (task.getSystemPrompt() != null)
+ messages.add(new SystemMessage(task.getSystemPrompt()));
+ messages.add(new UserMessage(task.getUserPrompt()));
+ var tools = task.getTools();
+ var toolSpecifications = tools.stream()
+ .map(TaskTool::getSpecification)
+ .collect(Collectors.toList());
+ ToolUtils.filterDuplications(toolSpecifications);
+ while (true) {
+ var chatRequest = ChatRequest.builder()
+ .messages(messages)
+ .toolSpecifications(toolSpecifications)
+ .build();
+ var response = chatModel.chat(chatRequest);
+ var aiMessage = response.aiMessage();
+
+ if (!aiMessage.hasToolExecutionRequests()) {
+ sessionService.run(() -> {
+ task.getResponseHandler().onResponse(
+ Preconditions.checkNotNull(SecurityUtils.getUser(subject)),
+ aiMessage.text());
+ });
+ break;
+ }
+
+ messages.add(aiMessage);
+ sessionService.run(() -> {
+ for (var toolRequest : aiMessage.toolExecutionRequests()) {
+ var toolName = toolRequest.name();
+ try {
+ var tool = tools.stream()
+ .filter(it -> it.getSpecification().name().equals(toolName))
+ .findFirst()
+ .orElseThrow(() -> new ExplicitException("Tool not found: " + toolName));
+ tool.execute(subject, getToolArguments(toolRequest)).addToMessages(messages, toolRequest);
+ } catch (Throwable t) {
+ ToolUtils.handleCallException(toolName, t);
+ }
+ }
+ });
+ }
+ } catch (Exception e) {
+ sessionService.run(() -> {
+ var user = Preconditions.checkNotNull(SecurityUtils.getUser(subject));
+ var explicitException = ExceptionUtils.find(e, ExplicitException.class);
+ if (explicitException != null) {
+ task.getResponseHandler().onResponse(user, explicitException.getMessage());
+ } else if (ExceptionUtils.find(e, InterruptedException.class) == null) {
+ logger.error("Error running AI task", e);
+ task.getResponseHandler().onResponse(user, "Error running AI task, check server log for details");
+ }
+ });
+ } finally {
+ managedFutureService.removeFuture(taskId);
+ }
+ });
+ managedFutureService.addFuture(taskId, future, timeoutSeconds, f -> {
+ sessionService.run(() -> {
+ task.getResponseHandler().onResponse(
+ Preconditions.checkNotNull(SecurityUtils.getUser(subject)),
+ "Timed out getting response");
+ });
+ });
+ });
+ }
+
@Override
public UserCache cloneCache() {
return cache.clone();
@@ -562,5 +674,5 @@ public class DefaultUserService extends BaseEntityService<User> implements UserS
transactionService.runAfterCommit(() -> cache.remove(id));
}
}
-
+
}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/DisplayNoneBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/DisplayNoneBehavior.java
index ab31068bf5..836518491a 100644
--- a/server-core/src/main/java/io/onedev/server/web/behavior/DisplayNoneBehavior.java
+++ b/server-core/src/main/java/io/onedev/server/web/behavior/DisplayNoneBehavior.java
@@ -7,7 +7,7 @@ import org.apache.wicket.model.Model;
public class DisplayNoneBehavior extends AttributeAppender {
public DisplayNoneBehavior() {
- super("style", Model.of("display:none"));
+ super("style", Model.of("display:none;"));
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.java b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.java
index 4a57cee673..2c81f26a40 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.java
@@ -43,17 +43,18 @@ import org.json.JSONException;
import org.json.JSONWriter;
import org.jspecify.annotations.Nullable;
+import io.onedev.server.ai.ChatService;
import io.onedev.server.model.Chat;
import io.onedev.server.model.ChatMessage;
import io.onedev.server.model.User;
import io.onedev.server.persistence.dao.Dao;
-import io.onedev.server.service.ChatService;
import io.onedev.server.service.UserService;
import io.onedev.server.service.support.ChatResponding;
import io.onedev.server.util.facade.UserFacade;
import io.onedev.server.web.WebConstants;
import io.onedev.server.web.WebSession;
import io.onedev.server.web.behavior.ChangeObserver;
+import io.onedev.server.web.behavior.DisplayNoneBehavior;
import io.onedev.server.web.behavior.OnTypingDoneBehavior;
import io.onedev.server.web.component.MultilineLabel;
import io.onedev.server.web.component.floating.FloatingPanel;
@@ -438,7 +439,7 @@ public class ChatPanel extends Panel {
add(form);
- add(AttributeAppender.append("class", "chat d-flex flex-column"));
+ add(AttributeAppender.append("class", "chat flex-column"));
setOutputMarkupPlaceholderTag(true);
}
@@ -549,9 +550,9 @@ public class ChatPanel extends Panel {
WebRequest request = (WebRequest) RequestCycle.get().getRequest();
Cookie cookie = request.getCookie("chat.width");
if (cookie != null)
- add(AttributeAppender.replace("style", "width:" + cookie.getValue() + "px"));
+ add(AttributeAppender.append("style", "width:" + cookie.getValue() + "px;"));
else
- add(AttributeAppender.replace("style", "width:400px"));
+ add(AttributeAppender.append("style", "width:400px;"));
super.onBeforeRender();
}
@@ -583,16 +584,20 @@ public class ChatPanel extends Panel {
WebSession.get().setActiveChatId(null);
if (prompt != null) {
WebSession.get().setChatInput(prompt);
- target.appendJavaScript("""
- $(".chat>.body>.send .submit").click();
- """);
+ target.appendJavaScript("$('.chat>.body>.send .submit').click();");
}
+ add(new DisplayNoneBehavior());
target.add(this);
+ target.appendJavaScript("$('.chat').show('slide', {direction: 'right'}, 160);");
}
public void hide(AjaxRequestTarget target) {
WebSession.get().setChatVisible(false);
- target.add(this);
+ target.appendJavaScript("""
+ $('.chat').hide('slide', {direction: 'right'}, 160, function() {
+ $('.chat').removeClass().empty();
+ });
+ """);
}
}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.css b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.css
index 5bfc14f26f..657131277d 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.css
+++ b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.css
@@ -4,6 +4,7 @@
bottom: 0;
right: 0;
z-index: 1040;
+ display: flex;
background: white;
box-shadow: 0 0 12px rgba(0,0,0,0.2);
}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/codecomment/CodeCommentPanel.java b/server-core/src/main/java/io/onedev/server/web/component/codecomment/CodeCommentPanel.java
index d7101ec100..3eea038a01 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/codecomment/CodeCommentPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/codecomment/CodeCommentPanel.java
@@ -8,8 +8,6 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
-import org.jspecify.annotations.Nullable;
-
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -39,18 +37,17 @@ import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.util.visit.IVisit;
import org.apache.wicket.util.visit.IVisitor;
+import org.jspecify.annotations.Nullable;
import com.google.common.collect.Sets;
import io.onedev.server.OneDev;
+import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.ChatToolAware;
+import io.onedev.server.ai.ToolUtils;
import io.onedev.server.attachment.AttachmentSupport;
import io.onedev.server.attachment.ProjectAttachmentSupport;
import io.onedev.server.data.migration.VersionedXmlDoc;
-import io.onedev.server.service.AuditService;
-import io.onedev.server.service.CodeCommentService;
-import io.onedev.server.service.CodeCommentReplyService;
-import io.onedev.server.service.CodeCommentStatusChangeService;
-import io.onedev.server.service.UrlService;
import io.onedev.server.model.CodeComment;
import io.onedev.server.model.CodeCommentReply;
import io.onedev.server.model.CodeCommentStatusChange;
@@ -59,6 +56,11 @@ import io.onedev.server.model.User;
import io.onedev.server.model.support.CompareContext;
import io.onedev.server.persistence.TransactionService;
import io.onedev.server.security.SecurityUtils;
+import io.onedev.server.service.AuditService;
+import io.onedev.server.service.CodeCommentReplyService;
+import io.onedev.server.service.CodeCommentService;
+import io.onedev.server.service.CodeCommentStatusChangeService;
+import io.onedev.server.service.UrlService;
import io.onedev.server.util.DateUtils;
import io.onedev.server.web.ajaxlistener.ConfirmClickListener;
import io.onedev.server.web.ajaxlistener.ConfirmLeaveListener;
@@ -73,7 +75,7 @@ import io.onedev.server.web.component.user.ident.UserIdentPanel;
import io.onedev.server.web.page.base.BasePage;
import io.onedev.server.xodus.VisitInfoService;
-public abstract class CodeCommentPanel extends Panel {
+public abstract class CodeCommentPanel extends Panel implements ChatToolAware {
private final Long commentId;
@@ -738,6 +740,11 @@ public abstract class CodeCommentPanel extends Panel {
}
}
+
+ @Override
+ public List<ChatTool> getChatTools() {
+ return ToolUtils.wrapForChat(getComment().getTools());
+ }
public class CodeCommentReplyActivity implements CodeCommentActivity {
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java
index a71220d0a5..cf36425c55 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java
@@ -9,7 +9,6 @@ import static org.unbescape.javascript.JavaScriptEscape.escapeJavaScript;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -45,6 +44,7 @@ import io.onedev.commons.utils.StringUtils;
import io.onedev.server.OneDev;
import io.onedev.server.ai.ChatTool;
import io.onedev.server.ai.ChatToolAware;
+import io.onedev.server.ai.ToolUtils;
import io.onedev.server.ai.tools.GetHighlightedText;
import io.onedev.server.codequality.CodeProblem;
import io.onedev.server.git.BlameBlock;
@@ -63,10 +63,10 @@ import io.onedev.server.util.Pair;
import io.onedev.server.util.diff.DiffBlock;
import io.onedev.server.util.diff.DiffMatchPatch.Operation;
import io.onedev.server.util.diff.DiffUtils;
-import io.onedev.server.web.component.diff.DiffExpandSupport;
import io.onedev.server.web.asset.icon.IconScope;
import io.onedev.server.web.behavior.AbstractPostAjaxBehavior;
import io.onedev.server.web.behavior.blamemessage.BlameMessageBehavior;
+import io.onedev.server.web.component.diff.DiffExpandSupport;
import io.onedev.server.web.component.diff.blob.BlobAnnotationSupport;
import io.onedev.server.web.component.diff.revision.DiffViewMode;
import io.onedev.server.web.component.svg.SpriteImage;
@@ -79,7 +79,6 @@ import io.onedev.server.web.page.project.commits.CommitDetailPage;
import io.onedev.server.web.util.AnnotationInfo;
import io.onedev.server.web.util.CodeCommentInfo;
import io.onedev.server.web.util.DiffPlanarRange;
-import io.onedev.server.web.util.WicketUtils;
public class BlobTextDiffPanel extends Panel implements ChatToolAware {
@@ -489,11 +488,8 @@ public class BlobTextDiffPanel extends Panel implements ChatToolAware {
translations.put("loading", _T("Loading..."));
translations.put("invalid-selection", _T("Invalid selection, click for details"));
var page = (LayoutPage) getPage();
- if (getAnnotationSupport() != null
- && WicketUtils.isSubscriptionActive()
- && !page.getAssistant().getEntitledAis().isEmpty()) {
+ if (getAnnotationSupport() != null && !page.getAssistant().getEntitledAis().isEmpty())
translations.put("explain-selection", _T("Explain selected text with AI"));
- }
for (var severity: CodeProblem.Severity.values())
translations.put(severity.name(), _T("severity:" + severity.name()));
translations.put("add-problem-comment", _T("Add comment"));
@@ -1083,7 +1079,7 @@ public class BlobTextDiffPanel extends Panel implements ChatToolAware {
}
@Override
- public Collection<ChatTool> getChatTools() {
+ public List<ChatTool> getChatTools() {
var tools = new ArrayList<ChatTool>();
if (getAnnotationSupport() != null) {
var markRange = getAnnotationSupport().getMarkRange();
@@ -1097,7 +1093,7 @@ public class BlobTextDiffPanel extends Panel implements ChatToolAware {
filePath = change.getNewBlobIdent().path;
fileLines = change.getNewText().getLines();
}
- tools.add(new GetHighlightedText(filePath, fileLines, markRange));
+ tools.add(ToolUtils.wrapForChat(new GetHighlightedText(filePath, fileLines, markRange)));
}
}
return tools;
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java
index 80d0e21a84..432820f8ff 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java
@@ -1,8 +1,6 @@
package io.onedev.server.web.component.diff.revision;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
import static io.onedev.server.web.translation.Translation._T;
-import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.stream.Collectors.toList;
import java.nio.charset.StandardCharsets;
@@ -19,7 +17,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import javax.servlet.http.Cookie;
@@ -33,7 +30,6 @@ import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
import org.apache.wicket.extensions.markup.html.repeater.tree.ITreeProvider;
import org.apache.wicket.extensions.markup.html.repeater.tree.NestedTree;
import org.apache.wicket.extensions.markup.html.repeater.tree.nested.BranchItem;
@@ -68,13 +64,11 @@ import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
import org.jspecify.annotations.Nullable;
-import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import dev.langchain4j.agent.tool.ToolSpecification;
import io.onedev.commons.codeassist.InputSuggestion;
import io.onedev.commons.codeassist.parser.TerminalExpect;
import io.onedev.commons.utils.ExceptionUtils;
@@ -83,14 +77,6 @@ import io.onedev.commons.utils.PlanarRange;
import io.onedev.commons.utils.StringUtils;
import io.onedev.commons.utils.match.Matcher;
import io.onedev.commons.utils.match.PathMatcher;
-import io.onedev.server.ai.ChatTool;
-import io.onedev.server.ai.ChatToolAware;
-import io.onedev.server.ai.tools.GetFileContent;
-import io.onedev.server.ai.tools.GetFilesAndSubfolders;
-import io.onedev.server.ai.tools.GetRootFilesAndFolders;
-import io.onedev.server.ai.tools.QueryCodeSnippets;
-import io.onedev.server.ai.tools.QueryFilePaths;
-import io.onedev.server.ai.tools.QuerySymbolDefinitions;
import io.onedev.server.attachment.ProjectAttachmentSupport;
import io.onedev.server.codequality.BlobTarget;
import io.onedev.server.codequality.CodeProblem;
@@ -148,7 +134,6 @@ import io.onedev.server.web.util.DiffPlanarRange;
import io.onedev.server.web.util.SuggestionUtils;
import io.onedev.server.web.util.TextUtils;
import io.onedev.server.web.util.WicketUtils;
-import io.onedev.server.web.websocket.ChatToolExecution.Result;
/**
* Make sure to add only one revision diff panel on a page
@@ -156,7 +141,7 @@ import io.onedev.server.web.websocket.ChatToolExecution.Result;
* @author robin
*
*/
-public abstract class RevisionDiffPanel extends Panel implements ChatToolAware {
+public abstract class RevisionDiffPanel extends Panel {
private static final String COOKIE_VIEW_MODE = "onedev.server.diff.viewmode";
@@ -166,8 +151,6 @@ public abstract class RevisionDiffPanel extends Panel implements ChatToolAware {
private static final String COOKIE_NAVIGATION_WIDTH = "revisionDiff.navigation.width";
- private static final int MAX_PATCH_SIZE = 1024 * 1024;
-
@Inject
private PendingSuggestionApplyService pendingSuggestionApplyService;
@@ -2414,103 +2397,4 @@ public abstract class RevisionDiffPanel extends Panel implements ChatToolAware {
return blobAnnotationSupport.orElse(null);
}
- private ObjectId getCommitId(boolean oldRevision) {
- System.out.println("oldRevision: " + oldRevision);
- return oldRevision ? getOldCommitId().copy() : getNewCommitId().copy();
- }
-
- @Override
- public Collection<ChatTool> getChatTools() {
- return List.of(
- new GetRootFilesAndFolders() {
- @Override
- protected Project getProject() {
- return RevisionDiffPanel.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return RevisionDiffPanel.this.getCommitId(oldRevision);
- }
- },
- new GetFilesAndSubfolders() {
- @Override
- protected Project getProject() {
- return RevisionDiffPanel.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return RevisionDiffPanel.this.getCommitId(oldRevision);
- }
- },
- new GetFileContent() {
- @Override
- protected Project getProject() {
- return RevisionDiffPanel.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return RevisionDiffPanel.this.getCommitId(oldRevision);
- }
- },
- new QuerySymbolDefinitions() {
- @Override
- protected Project getProject() {
- return RevisionDiffPanel.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return RevisionDiffPanel.this.getCommitId(oldRevision);
- }
- },
- new QueryCodeSnippets() {
-
- @Override
- protected Project getProject() {
- return RevisionDiffPanel.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return RevisionDiffPanel.this.getCommitId(oldRevision);
- }
- },
- new QueryFilePaths() {
- @Override
- protected Project getProject() {
- return RevisionDiffPanel.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return RevisionDiffPanel.this.getCommitId(oldRevision);
- }
- },
- new ChatTool() {
-
- @Override
- public ToolSpecification getSpecification() {
- return ToolSpecification.builder()
- .name("getDiff")
- .description("Get diff of old revision and new revision in json format")
- .build();
- }
-
- @Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- var oldCommitId = getOldCommitId().copy();
- var newCommitId = getNewCommitId().copy();
- var patch = gitService.getPatch(getProject(), oldCommitId, newCommitId);
- if (patch.length() > MAX_PATCH_SIZE)
- return completedFuture(new Result(convertToJson(Map.of("successful", false, "failReason", "Patch is too large")), false));
- else
- return completedFuture(new Result(convertToJson(Map.of("successful", true, "patch", patch)), false));
- }
- }
- );
- }
-
}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardPanel.java b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardPanel.java
similarity index 62%
rename from server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardPanel.java
rename to server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardPanel.java
index f8c0ef0476..5718698fb4 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardPanel.java
@@ -1,21 +1,20 @@
-package io.onedev.server.web.component.offcanvas;
-
-import org.jspecify.annotations.Nullable;
+package io.onedev.server.web.component.draw;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
+import org.jspecify.annotations.Nullable;
-public abstract class OffCanvasCardPanel extends OffCanvasPanel {
+public abstract class DrawCardPanel extends DrawPanel {
- public OffCanvasCardPanel(AjaxRequestTarget target, Placement placement, @Nullable String width) {
+ public DrawCardPanel(AjaxRequestTarget target, Placement placement, @Nullable String width) {
super(target, placement, width);
- add(AttributeAppender.append("class", "off-canvas-card"));
+ add(AttributeAppender.append("class", "draw-card"));
}
@Override
protected Component newContent(String id) {
- return new OffCanvasCardSupportPanel(id) {
+ return new DrawCardSupportPanel(id) {
@Override
protected void onClose(AjaxRequestTarget target) {
@@ -24,17 +23,17 @@ public abstract class OffCanvasCardPanel extends OffCanvasPanel {
@Override
protected Component newTitle(String componentId) {
- return OffCanvasCardPanel.this.newTitle(componentId);
+ return DrawCardPanel.this.newTitle(componentId);
}
@Override
protected Component newBody(String componentId) {
- return OffCanvasCardPanel.this.newBody(componentId);
+ return DrawCardPanel.this.newBody(componentId);
}
@Override
protected Component newFooter(String componentId) {
- return OffCanvasCardPanel.this.newFooter(componentId);
+ return DrawCardPanel.this.newFooter(componentId);
}
};
diff --git a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardSupportPanel.html b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardSupportPanel.html
similarity index 100%
rename from server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardSupportPanel.html
rename to server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardSupportPanel.html
diff --git a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardSupportPanel.java b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardSupportPanel.java
similarity index 86%
rename from server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardSupportPanel.java
rename to server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardSupportPanel.java
index 289c78debe..1fc0cf2131 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCardSupportPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCardSupportPanel.java
@@ -1,4 +1,4 @@
-package io.onedev.server.web.component.offcanvas;
+package io.onedev.server.web.component.draw;
import org.jspecify.annotations.Nullable;
@@ -8,9 +8,9 @@ import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Panel;
-abstract class OffCanvasCardSupportPanel extends Panel {
+abstract class DrawCardSupportPanel extends Panel {
- public OffCanvasCardSupportPanel(String id) {
+ public DrawCardSupportPanel(String id) {
super(id);
}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCssResourceReference.java b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCssResourceReference.java
new file mode 100644
index 0000000000..8100fc4cd8
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawCssResourceReference.java
@@ -0,0 +1,13 @@
+package io.onedev.server.web.component.draw;
+
+import io.onedev.server.web.page.base.BaseDependentCssResourceReference;
+
+public class DrawCssResourceReference extends BaseDependentCssResourceReference {
+
+ private static final long serialVersionUID = 1L;
+
+ public DrawCssResourceReference() {
+ super(DrawCssResourceReference.class, "draw.css");
+ }
+
+}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasPanel.java b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawPanel.java
similarity index 63%
rename from server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasPanel.java
rename to server-core/src/main/java/io/onedev/server/web/component/draw/DrawPanel.java
index 578a425d4f..d1fb4af4b7 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/draw/DrawPanel.java
@@ -1,4 +1,4 @@
-package io.onedev.server.web.component.offcanvas;
+package io.onedev.server.web.component.draw;
import org.jspecify.annotations.Nullable;
@@ -10,13 +10,13 @@ import org.apache.wicket.markup.head.IHeaderResponse;
import io.onedev.server.web.component.floating.FloatingPanel;
import io.onedev.server.web.util.Animation;
-public abstract class OffCanvasPanel extends FloatingPanel {
+public abstract class DrawPanel extends FloatingPanel {
public enum Placement {LEFT, RIGHT}
- public OffCanvasPanel(AjaxRequestTarget target, Placement placement, @Nullable String width) {
+ public DrawPanel(AjaxRequestTarget target, Placement placement, @Nullable String width) {
super(target, null, false, false, Animation.valueOf(placement.name()));
- add(AttributeAppender.append("class", "off-canvas off-canvas-" + placement.name().toLowerCase()));
+ add(AttributeAppender.append("class", "draw draw-" + placement.name().toLowerCase()));
if (width != null)
add(AttributeAppender.append("style", "width: " + width).setSeparator(";"));
}
@@ -25,7 +25,7 @@ public abstract class OffCanvasPanel extends FloatingPanel {
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
- response.render(CssHeaderItem.forReference(new OffCanvasCssResourceReference()));
+ response.render(CssHeaderItem.forReference(new DrawCssResourceReference()));
}
}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/off-canvas.css b/server-core/src/main/java/io/onedev/server/web/component/draw/draw.css
similarity index 53%
rename from server-core/src/main/java/io/onedev/server/web/component/offcanvas/off-canvas.css
rename to server-core/src/main/java/io/onedev/server/web/component/draw/draw.css
index 815208186d..0d4fc4bc76 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/off-canvas.css
+++ b/server-core/src/main/java/io/onedev/server/web/component/draw/draw.css
@@ -1,4 +1,4 @@
-.floating.off-canvas {
+.floating.draw {
position: fixed;
top: 0;
bottom: 0;
@@ -7,16 +7,16 @@
border-radius: 0;
}
-.floating.off-canvas>.content {
+.floating.draw>.content {
height: 100%;
}
-.floating.off-canvas-left {
+.floating.draw-left {
left: 0;
}
-.floating.off-canvas-right {
+.floating.draw-right {
right: 0;
}
-.floating.off-canvas>.content>.card {
+.floating.draw>.content>.card {
box-shadow: none;
border-radius: 0;
}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/issue/activities/IssueActivitiesPanel.java b/server-core/src/main/java/io/onedev/server/web/component/issue/activities/IssueActivitiesPanel.java
index 1b2558f452..1506b974c8 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/issue/activities/IssueActivitiesPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/issue/activities/IssueActivitiesPanel.java
@@ -341,7 +341,7 @@ public abstract class IssueActivitiesPanel extends Panel {
protected void onConfigure() {
super.onConfigure();
var page = (LayoutPage)getPage();
- setVisible(WicketUtils.isSubscriptionActive() && !page.getAssistant().getEntitledAis().isEmpty());
+ setVisible(!page.getAssistant().getEntitledAis().isEmpty());
}
});
diff --git a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCssResourceReference.java b/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCssResourceReference.java
deleted file mode 100644
index 0446ca290b..0000000000
--- a/server-core/src/main/java/io/onedev/server/web/component/offcanvas/OffCanvasCssResourceReference.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.onedev.server.web.component.offcanvas;
-
-import io.onedev.server.web.page.base.BaseDependentCssResourceReference;
-
-public class OffCanvasCssResourceReference extends BaseDependentCssResourceReference {
-
- private static final long serialVersionUID = 1L;
-
- public OffCanvasCssResourceReference() {
- super(OffCanvasCssResourceReference.class, "off-canvas.css");
- }
-
-}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementEditBean.java b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementEditBean.java
index e4587ea8ef..47eb06a5e5 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementEditBean.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementEditBean.java
@@ -22,13 +22,13 @@ public class EntitlementEditBean implements Serializable{
private boolean entitleToAll;
- private List<String> entitledProjects;
+ private List<String> entitledUsers;
private List<String> entitledGroups;
- private List<String> entitledUsers;
+ private List<String> entitledProjects;
- @Editable(order=100, name="Entitle to All Users")
+ @Editable(order=100, name="Entitle to All Users and Projects")
public boolean isEntitleToAll() {
return entitleToAll;
}
@@ -37,18 +37,27 @@ public class EntitlementEditBean implements Serializable{
this.entitleToAll = entitleToAll;
}
- @Editable(order=200)
- @ProjectChoice
+ @Editable(order=200, description="Entitled users will be able to access this AI service")
+ @UserChoice("getUsers")
@DependsOn(property="entitleToAll", value="false")
- public List<String> getEntitledProjects() {
- return entitledProjects;
+ public List<String> getEntitledUsers() {
+ return entitledUsers;
}
- public void setEntitledProjects(List<String> entitledProjects) {
- this.entitledProjects = entitledProjects;
+ public void setEntitledUsers(List<String> entitledUsers) {
+ this.entitledUsers = entitledUsers;
+ }
+
+ @SuppressWarnings("unused")
+ private static List<User> getUsers() {
+ var cache = OneDev.getInstance(UserService.class).cloneCache();
+ return cache.getUsers(it->!it.isDisabled() && it.getType() == ORDINARY)
+ .stream()
+ .sorted(cache.comparingDisplayName())
+ .collect(Collectors.toList());
}
- @Editable(order=300)
+ @Editable(order=300, description="All members of entitled groups will be able to access this AI service")
@GroupChoice
@DependsOn(property="entitleToAll", value="false")
public List<String> getEntitledGroups() {
@@ -59,24 +68,15 @@ public class EntitlementEditBean implements Serializable{
this.entitledGroups = entitledGroups;
}
- @Editable(order=300)
- @UserChoice("getUsers")
+ @Editable(order=400, description="Entitled projects will be able to access this AI service")
+ @ProjectChoice
@DependsOn(property="entitleToAll", value="false")
- public List<String> getEntitledUsers() {
- return entitledUsers;
+ public List<String> getEntitledProjects() {
+ return entitledProjects;
}
- public void setEntitledUsers(List<String> entitledUsers) {
- this.entitledUsers = entitledUsers;
- }
-
- @SuppressWarnings("unused")
- private static List<User> getUsers() {
- var cache = OneDev.getInstance(UserService.class).cloneCache();
- return cache.getUsers(it->!it.isDisabled() && it.getType() == ORDINARY)
- .stream()
- .sorted(cache.comparingDisplayName())
- .collect(Collectors.toList());
+ public void setEntitledProjects(List<String> entitledProjects) {
+ this.entitledProjects = entitledProjects;
}
-
+
}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.html b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.html
index 7262c8525b..f42015ed0d 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.html
+++ b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.html
@@ -1,6 +1,25 @@
<wicket:panel>
- <div class="alert alert-light">
- <wicket:t>Specifies who can access this AI service</wicket:t>
+ <div class="alert alert-notice alert-light">
+ <wicket:t>Specifies who can access this AI service. AI service can be accessed in below approaches:</wicket:t>
+ <dl class="mt-2 mb-0">
+ <dt><wicket:t>Via chat interface</wicket:t></dt>
+ <dd class="small mt-1">
+ <wicket:t>Entitled users can interact with the AI user through the chat interface to perform tasks
+ such as understanding codebase, authoring CI/CD spec, or investigating
+ CI/CD job failures. In this mode, the AI user operates with same permissions as the
+ user interacting with it, ignoring permissions assigned to the AI user itself.</wicket:t>
+ </dd>
+ <dt><wicket:t>Via mention in issue or pull request comments</wicket:t></dt>
+ <dd class="small mt-1">
+ <wicket:t>Entitled users can mention the AI user in issue or pull request comments to request assistance.
+ In this case, the AI user executes tasks using its own permissions.</wicket:t>
+ </dd>
+ <dt><wicket:t>Via pull request reviewer</wicket:t></dt>
+ <dd class="small mt-1">
+ <wicket:t>Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user
+ executes tasks using its own permissions.</wicket:t>
+ </dd>
+ </dl>
</div>
<form wicket:id="form" class="leave-confirm">
<div wicket:id="editor" class="mb-4"></div>
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/jobdependency/JobDependencyListViewPanel.java b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/jobdependency/JobDependencyListViewPanel.java
index f634cd03eb..035f24e049 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/jobdependency/JobDependencyListViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/jobdependency/JobDependencyListViewPanel.java
@@ -2,8 +2,8 @@ package io.onedev.server.web.editable.buildspec.job.jobdependency;
import io.onedev.server.buildspec.job.JobDependency;
import io.onedev.server.web.behavior.NoRecordsBehavior;
-import io.onedev.server.web.component.offcanvas.OffCanvasCardPanel;
-import io.onedev.server.web.component.offcanvas.OffCanvasPanel;
+import io.onedev.server.web.component.draw.DrawCardPanel;
+import io.onedev.server.web.component.draw.DrawPanel;
import io.onedev.server.web.editable.BeanContext;
import io.onedev.server.web.util.TextUtils;
import org.apache.wicket.Component;
@@ -82,7 +82,7 @@ class JobDependencyListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
- new OffCanvasCardPanel(target, OffCanvasPanel.Placement.RIGHT, null) {
+ new DrawCardPanel(target, DrawPanel.Placement.RIGHT, null) {
@Override
protected Component newTitle(String componentId) {
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/postbuildaction/PostBuildActionListViewPanel.java b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/postbuildaction/PostBuildActionListViewPanel.java
index cb77c96c7f..cf96be5712 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/postbuildaction/PostBuildActionListViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/postbuildaction/PostBuildActionListViewPanel.java
@@ -27,8 +27,8 @@ import org.apache.wicket.model.Model;
import io.onedev.server.buildspec.job.action.PostBuildAction;
import io.onedev.server.web.behavior.NoRecordsBehavior;
-import io.onedev.server.web.component.offcanvas.OffCanvasCardPanel;
-import io.onedev.server.web.component.offcanvas.OffCanvasPanel;
+import io.onedev.server.web.component.draw.DrawCardPanel;
+import io.onedev.server.web.component.draw.DrawPanel;
import io.onedev.server.web.editable.BeanContext;
import io.onedev.server.web.editable.EditableUtils;
@@ -77,7 +77,7 @@ class PostBuildActionListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
- new OffCanvasCardPanel(target, OffCanvasPanel.Placement.RIGHT, null) {
+ new DrawCardPanel(target, DrawPanel.Placement.RIGHT, null) {
@Override
protected Component newTitle(String componentId) {
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/projectdependency/ProjectDependencyListViewPanel.java b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/projectdependency/ProjectDependencyListViewPanel.java
index 039b9be4e3..34d22dc9fb 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/projectdependency/ProjectDependencyListViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/projectdependency/ProjectDependencyListViewPanel.java
@@ -29,8 +29,8 @@ import org.apache.wicket.model.Model;
import io.onedev.server.buildspec.job.projectdependency.ProjectDependency;
import io.onedev.server.web.behavior.NoRecordsBehavior;
-import io.onedev.server.web.component.offcanvas.OffCanvasCardPanel;
-import io.onedev.server.web.component.offcanvas.OffCanvasPanel;
+import io.onedev.server.web.component.draw.DrawCardPanel;
+import io.onedev.server.web.component.draw.DrawPanel;
import io.onedev.server.web.editable.BeanContext;
class ProjectDependencyListViewPanel extends Panel {
@@ -79,7 +79,7 @@ class ProjectDependencyListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
- new OffCanvasCardPanel(target, OffCanvasPanel.Placement.RIGHT, null) {
+ new DrawCardPanel(target, DrawPanel.Placement.RIGHT, null) {
@Override
protected Component newTitle(String componentId) {
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/trigger/JobTriggerListViewPanel.java b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/trigger/JobTriggerListViewPanel.java
index 2137d5f3ad..c21263b778 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/trigger/JobTriggerListViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/job/trigger/JobTriggerListViewPanel.java
@@ -2,8 +2,8 @@ package io.onedev.server.web.editable.buildspec.job.trigger;
import io.onedev.server.buildspec.job.trigger.JobTrigger;
import io.onedev.server.web.behavior.NoRecordsBehavior;
-import io.onedev.server.web.component.offcanvas.OffCanvasCardPanel;
-import io.onedev.server.web.component.offcanvas.OffCanvasPanel;
+import io.onedev.server.web.component.draw.DrawCardPanel;
+import io.onedev.server.web.component.draw.DrawPanel;
import io.onedev.server.web.editable.BeanContext;
import io.onedev.server.web.editable.EditableUtils;
import org.apache.wicket.Component;
@@ -72,7 +72,7 @@ class JobTriggerListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
- new OffCanvasCardPanel(target, OffCanvasPanel.Placement.RIGHT, null) {
+ new DrawCardPanel(target, DrawPanel.Placement.RIGHT, null) {
@Override
protected Component newTitle(String componentId) {
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/param/spec/ParamSpecListViewPanel.java b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/param/spec/ParamSpecListViewPanel.java
index 627a88a678..3adf648c17 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/param/spec/ParamSpecListViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/param/spec/ParamSpecListViewPanel.java
@@ -33,8 +33,8 @@ import com.google.common.collect.Sets;
import io.onedev.server.buildspec.param.spec.ParamSpec;
import io.onedev.server.web.asset.inputspec.InputSpecCssResourceReference;
import io.onedev.server.web.behavior.NoRecordsBehavior;
-import io.onedev.server.web.component.offcanvas.OffCanvasCardPanel;
-import io.onedev.server.web.component.offcanvas.OffCanvasPanel;
+import io.onedev.server.web.component.draw.DrawCardPanel;
+import io.onedev.server.web.component.draw.DrawPanel;
import io.onedev.server.web.editable.BeanContext;
import io.onedev.server.web.editable.EditableUtils;
@@ -84,7 +84,7 @@ class ParamSpecListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
- new OffCanvasCardPanel(target, OffCanvasPanel.Placement.RIGHT, null) {
+ new DrawCardPanel(target, DrawPanel.Placement.RIGHT, null) {
@Override
protected Component newTitle(String componentId) {
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/StepListViewPanel.java b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/StepListViewPanel.java
index 90dad142fe..c46358cac2 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/StepListViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/StepListViewPanel.java
@@ -2,8 +2,8 @@ package io.onedev.server.web.editable.buildspec.step;
import io.onedev.server.buildspec.step.Step;
import io.onedev.server.web.behavior.NoRecordsBehavior;
-import io.onedev.server.web.component.offcanvas.OffCanvasCardPanel;
-import io.onedev.server.web.component.offcanvas.OffCanvasPanel;
+import io.onedev.server.web.component.draw.DrawCardPanel;
+import io.onedev.server.web.component.draw.DrawPanel;
import io.onedev.server.web.editable.BeanContext;
import io.onedev.server.web.editable.EditableUtils;
import io.onedev.server.web.util.TextUtils;
@@ -75,7 +75,7 @@ class StepListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
- new OffCanvasCardPanel(target, OffCanvasPanel.Placement.RIGHT, null) {
+ new DrawCardPanel(target, DrawPanel.Placement.RIGHT, null) {
@Override
protected Component newTitle(String componentId) {
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/step.css b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/step.css
index e8be9c3770..3948c6f98c 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/step.css
+++ b/server-core/src/main/java/io/onedev/server/web/editable/buildspec/step/step.css
@@ -1,5 +1,5 @@
@media(min-width: 768px) {
-.step.floating.off-canvas {
+.step.floating.draw {
width: 600px;
}
}
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/servicelocator/ServiceLocatorListViewPanel.java b/server-core/src/main/java/io/onedev/server/web/editable/servicelocator/ServiceLocatorListViewPanel.java
index ebfc3d595a..dacc70a6f5 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/servicelocator/ServiceLocatorListViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/servicelocator/ServiceLocatorListViewPanel.java
@@ -28,8 +28,8 @@ import com.google.common.collect.Sets;
import io.onedev.server.model.support.administration.jobexecutor.ServiceLocator;
import io.onedev.server.web.behavior.NoRecordsBehavior;
-import io.onedev.server.web.component.offcanvas.OffCanvasCardPanel;
-import io.onedev.server.web.component.offcanvas.OffCanvasPanel.Placement;
+import io.onedev.server.web.component.draw.DrawCardPanel;
+import io.onedev.server.web.component.draw.DrawPanel.Placement;
import io.onedev.server.web.component.svg.SpriteImage;
import io.onedev.server.web.editable.BeanContext;
@@ -175,7 +175,7 @@ class ServiceLocatorListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
- new OffCanvasCardPanel(target, Placement.RIGHT, null) {
+ new DrawCardPanel(target, Placement.RIGHT, null) {
@Override
protected Component newTitle(String componentId) {
diff --git a/server-core/src/main/java/io/onedev/server/web/mapper/BaseUrlMapper.java b/server-core/src/main/java/io/onedev/server/web/mapper/BaseUrlMapper.java
index 4e0d9845c7..b96ab8cc84 100644
--- a/server-core/src/main/java/io/onedev/server/web/mapper/BaseUrlMapper.java
+++ b/server-core/src/main/java/io/onedev/server/web/mapper/BaseUrlMapper.java
@@ -8,6 +8,7 @@ import org.apache.wicket.request.mapper.CompoundRequestMapper;
import io.onedev.commons.utils.ExplicitException;
import io.onedev.server.web.asset.icon.IconScope;
+import io.onedev.server.web.page.admin.aisetting.ChatPreserveDaysPage;
import io.onedev.server.web.page.admin.aisetting.LiteModelPage;
import io.onedev.server.web.page.admin.alertsettings.AlertSettingPage;
import io.onedev.server.web.page.admin.authenticator.AuthenticatorPage;
@@ -360,6 +361,7 @@ public class BaseUrlMapper extends CompoundRequestMapper {
add(new BasePageMapper("~administration/settings/alert", AlertSettingPage.class));
add(new BasePageMapper("~administration/settings/performance", PerformanceSettingPage.class));
add(new BasePageMapper("~administration/settings/lite-ai-model", LiteModelPage.class));
+ add(new BasePageMapper("~administration/settings/chat-preserve-days", ChatPreserveDaysPage.class));
add(new BasePageMapper("~administration/settings/backup", DatabaseBackupPage.class));
add(new BasePageMapper("~administration/settings/authenticator", AuthenticatorPage.class));
add(new BasePageMapper("~administration/settings/sso-providers", SsoProviderListPage.class));
diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/ChatPreserveDaysPage.html b/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/ChatPreserveDaysPage.html
new file mode 100644
index 0000000000..ee938528b9
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/ChatPreserveDaysPage.html
@@ -0,0 +1,16 @@
+<wicket:extend>
+ <div class="card">
+ <div class="card-body">
+ <div class="alert alert-notice alert-light">
+ <wicket:t>
+ Chats older than the specified number of days will be automatically deleted during daily maintenance.
+ </wicket:t>
+ </div>
+ <form wicket:id="form" class="leave-confirm">
+ <div wicket:id="editor" class="mb-4"></div>
+ <input type="submit" class="btn btn-primary dirty-aware" t:value="Save Settings">
+ </form>
+ </div>
+ </div>
+</wicket:extend>
+
diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/ChatPreserveDaysPage.java b/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/ChatPreserveDaysPage.java
new file mode 100644
index 0000000000..fc023985ba
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/ChatPreserveDaysPage.java
@@ -0,0 +1,61 @@
+package io.onedev.server.web.page.admin.aisetting;
+
+import static io.onedev.server.web.translation.Translation._T;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+import io.onedev.server.data.migration.VersionedXmlDoc;
+import io.onedev.server.model.support.administration.AiSetting;
+import io.onedev.server.service.SettingService;
+import io.onedev.server.web.editable.BeanContext;
+import io.onedev.server.web.page.admin.AdministrationPage;
+
+public class ChatPreserveDaysPage extends AdministrationPage {
+
+ @Inject
+ private SettingService settingService;
+
+ public ChatPreserveDaysPage(PageParameters params) {
+ super(params);
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ AiSetting aiSetting = settingService.getAiSetting();
+ var oldAuditContent = VersionedXmlDoc.fromBean(aiSetting).toXML();
+
+ Form<?> form = new Form<Void>("form") {
+
+ @Override
+ protected void onSubmit() {
+ super.onSubmit();
+ var newAuditContent = VersionedXmlDoc.fromBean(aiSetting).toXML();
+ settingService.saveAiSetting(aiSetting);
+ auditService.audit(null, "changed chat preserve days setting", oldAuditContent, newAuditContent);
+ getSession().success(_T("Chat preserve days setting has been saved"));
+
+ setResponsePage(ChatPreserveDaysPage.class);
+ }
+
+ };
+ form.add(BeanContext.edit("editor", aiSetting, Set.of(AiSetting.PROP_CHAT_PRESERVE_DAYS), false));
+
+ add(form);
+ }
+
+ @Override
+ protected Component newTopbarTitle(String componentId) {
+ return new Label(componentId, _T("Chat Preserve Days"));
+ }
+
+}
+
diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/LiteModelPage.java b/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/LiteModelPage.java
index b05e4e64d6..d9829832d4 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/LiteModelPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/aisetting/LiteModelPage.java
@@ -38,7 +38,7 @@ public class LiteModelPage extends AdministrationPage {
super.onSubmit();
var newAuditContent = VersionedXmlDoc.fromBean(aiSetting).toXML();
settingService.saveAiSetting(aiSetting);
- auditService.audit(null, "changed AI settings", oldAuditContent, newAuditContent);
+ auditService.audit(null, "changed lite AI model settings", oldAuditContent, newAuditContent);
getSession().success(_T("Lite AI model settings have been saved"));
setResponsePage(LiteModelPage.class);
diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/NewUserPage.java b/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/NewUserPage.java
index b0bc63f811..7414902fbc 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/NewUserPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/NewUserPage.java
@@ -1,8 +1,11 @@
package io.onedev.server.web.page.admin.usermanagement;
+import static io.onedev.server.model.User.Type.AI;
import static io.onedev.server.model.User.Type.ORDINARY;
import static io.onedev.server.web.translation.Translation._T;
+import javax.inject.Inject;
+
import org.apache.shiro.authc.credential.PasswordService;
import org.apache.wicket.Component;
import org.apache.wicket.Session;
@@ -16,8 +19,6 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;
import com.google.common.collect.Sets;
-import io.onedev.commons.loader.AppLoader;
-import io.onedev.server.OneDev;
import io.onedev.server.data.migration.VersionedXmlDoc;
import io.onedev.server.model.EmailAddress;
import io.onedev.server.model.Group;
@@ -25,6 +26,7 @@ import io.onedev.server.model.Membership;
import io.onedev.server.model.User;
import io.onedev.server.model.support.AiSetting;
import io.onedev.server.persistence.TransactionService;
+import io.onedev.server.service.AuditService;
import io.onedev.server.service.EmailAddressService;
import io.onedev.server.service.MembershipService;
import io.onedev.server.service.SettingService;
@@ -34,12 +36,33 @@ import io.onedev.server.util.PathNode;
import io.onedev.server.web.editable.BeanContext;
import io.onedev.server.web.page.admin.AdministrationPage;
import io.onedev.server.web.page.user.UserCssResourceReference;
+import io.onedev.server.web.page.user.aisetting.UserEntitlementSettingPage;
import io.onedev.server.web.page.user.basicsetting.UserBasicSettingPage;
-import io.onedev.server.web.util.WicketUtils;
import io.onedev.server.web.util.editbean.NewUserBean;
public class NewUserPage extends AdministrationPage {
+ @Inject
+ private PasswordService passwordService;
+
+ @Inject
+ private AuditService auditService;
+
+ @Inject
+ private TransactionService transactionService;
+
+ @Inject
+ private UserService userService;
+
+ @Inject
+ private EmailAddressService emailAddressService;
+
+ @Inject
+ private MembershipService membershipService;
+
+ @Inject
+ private SettingService settingService;
+
private NewUserBean bean = new NewUserBean();
private boolean continueToAdd;
@@ -53,8 +76,6 @@ public class NewUserPage extends AdministrationPage {
super.onInitialize();
var excludeProperties = Sets.newHashSet(User.PROP_NOTIFY_OWN_EVENTS);
- if (!WicketUtils.isSubscriptionActive())
- excludeProperties.add(User.PROP_TYPE);
var editor = BeanContext.edit("editor", bean, excludeProperties, true);
Form<?> form = new Form<Void>("form") {
@@ -63,13 +84,13 @@ public class NewUserPage extends AdministrationPage {
protected void onSubmit() {
super.onSubmit();
- User userWithSameName = getUserService().findByName(bean.getName());
+ User userWithSameName = userService.findByName(bean.getName());
if (userWithSameName != null) {
editor.error(new Path(new PathNode.Named(User.PROP_NAME)),
_T("User name already used by another account"));
}
- if (bean.getType() == ORDINARY && getEmailAddressService().findByValue(bean.getEmailAddress()) != null) {
+ if (bean.getType() == ORDINARY && emailAddressService.findByValue(bean.getEmailAddress()) != null) {
editor.error(new Path(new PathNode.Named(NewUserBean.PROP_EMAIL_ADDRESS)),
_T("Email address already used by another user"));
}
@@ -81,29 +102,29 @@ public class NewUserPage extends AdministrationPage {
var aiSetting = new AiSetting();
aiSetting.setModelSetting(bean.getAiModelSetting());
user.setAiSetting(aiSetting);
- var defaultLoginGroup = getSettingService().getSecuritySetting().getDefaultGroup();
+ var defaultLoginGroup = settingService.getSecuritySetting().getDefaultGroup();
if (user.getType() != ORDINARY) {
- getTransactionService().run(new Runnable() {
+ transactionService.run(new Runnable() {
@Override
public void run() {
- getUserService().create(user);
+ userService.create(user);
if (defaultLoginGroup != null)
createMembership(user, defaultLoginGroup);
}
});
} else {
- user.setPassword(AppLoader.getInstance(PasswordService.class).encryptPassword(bean.getPassword()));
+ user.setPassword(passwordService.encryptPassword(bean.getPassword()));
EmailAddress emailAddress = new EmailAddress();
emailAddress.setValue(bean.getEmailAddress());
emailAddress.setOwner(user);
emailAddress.setVerificationCode(null);
- getTransactionService().run(new Runnable() {
+ transactionService.run(new Runnable() {
@Override
public void run() {
- getUserService().create(user);
- getEmailAddressService().create(emailAddress);
+ userService.create(user);
+ emailAddressService.create(emailAddress);
if (defaultLoginGroup != null)
createMembership(user, defaultLoginGroup);
var newAuditContent = VersionedXmlDoc.fromBean(user).toXML();
@@ -117,6 +138,8 @@ public class NewUserPage extends AdministrationPage {
if (continueToAdd) {
bean = new NewUserBean();
replace(BeanContext.edit("editor", bean));
+ } else if (user.getType() == AI) {
+ setResponsePage(UserEntitlementSettingPage.class, UserEntitlementSettingPage.paramsOf(user));
} else {
setResponsePage(UserBasicSettingPage.class, UserBasicSettingPage.paramsOf(user));
}
@@ -150,27 +173,7 @@ public class NewUserPage extends AdministrationPage {
membership.setUser(user);
membership.setGroup(group);
user.getMemberships().add(membership);
- getMembershipService().create(membership);
- }
-
- private SettingService getSettingService() {
- return OneDev.getInstance(SettingService.class);
- }
-
- private TransactionService getTransactionService() {
- return OneDev.getInstance(TransactionService.class);
- }
-
- private MembershipService getMembershipService() {
- return OneDev.getInstance(MembershipService.class);
- }
-
- private UserService getUserService() {
- return OneDev.getInstance(UserService.class);
- }
-
- private EmailAddressService getEmailAddressService() {
- return OneDev.getInstance(EmailAddressService.class);
+ membershipService.create(membership);
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/page/base/BasePage.java b/server-core/src/main/java/io/onedev/server/web/page/base/BasePage.java
index 8624545ab2..49238445ea 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/base/BasePage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/base/BasePage.java
@@ -63,6 +63,7 @@ import io.onedev.commons.bootstrap.Bootstrap;
import io.onedev.server.OneDev;
import io.onedev.server.ai.ChatTool;
import io.onedev.server.ai.ChatToolAware;
+import io.onedev.server.ai.ToolExecutionResult;
import io.onedev.server.commandhandler.Upgrade;
import io.onedev.server.event.ListenerRegistry;
import io.onedev.server.model.User;
@@ -82,7 +83,7 @@ import io.onedev.server.web.page.security.LoginPage;
import io.onedev.server.web.page.serverinit.ServerInitPage;
import io.onedev.server.web.page.simple.SimplePage;
import io.onedev.server.web.util.WicketUtils;
-import io.onedev.server.web.websocket.ChatToolExecution;
+import io.onedev.server.web.websocket.AiToolExecution;
import io.onedev.server.web.websocket.ObservablesChanged;
import io.onedev.server.web.websocket.WebSocketService;
@@ -161,18 +162,19 @@ public abstract class BasePage extends WebPage {
public void onEvent(IEvent<?> event) {
super.onEvent(event);
if (event.getPayload() instanceof WebSocketPushPayload payload) {
- if (payload.getMessage() instanceof ObservablesChanged observablesChanged) {
- notifyObservablesChange(payload.getHandler(), observablesChanged.getObservables());
- } else if (payload.getMessage() instanceof ChatToolExecution chatToolExecution) {
+ if (payload.getMessage() instanceof ObservablesChanged changed) {
+ notifyObservablesChange(payload.getHandler(), changed.getObservables());
+ } else if (payload.getMessage() instanceof AiToolExecution execution) {
+ var subject = SecurityUtils.getSubject();
for (var tool : findChatTools()) {
- if (tool.getSpecification().name().equals(chatToolExecution.getToolName())) {
+ if (tool.getSpecification().name().equals(execution.getToolName())) {
try {
- var executionFuture = tool.execute(payload.getHandler(), chatToolExecution.getToolArguments());
- chatToolExecution.setExecutionFuture(executionFuture);
+ var future = tool.execute(payload.getHandler(), subject, execution.getToolArguments());
+ execution.setFuture(future);
} catch (Throwable t) {
- var executionFuture = new CompletableFuture<ChatToolExecution.Result>();
- executionFuture.completeExceptionally(t);
- chatToolExecution.setExecutionFuture(executionFuture);
+ var future = new CompletableFuture<ToolExecutionResult>();
+ future.completeExceptionally(t);
+ execution.setFuture(future);
}
break;
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.java b/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.java
index efe1246d7d..9f717a3b93 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.java
@@ -94,6 +94,7 @@ import io.onedev.server.web.component.svg.SpriteImage;
import io.onedev.server.web.component.user.UserAvatar;
import io.onedev.server.web.editable.EditableUtils;
import io.onedev.server.web.page.HomePage;
+import io.onedev.server.web.page.admin.aisetting.ChatPreserveDaysPage;
import io.onedev.server.web.page.admin.aisetting.LiteModelPage;
import io.onedev.server.web.page.admin.alertsettings.AlertSettingPage;
import io.onedev.server.web.page.admin.authenticator.AuthenticatorPage;
@@ -351,6 +352,9 @@ public abstract class LayoutPage extends BasePage {
aiMenuItems.add(new SidebarMenuItem.Page(null, _T("Lite Model"),
LiteModelPage.class, new PageParameters()));
+
+ aiMenuItems.add(new SidebarMenuItem.Page(null, _T("Chat Preserve Days"),
+ ChatPreserveDaysPage.class, new PageParameters()));
administrationMenuItems.add(new SidebarMenuItem.SubMenu(null, _T("AI Settings"), aiMenuItems));
@@ -828,7 +832,7 @@ public abstract class LayoutPage extends BasePage {
@Override
protected void onConfigure() {
super.onConfigure();
- setVisible(WicketUtils.isSubscriptionActive() && !assistant.getEntitledAis().isEmpty());
+ setVisible(!assistant.getEntitledAis().isEmpty());
}
});
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java
index eba2af2d8f..8517469ad1 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java
@@ -1,5 +1,6 @@
package io.onedev.server.web.page.project.blob;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static io.onedev.server.web.translation.Translation._T;
import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
@@ -1678,40 +1679,42 @@ public class ProjectBlobPage extends ProjectPage implements BlobRenderContext,
}
@Override
- public Collection<ChatTool> getChatTools() {
+ public List<ChatTool> getChatTools() {
+ var projectId = getProject().getId();
var commitId = getCommit().copy();
+
return List.of(
- new GetRootFilesAndFolders() {
+ wrapForChat(new GetRootFilesAndFolders() {
@Override
- protected Project getProject() {
- return ProjectBlobPage.this.getProject();
+ protected Long getProjectId() {
+ return projectId;
}
@Override
- protected ObjectId getCommitId(boolean oldRevision) {
+ protected ObjectId getCommitId() {
return commitId;
}
- },
- new GetFilesAndSubfolders() {
+ }),
+ wrapForChat(new GetFilesAndSubfolders() {
@Override
- protected Project getProject() {
- return ProjectBlobPage.this.getProject();
+ protected Long getProjectId() {
+ return projectId;
}
@Override
- protected ObjectId getCommitId(boolean oldRevision) {
+ protected ObjectId getCommitId() {
return commitId;
}
- },
- new GetFileContent() {
+ }),
+ wrapForChat(new GetFileContent(false) {
@Override
- protected Project getProject() {
- return ProjectBlobPage.this.getProject();
+ protected Long getProjectId() {
+ return projectId;
}
@Override
@@ -1719,12 +1722,12 @@ public class ProjectBlobPage extends ProjectPage implements BlobRenderContext,
return commitId;
}
- },
- new QuerySymbolDefinitions() {
+ }),
+ wrapForChat(new QuerySymbolDefinitions(false) {
@Override
- protected Project getProject() {
- return ProjectBlobPage.this.getProject();
+ protected Long getProjectId() {
+ return projectId;
}
@Override
@@ -1732,12 +1735,12 @@ public class ProjectBlobPage extends ProjectPage implements BlobRenderContext,
return commitId;
}
- },
- new QueryCodeSnippets() {
+ }),
+ wrapForChat(new QueryCodeSnippets(false) {
@Override
- protected Project getProject() {
- return ProjectBlobPage.this.getProject();
+ protected Long getProjectId() {
+ return projectId;
}
@Override
@@ -1745,20 +1748,39 @@ public class ProjectBlobPage extends ProjectPage implements BlobRenderContext,
return commitId;
}
- },
- new QueryFilePaths() {
+ }),
+ wrapForChat(new QueryFilePaths() {
@Override
- protected Project getProject() {
- return ProjectBlobPage.this.getProject();
+ protected Long getProjectId() {
+ return projectId;
}
@Override
- protected ObjectId getCommitId(boolean oldRevision) {
+ protected ObjectId getCommitId() {
return commitId;
}
- }
+ })
+ /*
+ wrapForChat(new AddCodeComment(false) {
+
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected Long getPullRequestId() {
+ return null;
+ }
+
+ @Override
+ protected ObjectId getCommitId(boolean oldRevision) {
+ return commitId;
+ }
+ })
+ */
);
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/renderers/buildspec/BuildSpecBlobEditPanel.java b/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/renderers/buildspec/BuildSpecBlobEditPanel.java
index 3316880387..b5d753b699 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/renderers/buildspec/BuildSpecBlobEditPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/renderers/buildspec/BuildSpecBlobEditPanel.java
@@ -1,11 +1,11 @@
package io.onedev.server.web.page.project.blob.render.renderers.buildspec;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static java.util.concurrent.CompletableFuture.completedFuture;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.validation.Validator;
+import org.apache.shiro.subject.Subject;
import org.apache.wicket.Component;
import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
import org.apache.wicket.markup.html.form.FormComponentPanel;
@@ -25,27 +26,28 @@ import com.google.common.base.Splitter;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import io.onedev.commons.utils.ExplicitException;
-import io.onedev.server.ai.BuildSpecSchema;
import io.onedev.server.ai.ChatTool;
import io.onedev.server.ai.ChatToolAware;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.tools.GetBuildSpecEditInstructions;
import io.onedev.server.buildspec.BuildSpec;
-import io.onedev.server.buildspec.job.JobVariable;
import io.onedev.server.data.migration.VersionedYamlDoc;
-import io.onedev.server.service.TemporalFutureService;
+import io.onedev.server.service.ManagedFutureService;
import io.onedev.server.web.component.diff.text.PlainTextDiffPanel;
import io.onedev.server.web.page.project.blob.render.BlobRenderContext;
import io.onedev.server.web.page.project.blob.render.edit.BlobEditPanel;
import io.onedev.server.web.page.project.blob.render.edit.plain.PlainEditPanel;
import io.onedev.server.web.page.project.blob.render.edit.plain.PlainEditSupport;
-import io.onedev.server.web.websocket.ChatToolExecution;
public class BuildSpecBlobEditPanel extends BlobEditPanel implements PlainEditSupport, ChatToolAware {
+ private static final int GET_BUILD_SPEC_TIMEOUT_SECONDS = 60;
+
@Inject
private Validator validator;
@Inject
- private TemporalFutureService temporalFutureService;
+ private ManagedFutureService managedFutureService;
public BuildSpecBlobEditPanel(String id, BlobRenderContext context) {
super(id, context);
@@ -55,9 +57,10 @@ public class BuildSpecBlobEditPanel extends BlobEditPanel implements PlainEditSu
return "buildspec:" + getSession().getId() + ":" + getPath();
}
+ @SuppressWarnings("unchecked")
@Override
protected void onFlushed(IPartialPageRequestHandler handler, byte[] editingContent) {
- CompletableFuture<ChatToolExecution.Result> future = temporalFutureService.removeFuture(getBuildSpecFutureId());
+ var future = (CompletableFuture<ToolExecutionResult>) (Object) managedFutureService.removeFuture(getBuildSpecFutureId());
if (future != null) {
if (getCurrentTab() != Tab.SAVE) {
var buildSpecString = new String(editingContent, StandardCharsets.UTF_8);
@@ -66,16 +69,17 @@ public class BuildSpecBlobEditPanel extends BlobEditPanel implements PlainEditSu
buildSpecString = VersionedYamlDoc.fromBean(buildSpec).toYaml();
} catch (Throwable t) {
}
- future.complete(new ChatToolExecution.Result(buildSpecString, false));
+ future.complete(new ToolExecutionResult(buildSpecString, false));
} else {
future.completeExceptionally(new ExplicitException("CI/CD spec is not being edited currently"));
}
}
}
+ @SuppressWarnings("unchecked")
@Override
protected void onFlushError(IPartialPageRequestHandler handler) {
- var future = temporalFutureService.removeFuture(getBuildSpecFutureId());
+ var future = (CompletableFuture<ToolExecutionResult>) (Object) managedFutureService.removeFuture(getBuildSpecFutureId());
if (future != null)
future.completeExceptionally(new ExplicitException("There are errors in current CI/CD spec, please fix first"));
}
@@ -111,59 +115,10 @@ public class BuildSpecBlobEditPanel extends BlobEditPanel implements PlainEditSu
}
@Override
- public Collection<ChatTool> getChatTools() {
+ public List<ChatTool> getChatTools() {
var tools = new ArrayList<ChatTool>();
if (getCurrentTab() != Tab.SAVE) {
- tools.add(new ChatTool() {
-
- @Override
- public ToolSpecification getSpecification() {
- return ToolSpecification.builder()
- .name("getBuildSpecEditInstructions")
- .description("Get instructions on how to edit CI/CD spec")
- .build();
- }
-
- @Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- var variables = new ArrayList<String>();
- for (JobVariable variable: JobVariable.values()) {
- variables.add("- @%s@".formatted(variable.name().toLowerCase()));
- }
- variables.add("- @secret:<job secret name>@ (get value of specified job secret)");
- variables.add("- @file:<workspace file path>@ (get content of specified workspace file generated in previous steps)");
-
- var instructions = """
- OneDev CI/CD spec is a yaml file conforming to below schema:
-
- <!SCHEMA BEGIN!>
- %s
- <!SCHEMA END!>
-
- Available variables that can be used in CI/CD spec:
- %s
-
- When editing CI/CD spec, remember that:
-
- 1. Files in job workspace are shared between different steps. So you can generate workspace files in one step, and use them in another step.
- 2. If command step is used, turn on the "run in container" if possible, unless requested by user explicitly
- 3. Different steps run in isolated environments (only job workspace is shared). So it will not work installing dependencies in one step, and run commands relying on them in another step. You should put them in a single step unless requested by user explicitly
- 4. If cache step is used:
- 4.1 It should be placed before the step building or testing the project
- 4.2 If the project has lock files (package.json, pom.xml, etc.):
- 4.2.1 A generate checksum step should be placed before the cache step, to generate checksum of all relevant lock files and store it in a file named checksum.txt
- 4.2.2 The key property should be configured as <keyname>-@file:checksum.txt@
- 4.2.3 The load keys property should be configured as <keyname>
- 4.2.4 The upload strategy property should be configured as UPLOAD_IF_NOT_HIT
- 5. If user wants to pass files between different jobs, one job should publish files via the publish artifact step, and another jobs can then download them into job workspace via job dependency
- 6. Call tools such as getRootFilesAndFolders, getFilesAndSubfolders and getTextContent to get project structure, and figure out what docker image and commands to use to build or test the project if requested by user
- 7. After editing the CI/CD spec, call saveBuildSpec tool to save the result. If saving fails, fix errors according to error messages and schema above and save again
- """.formatted(BuildSpecSchema.get(), Joiner.on("\n").join(variables));
-
- return completedFuture(new ChatToolExecution.Result(instructions, true));
- }
-
- });
+ tools.add(wrapForChat(new GetBuildSpecEditInstructions(true)));
tools.add(new ChatTool() {
@@ -176,10 +131,10 @@ public class BuildSpecBlobEditPanel extends BlobEditPanel implements PlainEditSu
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
requestToFlush(handler);
- var future = new CompletableFuture<ChatToolExecution.Result>();
- temporalFutureService.addFuture(getBuildSpecFutureId(), future);
+ var future = new CompletableFuture<ToolExecutionResult>();
+ managedFutureService.addFuture(getBuildSpecFutureId(), future, GET_BUILD_SPEC_TIMEOUT_SECONDS);
return future;
}
@@ -199,16 +154,16 @@ public class BuildSpecBlobEditPanel extends BlobEditPanel implements PlainEditSu
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
if (getCurrentTab() != Tab.SAVE) {
if (arguments.get("buildSpec") == null)
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Argument 'buildSpec' is required")), false));
+ return completedFuture(new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Argument 'buildSpec' is required")), false));
var buildSpecString = arguments.get("buildSpec").asText();
BuildSpec buildSpec;
try {
buildSpec = BuildSpec.parse(buildSpecString.getBytes(StandardCharsets.UTF_8));
} catch (Throwable t) {
- return completedFuture(new ChatToolExecution.Result(convertToJson(Map.of("successful", false, "failReason", "Malformed CI/CD spec, please fix and save again")), false));
+ return completedFuture(new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Malformed CI/CD spec, please fix and save again")), false));
}
var violations = validator.validate(buildSpec);
@@ -221,7 +176,7 @@ public class BuildSpecBlobEditPanel extends BlobEditPanel implements PlainEditSu
updateEditingContent(handler, buildSpecString.getBytes(StandardCharsets.UTF_8));
resultData = Map.of("successful", true);
}
- return completedFuture(new ChatToolExecution.Result(convertToJson(resultData), false));
+ return completedFuture(new ToolExecutionResult(convertToJson(resultData), false));
} else {
throw new ExplicitException("CI/CD spec is not being edited currently");
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/source/SourceViewPanel.java b/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/source/SourceViewPanel.java
index 683bfba03e..bd43ee6216 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/source/SourceViewPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/blob/render/source/SourceViewPanel.java
@@ -18,6 +18,7 @@ import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import javax.servlet.http.Cookie;
+import org.apache.shiro.subject.Subject;
import org.apache.wicket.Component;
import org.apache.wicket.Session;
import org.apache.wicket.ajax.AjaxChannel;
@@ -75,7 +76,8 @@ import io.onedev.commons.utils.PlanarRange;
import io.onedev.commons.utils.StringUtils;
import io.onedev.server.ai.ChatTool;
import io.onedev.server.ai.ChatToolAware;
-import io.onedev.server.ai.ChatToolUtils;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.ToolUtils;
import io.onedev.server.ai.tools.GetHighlightedText;
import io.onedev.server.attachment.ProjectAttachmentSupport;
import io.onedev.server.codequality.BlobTarget;
@@ -138,7 +140,6 @@ import io.onedev.server.web.page.project.commits.CommitDetailPage;
import io.onedev.server.web.util.AnnotationInfo;
import io.onedev.server.web.util.CodeCommentInfo;
import io.onedev.server.web.util.WicketUtils;
-import io.onedev.server.web.websocket.ChatToolExecution;
/**
* Make sure to add only one source view panel per page
@@ -1073,7 +1074,7 @@ public class SourceViewPanel extends BlobViewPanel implements Positionable, Sear
translations.put("unsaved-changes-prompt", _T("There are unsaved changes, discard and continue?"));
translations.put("show-comment", _T("Click to show comment of marked text"));
var page = (LayoutPage)getPage();
- if (WicketUtils.isSubscriptionActive() && !page.getAssistant().getEntitledAis().isEmpty())
+ if (!page.getAssistant().getEntitledAis().isEmpty())
translations.put("explain-selection", _T("Explain selected text with AI"));
translations.put("loading", _T("Loading..."));
@@ -1435,7 +1436,7 @@ public class SourceViewPanel extends BlobViewPanel implements Positionable, Sear
}
@Override
- public Collection<ChatTool> getChatTools() {
+ public List<ChatTool> getChatTools() {
var tools = new ArrayList<ChatTool>();
tools.add(new ChatTool() {
@@ -1448,23 +1449,23 @@ public class SourceViewPanel extends BlobViewPanel implements Positionable, Sear
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
var lines = context.getProject().getBlob(context.getBlobIdent(), true).getText().getLines();
var map = Map.of(
"fileName", context.getBlobIdent().getName(),
"fileContent", Joiner.on('\n').join(lines)
);
- return completedFuture(new ChatToolExecution.Result(ChatToolUtils.convertToJson(map), false));
+ return completedFuture(new ToolExecutionResult(ToolUtils.convertToJson(map), false));
}
});
var markRange = getMarkRange();
if (markRange != null) {
- tools.add(new GetHighlightedText(
+ tools.add(ToolUtils.wrapForChat(new GetHighlightedText(
context.getBlobIdent().path,
context.getProject().getBlob(context.getBlobIdent(), true).getText().getLines(),
- markRange));
+ markRange)));
}
return tools;
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/builds/detail/BuildDetailPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/builds/detail/BuildDetailPage.java
index e92020aa6e..c96039ba54 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/builds/detail/BuildDetailPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/builds/detail/BuildDetailPage.java
@@ -1,7 +1,8 @@
package io.onedev.server.web.page.project.builds.detail;
import static io.onedev.server.ai.BuildHelper.getDetail;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
+import static io.onedev.server.ai.ToolUtils.convertToJson;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static io.onedev.server.web.translation.Translation._T;
import static java.util.concurrent.CompletableFuture.completedFuture;
@@ -19,6 +20,8 @@ import javax.inject.Inject;
import javax.persistence.EntityNotFoundException;
import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.subject.Subject;
import org.apache.wicket.Component;
import org.apache.wicket.Page;
import org.apache.wicket.RestartResponseException;
@@ -49,6 +52,8 @@ import com.google.common.collect.Sets;
import dev.langchain4j.agent.tool.ToolSpecification;
import io.onedev.server.ai.ChatTool;
import io.onedev.server.ai.ChatToolAware;
+import io.onedev.server.ai.ToolExecutionResult;
+import io.onedev.server.ai.tools.GetBuildSpecEditInstructions;
import io.onedev.server.ai.tools.GetFileContent;
import io.onedev.server.ai.tools.QueryFilePaths;
import io.onedev.server.buildspec.BuildSpec;
@@ -111,9 +116,6 @@ import io.onedev.server.web.util.BuildAware;
import io.onedev.server.web.util.ConfirmClickModifier;
import io.onedev.server.web.util.Cursor;
import io.onedev.server.web.util.CursorSupport;
-import io.onedev.server.web.util.WicketUtils;
-import io.onedev.server.web.websocket.ChatToolExecution;
-import io.onedev.server.web.websocket.ChatToolExecution.Result;
public abstract class BuildDetailPage extends ProjectPage
implements InputContext, BuildAware, JobAuthorizationContextAware, ChatToolAware {
@@ -377,7 +379,6 @@ public abstract class BuildDetailPage extends ProjectPage
super.onConfigure();
setVisible(getBuild().isFailed()
&& SecurityUtils.canReadCode(getProject())
- && WicketUtils.isSubscriptionActive()
&& !getAssistant().getEntitledAis().isEmpty());
}
@@ -759,7 +760,8 @@ public abstract class BuildDetailPage extends ProjectPage
}
@Override
- public Collection<ChatTool> getChatTools() {
+ public List<ChatTool> getChatTools() {
+ var projectId = getProject().getId();
var tools = new ArrayList<ChatTool>();
tools.add(new ChatTool() {
@@ -772,8 +774,8 @@ public abstract class BuildDetailPage extends ProjectPage
}
@Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- return completedFuture(new ChatToolExecution.Result(convertToJson(getDetail(getProject(), getBuild())), false));
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
+ return completedFuture(new ToolExecutionResult(convertToJson(getDetail(getProject(), getBuild())), false));
}
});
@@ -790,7 +792,7 @@ public abstract class BuildDetailPage extends ProjectPage
}
@Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
var instructions = """
Follow below steps to investigate build failure:
- Call 'getCurrentBuild' tool to get detail of current build
@@ -799,10 +801,11 @@ public abstract class BuildDetailPage extends ProjectPage
""";
if (previousSuccessfulSimilarBuild != null)
- instructions += "- If necessary, use tool 'getChangesSincePreviousSuccessfulBuild' to understand what has been changed since the previous successful build";
- instructions += "- If necessary, use tools 'queryFilePaths' and 'getFileContent' to search and read files mentioned in build log";
+ instructions += "- If necessary, use tool 'getChangesSincePreviousSuccessfulBuild' to understand what has been changed since the previous successful build\n";
+ instructions += "- If necessary, use tools 'queryFilePaths' and 'getFileContent' to search and read files mentioned in build log\n";
+ instructions += "- If necessary, use tool 'getBuildSpecEditInstructions' to get instructions on how to edit CI/CD spec";
- return completedFuture(new Result(instructions, true));
+ return completedFuture(new ToolExecutionResult(instructions, true));
}
});
@@ -819,20 +822,22 @@ public abstract class BuildDetailPage extends ProjectPage
}
@Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
+ if (!SecurityUtils.canReadCode(subject, getProject()))
+ throw new UnauthorizedException();
var oldCommitId = previousSuccessfulSimilarBuild.getCommitId();
var newCommitId = getBuild().getCommitId();
var patch = gitService.getPatch(getProject(), oldCommitId, newCommitId);
if (patch.length() > MAX_PATCH_SIZE)
- return completedFuture(new Result(convertToJson(Map.of("successful", false, "failReason", "Patch is too large")), false));
+ return completedFuture(new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Patch is too large")), false));
else
- return completedFuture(new Result(convertToJson(Map.of("successful", true, "patch", patch)), false));
+ return completedFuture(new ToolExecutionResult(convertToJson(Map.of("successful", true, "patch", patch)), false));
}
});
}
}
- if (getBuild().isFinished() && SecurityUtils.canAccessLog(getBuild())) {
+ if (getBuild().isFinished()) {
tools.add(new ChatTool() {
private static final int MAX_LOG_ENTRIES = 2000;
@@ -846,63 +851,66 @@ public abstract class BuildDetailPage extends ProjectPage
}
@Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
+ if (!SecurityUtils.canAccessLog(subject, getBuild()))
+ throw new UnauthorizedException();
var snippet = logService.readLogSnippetReversely(
getBuild().getProject().getId(), getBuild().getNumber(), MAX_LOG_ENTRIES);
var builder = new StringBuilder();
for (var entry : snippet.entries) {
builder.append(entry.render()).append("\n");
}
- return completedFuture(new Result(builder.toString(), false));
+ return completedFuture(new ToolExecutionResult(builder.toString(), false));
}
});
}
- if (SecurityUtils.canReadCode(getProject())) {
- tools.add(new ChatTool() {
+ tools.add(new ChatTool() {
- @Override
- public ToolSpecification getSpecification() {
- return ToolSpecification.builder()
- .name("getBuildSpec")
- .description("Get content of CI/CD spec used to run the build")
- .build();
- }
+ @Override
+ public ToolSpecification getSpecification() {
+ return ToolSpecification.builder()
+ .name("getBuildSpec")
+ .description("Get content of CI/CD spec used to run the build")
+ .build();
+ }
- @Override
- public CompletableFuture<Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- var blobIdent = new BlobIdent(getBuild().getCommitId().name(), BuildSpec.BLOB_PATH, FileMode.REGULAR_FILE.getBits());
- return completedFuture(new Result(getProject().getBlob(blobIdent, true).getText().getContent(), false));
- }
+ @Override
+ public CompletableFuture<ToolExecutionResult> execute(IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {
+ if (!SecurityUtils.canReadCode(subject, getProject()))
+ throw new UnauthorizedException();
+ var blobIdent = new BlobIdent(getBuild().getCommitId().name(), BuildSpec.BLOB_PATH, FileMode.REGULAR_FILE.getBits());
+ return completedFuture(new ToolExecutionResult(getProject().getBlob(blobIdent, true).getText().getContent(), false));
+ }
- });
- tools.add(new QueryFilePaths() {
-
- @Override
- protected Project getProject() {
- return BuildDetailPage.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return getBuild().getCommitId();
- }
+ });
+ tools.add(wrapForChat(new GetBuildSpecEditInstructions(false)));
+ tools.add(wrapForChat(new QueryFilePaths() {
+
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected ObjectId getCommitId() {
+ return getBuild().getCommitId();
+ }
- });
- tools.add(new GetFileContent() {
+ }));
+ tools.add(wrapForChat(new GetFileContent(false) {
- @Override
- protected Project getProject() {
- return BuildDetailPage.this.getProject();
- }
-
- @Override
- protected ObjectId getCommitId(boolean oldRevision) {
- return getBuild().getCommitId();
- }
+ @Override
+ protected Long getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ protected ObjectId getCommitId(boolean oldRevision) {
+ return getBuild().getCommitId();
+ }
- });
- }
+ }));
return tools;
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/commits/CommitDetailPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/commits/CommitDetailPage.java
index c8e83cf77d..3206b3ba79 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/commits/CommitDetailPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/commits/CommitDetailPage.java
@@ -6,6 +6,8 @@ import com.google.common.collect.Sets;
import io.onedev.commons.utils.ExplicitException;
import io.onedev.commons.utils.PlanarRange;
import io.onedev.server.OneDev;
+import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.ChatToolAware;
import io.onedev.server.buildspec.BuildSpec;
import io.onedev.server.buildspec.job.Job;
import io.onedev.server.codequality.CodeProblem;
@@ -84,11 +86,13 @@ import java.io.Serializable;
import java.text.MessageFormat;
import java.util.*;
+import static io.onedev.server.ai.ToolUtils.getDiffTools;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static io.onedev.server.entityreference.ReferenceUtils.transformReferences;
import static io.onedev.server.web.translation.Translation._T;
import static java.util.stream.Collectors.toList;
-public class CommitDetailPage extends ProjectPage implements RevisionAnnotationSupport, JobAuthorizationContextAware {
+public class CommitDetailPage extends ProjectPage implements RevisionAnnotationSupport, JobAuthorizationContextAware, ChatToolAware {
private static final Logger logger = LoggerFactory.getLogger(CommitDetailPage.class);
@@ -1074,4 +1078,12 @@ public class CommitDetailPage extends ProjectPage implements RevisionAnnotationS
return operateBranches;
}
+ @Override
+ public List<ChatTool> getChatTools() {
+ var projectId = getProject().getId();
+ var oldCommitId = getCompareWith().copy();
+ var newCommitId = getCommit().copy();
+ return wrapForChat(getDiffTools(projectId, oldCommitId, newCommitId, null));
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java b/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java
index c302884723..8d89021ec4 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java
@@ -1,5 +1,7 @@
package io.onedev.server.web.page.project.compare;
+import static io.onedev.server.ai.ToolUtils.getDiffTools;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static io.onedev.server.search.commit.Revision.Type.COMMIT;
import static io.onedev.server.web.translation.Translation._T;
@@ -37,6 +39,8 @@ import com.google.common.collect.Lists;
import io.onedev.commons.utils.PlanarRange;
import io.onedev.server.OneDev;
+import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.ChatToolAware;
import io.onedev.server.codequality.CodeProblem;
import io.onedev.server.codequality.CodeProblemContribution;
import io.onedev.server.codequality.CoverageStatus;
@@ -77,7 +81,7 @@ import io.onedev.server.web.page.project.pullrequests.create.NewPullRequestPage;
import io.onedev.server.web.page.project.pullrequests.detail.activities.PullRequestActivitiesPage;
import io.onedev.server.web.util.EditParamsAware;
-public class RevisionComparePage extends ProjectPage implements RevisionAnnotationSupport, EditParamsAware {
+public class RevisionComparePage extends ProjectPage implements RevisionAnnotationSupport, EditParamsAware, ChatToolAware {
public enum TabPanel {
COMMITS,
@@ -945,5 +949,17 @@ public class RevisionComparePage extends ProjectPage implements RevisionAnnotati
else
return new ViewStateAwarePageLink<Void>(componentId, ProjectDashboardPage.class, ProjectDashboardPage.paramsOf(project.getId()));
}
+
+ @Override
+ public List<ChatTool> getChatTools() {
+ if (mergeBase != null) {
+ var projectId = getProject().getId();
+ var oldCommitId = state.compareWithMergeBase?mergeBase:state.leftSide.getCommit().copy();
+ var newCommitId = state.rightSide.getCommit().copy();
+ return wrapForChat(getDiffTools(projectId, oldCommitId, newCommitId, null));
+ } else {
+ return new ArrayList<>();
+ }
+ }
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/issues/detail/IssueDetailPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/issues/detail/IssueDetailPage.java
index 4939c7a403..562d5b5145 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/issues/detail/IssueDetailPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/issues/detail/IssueDetailPage.java
@@ -1,15 +1,12 @@
package io.onedev.server.web.page.project.issues.detail;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static io.onedev.server.ai.IssueHelper.getDetail;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static io.onedev.server.web.translation.Translation._T;
-import static java.util.concurrent.CompletableFuture.completedFuture;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import javax.persistence.EntityNotFoundException;
@@ -21,7 +18,6 @@ import org.apache.wicket.Page;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.Session;
import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
@@ -37,13 +33,10 @@ import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.flow.RedirectToUrlException;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
-import dev.langchain4j.agent.tool.ToolSpecification;
import io.onedev.server.ai.ChatTool;
import io.onedev.server.ai.ChatToolAware;
-import io.onedev.server.ai.IssueHelper;
import io.onedev.server.buildspecmodel.inputspec.InputContext;
import io.onedev.server.data.migration.VersionedXmlDoc;
import io.onedev.server.model.Issue;
@@ -78,7 +71,6 @@ import io.onedev.server.web.page.project.issues.list.ProjectIssueListPage;
import io.onedev.server.web.util.ConfirmClickModifier;
import io.onedev.server.web.util.Cursor;
import io.onedev.server.web.util.CursorSupport;
-import io.onedev.server.web.websocket.ChatToolExecution;
import io.onedev.server.xodus.VisitInfoService;
public abstract class IssueDetailPage extends ProjectIssuesPage implements InputContext, ChatToolAware {
@@ -448,42 +440,8 @@ public abstract class IssueDetailPage extends ProjectIssuesPage implements Input
}
@Override
- public Collection<ChatTool> getChatTools() {
- var tools = new ArrayList<ChatTool>();
- tools.add(new ChatTool() {
-
- @Override
- public ToolSpecification getSpecification() {
- return ToolSpecification.builder()
- .name("getCurrentIssue")
- .description("Get info of current issue in json format")
- .build();
- }
-
- @Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- return completedFuture(new ChatToolExecution.Result(convertToJson(getDetail(getProject(), getIssue())), false));
- }
-
- });
-
- tools.add(new ChatTool() {
-
- @Override
- public ToolSpecification getSpecification() {
- return ToolSpecification.builder()
- .name("getCurrentIssueComments")
- .description("Get comments of current issue in json format")
- .build();
- }
-
- @Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- return completedFuture(new ChatToolExecution.Result(convertToJson(IssueHelper.getComments(getIssue())), false));
- }
-
- });
- return tools;
+ public List<ChatTool> getChatTools() {
+ return wrapForChat(getIssue().getTools());
}
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/create/NewPullRequestPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/create/NewPullRequestPage.java
index b2ff159b71..fe88b1994b 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/create/NewPullRequestPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/create/NewPullRequestPage.java
@@ -1,5 +1,7 @@
package io.onedev.server.web.page.project.pullrequests.create;
+import static io.onedev.server.ai.ToolUtils.getDiffTools;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static io.onedev.server.model.PullRequest.MAX_DESCRIPTION_LEN;
import static io.onedev.server.model.PullRequest.MAX_TITLE_LEN;
import static io.onedev.server.search.commit.Revision.Type.COMMIT;
@@ -65,6 +67,8 @@ import dev.langchain4j.data.message.SystemMessage;
import dev.langchain4j.data.message.UserMessage;
import io.onedev.commons.utils.ExplicitException;
import io.onedev.commons.utils.PlanarRange;
+import io.onedev.server.ai.ChatTool;
+import io.onedev.server.ai.ChatToolAware;
import io.onedev.server.attachment.AttachmentSupport;
import io.onedev.server.attachment.ProjectAttachmentSupport;
import io.onedev.server.codequality.CodeProblem;
@@ -133,7 +137,7 @@ import io.onedev.server.web.page.security.LoginPage;
import io.onedev.server.web.util.TextUtils;
import io.onedev.server.web.util.editbean.LabelsBean;
-public class NewPullRequestPage extends ProjectPage implements RevisionAnnotationSupport {
+public class NewPullRequestPage extends ProjectPage implements RevisionAnnotationSupport, ChatToolAware {
private static final Logger logger = LoggerFactory.getLogger(NewPullRequestPage.class);
@@ -1297,5 +1301,17 @@ public class NewPullRequestPage extends ProjectPage implements RevisionAnnotatio
else
return new ViewStateAwarePageLink<Void>(componentId, ProjectDashboardPage.class, ProjectDashboardPage.paramsOf(project.getId()));
}
+
+ @Override
+ public List<ChatTool> getChatTools() {
+ if (!getPullRequest().isMerged()) {
+ var projectId = getProject().getId();
+ var oldCommitId = ObjectId.fromString(getPullRequest().getBaseCommitHash());
+ var newCommitId = ObjectId.fromString(getPullRequest().getLatestUpdate().getHeadCommitHash());
+ return wrapForChat(getDiffTools(projectId, oldCommitId, newCommitId, null));
+ } else {
+ return new ArrayList<>();
+ }
+ }
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java
index f1c66fc981..b7aa766266 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java
@@ -1,14 +1,12 @@
package io.onedev.server.web.page.project.pullrequests.detail;
-import static io.onedev.server.ai.ChatToolUtils.convertToJson;
-import static io.onedev.server.ai.PullRequestHelper.getDetail;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
import static io.onedev.server.entityreference.ReferenceUtils.transformReferences;
import static io.onedev.server.model.support.pullrequest.MergeStrategy.CREATE_MERGE_COMMIT;
import static io.onedev.server.model.support.pullrequest.MergeStrategy.CREATE_MERGE_COMMIT_IF_NECESSARY;
import static io.onedev.server.model.support.pullrequest.MergeStrategy.REBASE_SOURCE_BRANCH_COMMITS;
import static io.onedev.server.model.support.pullrequest.MergeStrategy.SQUASH_SOURCE_BRANCH_COMMITS;
import static io.onedev.server.web.translation.Translation._T;
-import static java.util.concurrent.CompletableFuture.completedFuture;
import static org.unbescape.html.HtmlEscape.escapeHtml5;
import java.io.Serializable;
@@ -21,7 +19,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@@ -70,13 +67,10 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.eclipse.jgit.lib.ObjectId;
import org.jetbrains.annotations.Nullable;
-import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Sets;
-import dev.langchain4j.agent.tool.ToolSpecification;
import io.onedev.server.ai.ChatTool;
import io.onedev.server.ai.ChatToolAware;
-import io.onedev.server.ai.PullRequestHelper;
import io.onedev.server.attachment.AttachmentSupport;
import io.onedev.server.attachment.ProjectAttachmentSupport;
import io.onedev.server.data.migration.VersionedXmlDoc;
@@ -177,7 +171,6 @@ import io.onedev.server.web.util.PullRequestAware;
import io.onedev.server.web.util.TextUtils;
import io.onedev.server.web.util.editbean.CommitMessageBean;
import io.onedev.server.web.util.editbean.LabelsBean;
-import io.onedev.server.web.websocket.ChatToolExecution;
import io.onedev.server.xodus.VisitInfoService;
public abstract class PullRequestDetailPage extends ProjectPage implements PullRequestAware, ChatToolAware {
@@ -2404,42 +2397,8 @@ public abstract class PullRequestDetailPage extends ProjectPage implements PullR
}
@Override
- public Collection<ChatTool> getChatTools() {
- var tools = new ArrayList<ChatTool>();
- tools.add(new ChatTool() {
-
- @Override
- public ToolSpecification getSpecification() {
- return ToolSpecification.builder()
- .name("getCurrentPullRequest")
- .description("Get info of current pull request in json format")
- .build();
- }
-
- @Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- return completedFuture(new ChatToolExecution.Result(convertToJson(getDetail(getProject(), getPullRequest())), false));
- }
-
- });
-
- tools.add(new ChatTool() {
-
- @Override
- public ToolSpecification getSpecification() {
- return ToolSpecification.builder()
- .name("getCurrentPullRequestComments")
- .description("Get comments of current pull request in json format")
- .build();
- }
-
- @Override
- public CompletableFuture<ChatToolExecution.Result> execute(IPartialPageRequestHandler handler, JsonNode arguments) {
- return completedFuture(new ChatToolExecution.Result(convertToJson(PullRequestHelper.getComments(getPullRequest())), false));
- }
-
- });
- return tools;
+ public List<ChatTool> getChatTools() {
+ return wrapForChat(getPullRequest().getTools());
}
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/activities/PullRequestActivitiesPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/activities/PullRequestActivitiesPage.java
index d18382a30c..9825742dd7 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/activities/PullRequestActivitiesPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/activities/PullRequestActivitiesPage.java
@@ -67,7 +67,6 @@ import io.onedev.server.web.page.project.pullrequests.detail.activities.activity
import io.onedev.server.web.page.project.pullrequests.detail.activities.activity.PullRequestCommentActivity;
import io.onedev.server.web.page.project.pullrequests.detail.activities.activity.PullRequestUpdateActivity;
import io.onedev.server.web.page.security.LoginPage;
-import io.onedev.server.web.util.WicketUtils;
public class PullRequestActivitiesPage extends PullRequestDetailPage {
@@ -424,7 +423,7 @@ public class PullRequestActivitiesPage extends PullRequestDetailPage {
protected void onConfigure() {
super.onConfigure();
var page = (LayoutPage)getPage();
- setVisible(WicketUtils.isSubscriptionActive() && !page.getAssistant().getEntitledAis().isEmpty());
+ setVisible(!page.getAssistant().getEntitledAis().isEmpty());
}
});
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/changes/PullRequestChangesPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/changes/PullRequestChangesPage.java
index 4096344619..b51a5ec6e2 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/changes/PullRequestChangesPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/changes/PullRequestChangesPage.java
@@ -1,32 +1,20 @@
package io.onedev.server.web.page.project.pullrequests.detail.changes;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import io.onedev.commons.utils.PlanarRange;
-import io.onedev.server.OneDev;
-import io.onedev.server.codequality.*;
-import io.onedev.server.service.*;
-import io.onedev.server.git.BlobIdent;
-import io.onedev.server.git.GitUtils;
-import io.onedev.server.model.*;
-import io.onedev.server.model.support.CompareContext;
-import io.onedev.server.model.support.Mark;
-import io.onedev.server.model.support.pullrequest.changedata.PullRequestApproveData;
-import io.onedev.server.model.support.pullrequest.changedata.PullRequestRequestedForChangesData;
-import io.onedev.server.util.diff.DiffUtils;
-import io.onedev.server.util.diff.WhitespaceOption;
-import io.onedev.server.web.ajaxlistener.ConfirmLeaveListener;
-import io.onedev.server.web.behavior.AbstractPostAjaxBehavior;
-import io.onedev.server.web.behavior.ChangeObserver;
-import io.onedev.server.web.component.diff.revision.RevisionAnnotationSupport;
-import io.onedev.server.web.component.diff.revision.RevisionDiffPanel;
-import io.onedev.server.web.component.diff.revision.RevisionDiffReviewSupport;
-import io.onedev.server.web.component.floating.AlignPlacement;
-import io.onedev.server.web.component.floating.FloatingPanel;
-import io.onedev.server.web.component.link.DropdownLink;
-import io.onedev.server.web.page.project.blob.ProjectBlobPage;
-import io.onedev.server.web.page.project.pullrequests.detail.PullRequestDetailPage;
-import io.onedev.server.web.util.EditParamsAware;
+import static io.onedev.server.ai.ToolUtils.getDiffTools;
+import static io.onedev.server.ai.ToolUtils.wrapForChat;
+import static io.onedev.server.web.translation.Translation._T;
+import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -53,13 +41,54 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
-
import org.jspecify.annotations.Nullable;
-import java.io.Serializable;
-import java.util.*;
-import static io.onedev.server.web.translation.Translation._T;
-import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+
+import io.onedev.commons.utils.PlanarRange;
+import io.onedev.server.OneDev;
+import io.onedev.server.ai.ChatTool;
+import io.onedev.server.codequality.BlobTarget;
+import io.onedev.server.codequality.CodeProblem;
+import io.onedev.server.codequality.CodeProblemContribution;
+import io.onedev.server.codequality.CoverageStatus;
+import io.onedev.server.codequality.LineCoverageContribution;
+import io.onedev.server.git.BlobIdent;
+import io.onedev.server.git.GitUtils;
+import io.onedev.server.model.Build;
+import io.onedev.server.model.CodeComment;
+import io.onedev.server.model.CodeCommentReply;
+import io.onedev.server.model.CodeCommentStatusChange;
+import io.onedev.server.model.Project;
+import io.onedev.server.model.PullRequest;
+import io.onedev.server.model.PullRequestChange;
+import io.onedev.server.model.PullRequestUpdate;
+import io.onedev.server.model.ReviewedDiff;
+import io.onedev.server.model.User;
+import io.onedev.server.model.support.CompareContext;
+import io.onedev.server.model.support.Mark;
+import io.onedev.server.model.support.pullrequest.changedata.PullRequestApproveData;
+import io.onedev.server.model.support.pullrequest.changedata.PullRequestRequestedForChangesData;
+import io.onedev.server.service.CodeCommentReplyService;
+import io.onedev.server.service.CodeCommentService;
+import io.onedev.server.service.CodeCommentStatusChangeService;
+import io.onedev.server.service.PullRequestService;
+import io.onedev.server.service.ReviewedDiffService;
+import io.onedev.server.util.diff.DiffUtils;
+import io.onedev.server.util.diff.WhitespaceOption;
+import io.onedev.server.web.ajaxlistener.ConfirmLeaveListener;
+import io.onedev.server.web.behavior.AbstractPostAjaxBehavior;
+import io.onedev.server.web.behavior.ChangeObserver;
+import io.onedev.server.web.component.diff.revision.RevisionAnnotationSupport;
+import io.onedev.server.web.component.diff.revision.RevisionDiffPanel;
+import io.onedev.server.web.component.diff.revision.RevisionDiffReviewSupport;
+import io.onedev.server.web.component.floating.AlignPlacement;
+import io.onedev.server.web.component.floating.FloatingPanel;
+import io.onedev.server.web.component.link.DropdownLink;
+import io.onedev.server.web.page.project.blob.ProjectBlobPage;
+import io.onedev.server.web.page.project.pullrequests.detail.PullRequestDetailPage;
+import io.onedev.server.web.util.EditParamsAware;
public class PullRequestChangesPage extends PullRequestDetailPage implements RevisionAnnotationSupport, EditParamsAware {
@@ -242,15 +271,11 @@ public class PullRequestChangesPage extends PullRequestDetailPage implements Rev
@Nullable
private Mark getPermanentMark(Mark mark) {
- ObjectId oldCommitId = ObjectId.fromString(state.oldCommitHash);
- if (mark.getCommitHash().equals(getComparisonBase().name())) {
- return mark.mapTo(getProject(), oldCommitId);
- } else if (mark.getCommitHash().equals(state.oldCommitHash)
- || mark.getCommitHash().equals(state.newCommitHash)) {
- return mark;
- } else {
- return null;
- }
+ return mark.permanentize(
+ getProject(),
+ ObjectId.fromString(state.oldCommitHash),
+ ObjectId.fromString(state.newCommitHash),
+ getComparisonBase());
}
private boolean isOutdated() {
@@ -1068,4 +1093,16 @@ public class PullRequestChangesPage extends PullRequestDetailPage implements Rev
return coverages;
}
+ @Override
+ public List<ChatTool> getChatTools() {
+ var tools = new ArrayList<ChatTool>();
+ var projectId = getProject().getId();
+ var requestId = getPullRequest().getId();
+ var oldCommitId = ObjectId.fromString(state.oldCommitHash);
+ var newCommitId = ObjectId.fromString(state.newCommitHash);
+ tools.addAll(wrapForChat(getDiffTools(projectId, oldCommitId, newCommitId, requestId)));
+ tools.addAll(super.getChatTools());
+ return tools;
+ }
+
}
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_de.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_de.java
index 3a7d251c80..e21d812881 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_de.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_de.java
@@ -130,6 +130,7 @@ public class Translation_de extends TranslationResourceBundle {
m.put("AI Settings", "KI-Einstellungen");
m.put("AI entitlement settings have been saved", "AI-Berechtigungseinstellungen wurden gespeichert");
m.put("AI model settings have been saved", "AI-Modell-Einstellungen wurden gespeichert");
+ m.put("AI system prompt has been saved", "AI-Systemaufforderung wurde gespeichert");
m.put("API Key", "API-Schlüssel");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"API-URL Ihrer JIRA-Cloud-Instanz, beispielsweise <tt>https://your-domain.atlassian.net/rest/api/3</tt>");
@@ -279,6 +280,8 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Allow Multiple", "Mehrfach erlauben");
m.put("Allowed Licenses", "Zulässige Lizenzen");
m.put("Allowed Self Sign-Up Email Domain", "Zulässige E-Mail-Domain für Selbstregistrierung");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "Fügen Sie auch Folgendes zu $HOME/.m2/settings.xml hinzu, wenn Sie das Projekt von der Befehlszeile aus kompilieren möchten");
m.put("Always", "Immer");
m.put("Always Pull Image", "Image immer ziehen");
m.put("An issue already linked for {0}. Unlink it first", "Ein Issue ist bereits für {0} verlinkt. Entfernen Sie es zuerst");
@@ -423,6 +426,8 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Belonging Groups", "Zugehörige Gruppen");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"Unten sind einige häufige Kriterien. Geben Sie im Suchfeld oben ein, um die vollständige Liste und verfügbare Kombinationen anzuzeigen.");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "Der untenstehende Inhalt wurde aus einer ungespeicherten Änderung wiederhergestellt. <a class=\"clear-unsaved-change\">Löschen</a>, um zu verwerfen");
m.put("Below content is restored from an unsaved change. Clear to discard", "Der untenstehende Inhalt wurde aus einer nicht gespeicherten Änderung wiederhergestellt. Löschen, um zu verwerfen");
m.put("Below information will also be sent", "Die untenstehenden Informationen werden ebenfalls gesendet");
m.put("Binary file.", "Binärdatei.");
@@ -598,9 +603,13 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Changes since this comment", "Änderungen seit diesem Kommentar");
m.put("Channel Notification", "Kanalbenachrichtigung");
m.put("Chart Metadata", "Diagramm-Metadaten");
+ m.put("Chat Preserve Days", "Chat-Aufbewahrungstage");
m.put("Chat deleted", "Chat gelöscht");
+ m.put("Chat preserve days setting has been saved", "Einstellung der Chat-Aufbewahrungstage wurde gespeichert");
m.put("Chat with", "Chat mit");
m.put("Chat with AI", "Chat mit AI");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "Chats, die älter als die angegebene Anzahl von Tagen sind, werden während der täglichen Wartung automatisch gelöscht.");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"Sehen Sie sich <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHubs Anleitung</a> an, wie Sie GPG-Schlüssel generieren und verwenden, um Ihre Commits zu signieren");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1202,7 +1211,7 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Enter your details to create your account", "Geben Sie Ihre Daten ein, um Ihr Konto zu erstellen");
m.put("Enter your details to login to your account", "Geben Sie Ihre Daten ein, um sich in Ihrem Konto anzumelden");
m.put("Enter your user name or email to reset password", "Geben Sie Ihren Benutzernamen oder Ihre E-Mail ein, um das Passwort zurückzusetzen");
- m.put("Entitle to All Users", "Allen Benutzern zuweisen");
+ m.put("Entitle to All Users and Projects", "Allen Benutzern und Projekten zuweisen");
m.put("Entitled Groups", "Berechtigte Gruppen");
m.put("Entitled Projects", "Berechtigte Projekte");
m.put("Entitled Users", "Berechtigte Benutzer");
@@ -1321,7 +1330,6 @@ public class Translation_de extends TranslationResourceBundle {
m.put("File missing or obsolete", "Datei fehlt oder ist veraltet");
m.put("File name", "Dateiname");
m.put("File name patterns such as *.java, *.c", "Dateinamenmuster wie *.java, *.c");
- m.put("File path to get text content", "Dateipfad, um Textinhalt zu erhalten");
m.put("Files", "Dateien");
m.put("Files to Be Analyzed", "Zu analysierende Dateien");
m.put("Filter", "Filter");
@@ -1364,13 +1372,14 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Fixing...", "Beheben...");
m.put("Float", "Fließkommazahl");
m.put("Flush", "Leeren");
- m.put("Folder path to list all files and subfolders", "Ordnerpfad, um alle Dateien und Unterordner aufzulisten");
m.put("Follow below instructions to publish packages into this project", "Befolgen Sie die unten stehenden Anweisungen, um Pakete in dieses Projekt zu veröffentlichen");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"Befolgen Sie die unten stehenden Schritte, um den Agenten auf einer Remote-Maschine zu installieren (unterstützt Linux/Windows/Mac OS X/FreeBSD):");
m.put("For CI/CD job, add this gem to Gemfile like below", "Für CI/CD-Job, fügen Sie dieses Gem wie unten gezeigt zur Gemfile hinzu");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"Für CI/CD-Job, fügen Sie dieses Paket zu requirements.txt hinzu und führen Sie unten aus, um das Paket über den Befehls-Schritt zu installieren");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "Für CI/CD-Jobs ist es bequemer, eine benutzerdefinierte settings.xml zu verwenden, zum Beispiel über den folgenden Code in einem Befehlschritt:");
m.put("For CI/CD job, run below to add package repository via command step", "Für CI/CD-Job, führen Sie unten aus, um das Paket-Repository über den Befehls-Schritt hinzuzufügen");
m.put("For CI/CD job, run below to add package source via command step", "Für CI/CD-Job, führen Sie unten aus, um die Paketquelle über den Befehls-Schritt hinzuzufügen");
m.put("For CI/CD job, run below to add source via command step", "Für CI/CD-Job, führen Sie unten aus, um die Quelle über den Befehls-Schritt hinzuzufügen");
@@ -1678,6 +1687,7 @@ public class Translation_de extends TranslationResourceBundle {
"Ungültiger Zustand. Bitte stellen Sie sicher, dass Sie OneDev über die in den Systemeinstellungen angegebene Server-URL besuchen");
m.put("Invalid subscription key", "Ungültiger Abonnement-Schlüssel");
m.put("Invalid working period", "Ungültiger Arbeitszeitraum");
+ m.put("Investigate build failure with AI", "Untersuche Build-Fehler mit KI");
m.put("Invitation sent to \"{0}\"", "Einladung gesendet an \"{0}\"");
m.put("Invitation to \"{0}\" deleted", "Einladung zu \"{0}\" gelöscht");
m.put("Invitations", "Einladungen");
@@ -1914,6 +1924,7 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Log Work", "Arbeitsprotokoll");
m.put("Log not available for offline agent", "Protokoll für Offline-Agent nicht verfügbar");
m.put("Log work", "Arbeitsprotokoll");
+ m.put("Login Command", "Anmeldebefehl");
m.put("Login Name", "Anmeldename");
m.put("Login and generate refresh token", "Anmelden und Aktualisierungstoken generieren");
m.put("Login name already used by another account", "Anmeldename wird bereits von einem anderen Konto verwendet");
@@ -1959,6 +1970,8 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "Stellen Sie sicher, dass das Konto Paketberechtigung ${permission} im Projekt hat");
m.put("Make sure the account has package read permission over the project", "Stellen Sie sicher, dass das Konto Leseberechtigung für Pakete im Projekt hat");
m.put("Make sure the user has package write permission over the project", "Stellen Sie sicher, dass der Benutzer Schreibberechtigung für Pakete im Projekt hat");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "Stellen Sie sicher, dass Sie sich mit einem Konto anmelden, das Leseberechtigungen für das Projektpaket hat");
m.put("Malformed %sbase query", "Fehlerhafte %sbase-Abfrage");
m.put("Malformed %squery", "Fehlerhafte %squery");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "Fehlerhafte Build-Spezifikation (Importprojekt: {0}, Importrevision: {1})");
@@ -2010,6 +2023,7 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Merged", "Zusammengeführt");
m.put("Merged pull request \"{0}\" ({1})", "Zusammengeführter Pull-Request \"{0}\" ({1})");
m.put("Merges pull request", "Pull-Request zusammenführen");
+ m.put("Message is too long. Max {0} characters", "Nachricht ist zu lang. Maximal {0} Zeichen");
m.put("Meta", "Meta");
m.put("Meta Info", "Meta-Info");
m.put("Microsoft 365", "Microsoft 365");
@@ -2239,6 +2253,7 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Not run", "Nicht ausgeführt");
m.put("Not specified", "Nicht angegeben");
m.put("Note", "Notiz");
+ m.put("Nothing changed yet", "Noch nichts geändert");
m.put("Nothing to preview", "Nichts zu Vorschau anzeigen");
m.put("Notification", "Benachrichtigung");
m.put("Notifications", "Benachrichtigungen");
@@ -2350,6 +2365,7 @@ public class Translation_de extends TranslationResourceBundle {
"Optional geben Sie <span class='text-info'>kommagetrennte</span> Plattformen zum Erstellen an, beispielsweise <tt>linux/amd64,linux/arm64</tt>. Lassen Sie das Feld leer, um die Plattform des Knotens zu verwenden, der den Job ausführt");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"Optional geben Sie <span class='text-info'>kommagetrennte</span> Plattformen zum Scannen an, beispielsweise <tt>linux/amd64,linux/arm64</tt>. Lassen Sie das Feld leer, um alle Plattformen im OCI-Layout zu scannen");
+ m.put("Optionally specify API key for authentication", "Optional API-Schlüssel für Authentifizierung angeben");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"Optional geben Sie die Dockerfile relativ zu <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>Job-Arbeitsbereich</a> an. Lassen Sie das Feld leer, um die Datei <tt>Dockerfile</tt> unter dem oben angegebenen Build-Pfad zu verwenden");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "Optional geben Sie die JavaScript-Konfiguration an, die von der Renovate-CLI verwendet werden soll");
@@ -2563,8 +2579,8 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Ordered List", "Geordnete Liste");
m.put("Ordered list", "Geordnete Liste");
m.put("Ordinary", "Gewöhnlich");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "Gewöhnlich: Normales Konto<br>Service: Servicekonto hat keine Passwörter und E-Mail-Adressen und generiert keine Benachrichtigungen für seine Aktivitäten<br>AI: AI-Konto (in Arbeit)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "Normal: Normales Konto<br>Dienst: Dienstkonto hat kein Passwort und keine E-Mail-Adressen und generiert keine Benachrichtigungen für seine Aktivitäten<br>KI: KI-Konto, um Fragen zur Codebasis zu beantworten, CI/CD-Spezifikationen zu bearbeiten, Job-Fehler zu untersuchen oder Pull-Requests zu überprüfen");
m.put("Osv License Scanner", "Osv-Lizenzscanner");
m.put("Osv Vulnerability Scanner", "Osv-Schwachstellenscanner");
m.put("Other", "Andere");
@@ -3352,6 +3368,8 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "Einige zugehörige Commits des Code-Kommentars fehlen");
m.put("Some related commits of the pull request are missing", "Einige zugehörige Commits des Pull-Requests fehlen");
m.put("Some required builds not passed", "Einige erforderliche Builds sind nicht bestanden");
+ m.put("Someone changed file mode since you started editing", "Jemand hat den Dateimodus geändert, seit Sie mit der Bearbeitung begonnen haben");
+ m.put("Someone changed file type since you started editing", "Jemand hat den Dateityp geändert, seit Sie mit der Bearbeitung begonnen haben");
m.put("Someone made below change since you started editing", "Jemand hat die folgende Änderung vorgenommen, seit Sie mit der Bearbeitung begonnen haben");
m.put("Sort", "Sortieren");
m.put("Source", "Quelle");
@@ -3382,6 +3400,8 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"Gibt das Attribut an, das den Gruppennamen innerhalb des gefundenen Gruppen-LDAP-Eintrags enthält. Der Wert dieses Attributs wird einer OneDev-Gruppe zugeordnet. Dieses Attribut wird normalerweise auf <i>cn</i> gesetzt");
m.put("Specifies who can access this AI service", "Gibt an, wer auf diesen AI-Dienst zugreifen kann");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "Gibt an, wer auf diesen KI-Dienst zugreifen kann. Der KI-Dienst kann auf folgende Weise zugegriffen werden:");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"Gibt die relative .net TRX-Testergebnisdatei zum <a href='https://docs.onedev.io/concepts#job-workspace'>Job-Arbeitsbereich</a> an, z. B. <tt>TestResults/*.trx</tt>. Verwenden Sie * oder ? für Musterabgleich");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3825,6 +3845,7 @@ public class Translation_de extends TranslationResourceBundle {
m.put("System Date", "Systemdatum");
m.put("System Email Address", "System-E-Mail-Adresse");
m.put("System Maintenance", "Systemwartung");
+ m.put("System Prompt", "Systemaufforderung");
m.put("System Setting", "Systemeinstellung");
m.put("System Settings", "Systemeinstellungen");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4050,6 +4071,7 @@ public class Translation_de extends TranslationResourceBundle {
"Um Duplikate zu vermeiden, wird die hier angezeigte geschätzte/verbleibende Zeit nicht mit der aus \"{0}\" aggregierten Zeit kombiniert");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"Um Duplikate zu vermeiden, wird die hier angezeigte verbrachte Zeit nicht mit der aus \"{0}\" aggregierten Zeit kombiniert");
+ m.put("To use this package, add below to project pom.xml", "Um dieses Paket zu verwenden, fügen Sie Folgendes zur Projekt-pom.xml hinzu");
m.put("Toggle change history", "Änderungsverlauf umschalten");
m.put("Toggle comments", "Kommentare umschalten");
m.put("Toggle commits", "Commits umschalten");
@@ -4305,6 +4327,9 @@ public class Translation_de extends TranslationResourceBundle {
m.put("Verification Code", "Verifizierungscode");
m.put("Verification email sent, please check it", "Verifizierungs-E-Mail gesendet, bitte überprüfen");
m.put("Verify", "Verifizieren");
+ m.put("Via chat interface", "Über die Chat-Oberfläche");
+ m.put("Via mention in issue or pull request comments", "Über Erwähnung in Kommentaren zu Issues oder Pull-Requests");
+ m.put("Via pull request reviewer", "Über Pull-Request-Reviewer");
m.put("View", "Ansehen");
m.put("View source", "Quelle anzeigen");
m.put("View statistics", "Statistiken anzeigen");
@@ -4596,6 +4621,7 @@ public class Translation_de extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "Pull-Request zu Branches \"{0}\" wird verworfen");
m.put("pull request to branches \"{0}\" is merged", "Pull-Request zu Branches \"{0}\" wird zusammengeführt");
m.put("pull request to branches \"{0}\" is opened", "Pull-Request zu Branches \"{0}\" wird geöffnet");
+ m.put("pull request {0}", "Pull-Request {0}");
m.put("pull requests", "Pull-Requests");
m.put("reconciliation (need administrator permission)", "Abgleich (Administratorberechtigung erforderlich)");
m.put("reports", "Berichte");
@@ -4690,19 +4716,15 @@ public class Translation_de extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "{javax.validation.constraints.NotEmpty.message}");
m.put("{javax.validation.constraints.NotNull.message}", "{javax.validation.constraints.NotNull.message}");
m.put("{javax.validation.constraints.Size.message}", "{javax.validation.constraints.Size.message}");
- m.put("AI system prompt has been saved", "AI-Systemaufforderung wurde gespeichert");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "Fügen Sie auch Folgendes zu $HOME/.m2/settings.xml hinzu, wenn Sie das Projekt von der Befehlszeile aus kompilieren möchten");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "Für CI/CD-Jobs ist es bequemer, eine benutzerdefinierte settings.xml zu verwenden, zum Beispiel über den folgenden Code in einem Befehlschritt:");
- m.put("Login Command", "Anmeldebefehl");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "Stellen Sie sicher, dass Sie sich mit einem Konto anmelden, das Leseberechtigungen für das Projektpaket hat");
- m.put("Nothing changed yet", "Noch nichts geändert");
- m.put("Someone changed file mode since you started editing", "Jemand hat den Dateimodus geändert, seit Sie mit der Bearbeitung begonnen haben");
- m.put("Someone changed file type since you started editing", "Jemand hat den Dateityp geändert, seit Sie mit der Bearbeitung begonnen haben");
- m.put("System Prompt", "Systemaufforderung");
- m.put("To use this package, add below to project pom.xml", "Um dieses Paket zu verwenden, fügen Sie Folgendes zur Projekt-pom.xml hinzu");
+ m.put("All members of entitled groups will be able to access this AI service", "Alle Mitglieder der berechtigten Gruppen können auf diesen KI-Dienst zugreifen.");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "Berechtigte Projekte können den KI-Benutzer als Prüfer für Pull-Anfragen hinzufügen. In diesem Szenario führt der KI-Benutzer Aufgaben mit seinen eigenen Berechtigungen aus.");
+ m.put("Entitled projects will be able to access this AI service", "Berechtigte Projekte können auf diesen KI-Dienst zugreifen.");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "Berechtigte Benutzer können über die Chat-Oberfläche mit dem KI-Benutzer interagieren, um Aufgaben wie das Verstehen des Codebestands, das Erstellen von CI/CD-Spezifikationen oder das Untersuchen von CI/CD-Jobfehlern auszuführen. In diesem Modus arbeitet der KI-Benutzer mit denselben Berechtigungen wie der Benutzer, der mit ihm interagiert, und ignoriert die dem KI-Benutzer selbst zugewiesenen Berechtigungen.");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "Berechtigte Benutzer können den KI-Benutzer in Kommentaren zu Problemen oder Pull-Anfragen erwähnen, um Unterstützung anzufordern. In diesem Fall führt der KI-Benutzer Aufgaben mit seinen eigenen Berechtigungen aus.");
+ m.put("Entitled users will be able to access this AI service", "Berechtigte Benutzer können auf diesen KI-Dienst zugreifen.");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_es.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_es.java
index d812da7629..c38d77453f 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_es.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_es.java
@@ -130,6 +130,7 @@ public class Translation_es extends TranslationResourceBundle {
m.put("AI Settings", "Configuraciones de IA");
m.put("AI entitlement settings have been saved", "Se han guardado las configuraciones de derechos de IA");
m.put("AI model settings have been saved", "Se han guardado las configuraciones del modelo de IA");
+ m.put("AI system prompt has been saved", "El aviso del sistema de IA ha sido guardado");
m.put("API Key", "Clave API");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"URL de la API de su instancia de JIRA en la nube, por ejemplo, <tt>https://your-domain.atlassian.net/rest/api/3</tt>");
@@ -279,6 +280,8 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Allow Multiple", "Permitir múltiples");
m.put("Allowed Licenses", "Licencias permitidas");
m.put("Allowed Self Sign-Up Email Domain", "Dominio de correo electrónico permitido para auto registro");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "También agregue lo siguiente a $HOME/.m2/settings.xml si desea compilar el proyecto desde la línea de comandos");
m.put("Always", "Siempre");
m.put("Always Pull Image", "Siempre extraer imagen");
m.put("An issue already linked for {0}. Unlink it first", "Ya hay un problema vinculado para {0}. Desvincúlalo primero");
@@ -423,6 +426,8 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Belonging Groups", "Grupos pertenecientes");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"A continuación se muestran algunos criterios comunes. Escriba en el cuadro de búsqueda arriba para ver la lista completa y las combinaciones disponibles.");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "El contenido a continuación se ha restaurado de un cambio no guardado. <a class=\"clear-unsaved-change\">Borrar</a> para descartar");
m.put("Below content is restored from an unsaved change. Clear to discard", "El contenido a continuación se restauró de un cambio no guardado. Borrar para descartar");
m.put("Below information will also be sent", "La información a continuación también será enviada");
m.put("Binary file.", "Archivo binario.");
@@ -598,9 +603,13 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Changes since this comment", "Cambios desde este comentario");
m.put("Channel Notification", "Notificación de Canal");
m.put("Chart Metadata", "Metadatos del Gráfico");
+ m.put("Chat Preserve Days", "Días de preservación del chat");
m.put("Chat deleted", "Chat eliminado");
+ m.put("Chat preserve days setting has been saved", "La configuración de días de preservación del chat ha sido guardada");
m.put("Chat with", "Chat con");
m.put("Chat with AI", "Chat con IA");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "Los chats más antiguos que el número especificado de días se eliminarán automáticamente durante el mantenimiento diario.");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"Consulte <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">la guía de GitHub</a> sobre cómo generar y usar claves GPG para firmar sus commits");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1202,7 +1211,7 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Enter your details to create your account", "Ingrese sus datos para crear su cuenta");
m.put("Enter your details to login to your account", "Ingrese sus datos para iniciar sesión en su cuenta");
m.put("Enter your user name or email to reset password", "Ingrese su nombre de usuario o correo electrónico para restablecer la contraseña");
- m.put("Entitle to All Users", "Conceder a Todos los Usuarios");
+ m.put("Entitle to All Users and Projects", "Conceder a Todos los Usuarios y Proyectos");
m.put("Entitled Groups", "Grupos Autorizados");
m.put("Entitled Projects", "Proyectos Autorizados");
m.put("Entitled Users", "Usuarios Autorizados");
@@ -1321,7 +1330,6 @@ public class Translation_es extends TranslationResourceBundle {
m.put("File missing or obsolete", "Archivo faltante u obsoleto");
m.put("File name", "Nombre del archivo");
m.put("File name patterns such as *.java, *.c", "Patrones de nombre de archivo como *.java, *.c");
- m.put("File path to get text content", "Ruta del archivo para obtener el contenido de texto");
m.put("Files", "Archivos");
m.put("Files to Be Analyzed", "Archivos a Analizar");
m.put("Filter", "Filtro");
@@ -1364,13 +1372,14 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Fixing...", "Corrigiendo...");
m.put("Float", "Flotante");
m.put("Flush", "Vaciar");
- m.put("Folder path to list all files and subfolders", "Ruta de la carpeta para listar todos los archivos y subcarpetas");
m.put("Follow below instructions to publish packages into this project", "Siga las instrucciones a continuación para publicar paquetes en este proyecto");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"Siga los pasos a continuación para instalar el agente en una máquina remota (compatible con Linux/Windows/Mac OS X/FreeBSD):");
m.put("For CI/CD job, add this gem to Gemfile like below", "Para trabajos de CI/CD, agregue esta gema al Gemfile como se muestra a continuación");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"Para trabajos de CI/CD, agregue este paquete a requirements.txt y ejecute lo siguiente para instalar el paquete mediante el paso de comando");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "Para el trabajo de CI/CD, es más conveniente usar un settings.xml personalizado, por ejemplo, a través del siguiente código en un paso de comando:");
m.put("For CI/CD job, run below to add package repository via command step", "Para trabajos de CI/CD, ejecute lo siguiente para agregar el repositorio de paquetes mediante el paso de comando");
m.put("For CI/CD job, run below to add package source via command step", "Para trabajos de CI/CD, ejecute lo siguiente para agregar la fuente del paquete mediante el paso de comando");
m.put("For CI/CD job, run below to add source via command step", "Para trabajos de CI/CD, ejecute lo siguiente para agregar la fuente mediante el paso de comando");
@@ -1678,6 +1687,7 @@ public class Translation_es extends TranslationResourceBundle {
"Estado inválido. Por favor asegúrese de estar visitando OneDev usando la URL del servidor especificada en la configuración del sistema");
m.put("Invalid subscription key", "Clave de suscripción inválida");
m.put("Invalid working period", "Período de trabajo inválido");
+ m.put("Investigate build failure with AI", "Investigar fallo de compilación con IA");
m.put("Invitation sent to \"{0}\"", "Invitación enviada a \"{0}\"");
m.put("Invitation to \"{0}\" deleted", "Invitación a \"{0}\" eliminada");
m.put("Invitations", "Invitaciones");
@@ -1914,6 +1924,7 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Log Work", "Registrar Trabajo");
m.put("Log not available for offline agent", "El registro no está disponible para el agente sin conexión");
m.put("Log work", "Registrar trabajo");
+ m.put("Login Command", "Comando de inicio de sesión");
m.put("Login Name", "Nombre de Inicio de Sesión");
m.put("Login and generate refresh token", "Iniciar sesión y generar token de actualización");
m.put("Login name already used by another account", "El nombre de inicio de sesión ya está en uso por otra cuenta");
@@ -1959,6 +1970,8 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "Asegúrese de que la cuenta tenga permiso de paquete ${permission} sobre el proyecto");
m.put("Make sure the account has package read permission over the project", "Asegúrese de que la cuenta tenga permiso de lectura de paquetes sobre el proyecto");
m.put("Make sure the user has package write permission over the project", "Asegúrese de que el usuario tenga permiso de escritura de paquetes sobre el proyecto");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "Asegúrese de iniciar sesión con una cuenta que tenga permiso de lectura de paquetes para el proyecto");
m.put("Malformed %sbase query", "Consulta %sbase malformada");
m.put("Malformed %squery", "Consulta %s malformada");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "Especificación de construcción malformada (importar proyecto: {0}, importar revisión: {1})");
@@ -2010,6 +2023,7 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Merged", "Fusionado");
m.put("Merged pull request \"{0}\" ({1})", "Solicitud de extracción fusionada \"{0}\" ({1})");
m.put("Merges pull request", "Fusiona solicitud de extracción");
+ m.put("Message is too long. Max {0} characters", "El mensaje es demasiado largo. Máximo {0} caracteres");
m.put("Meta", "Meta");
m.put("Meta Info", "Información meta");
m.put("Microsoft 365", "Microsoft 365");
@@ -2239,6 +2253,7 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Not run", "No ejecutado");
m.put("Not specified", "No especificado");
m.put("Note", "Nota");
+ m.put("Nothing changed yet", "Nada ha cambiado aún");
m.put("Nothing to preview", "Nada para previsualizar");
m.put("Notification", "Notificación");
m.put("Notifications", "Notificaciones");
@@ -2350,6 +2365,7 @@ public class Translation_es extends TranslationResourceBundle {
"Opcionalmente especifique <span class='text-info'>plataformas separadas por comas</span> para construir, por ejemplo <tt>linux/amd64,linux/arm64</tt>. Déjelo vacío para construir en la plataforma del nodo que ejecuta el trabajo.");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"Opcionalmente especifique <span class='text-info'>plataformas separadas por comas</span> para escanear, por ejemplo <tt>linux/amd64,linux/arm64</tt>. Déjelo vacío para escanear todas las plataformas en el diseño OCI.");
+ m.put("Optionally specify API key for authentication", "Opcionalmente, especifique la clave API para autenticación");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"Opcionalmente especifique el Dockerfile relativo al <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>espacio de trabajo del trabajo</a>. Déjelo vacío para usar el archivo <tt>Dockerfile</tt> bajo la ruta de construcción especificada anteriormente.");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "Opcionalmente especifique la configuración de JavaScript para usar con Renovate CLI.");
@@ -2563,8 +2579,8 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Ordered List", "Lista Ordenada");
m.put("Ordered list", "Lista ordenada");
m.put("Ordinary", "Ordinario");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "Ordinario: Cuenta normal<br>Servicio: La cuenta de servicio no tiene contraseña ni direcciones de correo electrónico, y no generará notificaciones por sus actividades<br>IA: Cuenta de IA (en progreso)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "Ordinario: Cuenta normal<br>Servicio: La cuenta de servicio no tiene contraseña ni direcciones de correo electrónico, y no generará notificaciones por sus actividades<br>IA: Cuenta de IA para responder preguntas sobre la base de código, editar especificaciones de CI/CD, investigar fallos de trabajo o revisar solicitudes de extracción");
m.put("Osv License Scanner", "Escáner de Licencias Osv");
m.put("Osv Vulnerability Scanner", "Escáner de Vulnerabilidades Osv");
m.put("Other", "Otro");
@@ -3352,6 +3368,8 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "Faltan algunos commits relacionados con el comentario de código");
m.put("Some related commits of the pull request are missing", "Faltan algunos commits relacionados con la solicitud de extracción");
m.put("Some required builds not passed", "Algunas compilaciones requeridas no pasaron");
+ m.put("Someone changed file mode since you started editing", "Alguien cambió el modo del archivo desde que comenzó a editar");
+ m.put("Someone changed file type since you started editing", "Alguien cambió el tipo de archivo desde que comenzó a editar");
m.put("Someone made below change since you started editing", "Alguien hizo el siguiente cambio desde que comenzaste a editar");
m.put("Sort", "Ordenar");
m.put("Source", "Fuente");
@@ -3382,6 +3400,8 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"Especifica el atributo que contiene el nombre del grupo dentro de la entrada LDAP del grupo encontrado. El valor de este atributo se mapeará a un grupo de OneDev. Este atributo normalmente se establece en <i>cn</i>");
m.put("Specifies who can access this AI service", "Especifica quién puede acceder a este servicio de IA");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "Especifica quién puede acceder a este servicio de IA. El servicio de IA se puede acceder de las siguientes maneras:");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"Especifica el archivo de resultados de prueba .net TRX relativo a <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, por ejemplo <tt>TestResults/*.trx</tt>. Usa * o ? para coincidencia de patrones");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3825,6 +3845,7 @@ public class Translation_es extends TranslationResourceBundle {
m.put("System Date", "Fecha del Sistema");
m.put("System Email Address", "Dirección de Correo Electrónico del Sistema");
m.put("System Maintenance", "Mantenimiento del Sistema");
+ m.put("System Prompt", "Aviso del sistema");
m.put("System Setting", "Configuración del Sistema");
m.put("System Settings", "Configuraciones del Sistema");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4050,6 +4071,7 @@ public class Translation_es extends TranslationResourceBundle {
"Para evitar duplicaciones, el tiempo estimado/restante que se muestra aquí no incluye aquellos agregados desde \"{0}\"");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"Para evitar duplicaciones, el tiempo gastado que se muestra aquí no incluye aquellos agregados desde \"{0}\"");
+ m.put("To use this package, add below to project pom.xml", "Para usar este paquete, agregue lo siguiente al pom.xml del proyecto");
m.put("Toggle change history", "Alternar historial de cambios");
m.put("Toggle comments", "Alternar comentarios");
m.put("Toggle commits", "Alternar commits");
@@ -4305,6 +4327,9 @@ public class Translation_es extends TranslationResourceBundle {
m.put("Verification Code", "Código de Verificación");
m.put("Verification email sent, please check it", "Correo de verificación enviado, por favor revísalo");
m.put("Verify", "Verificar");
+ m.put("Via chat interface", "A través de la interfaz de chat");
+ m.put("Via mention in issue or pull request comments", "A través de menciones en comentarios de problemas o solicitudes de extracción");
+ m.put("Via pull request reviewer", "A través de revisor de solicitudes de extracción");
m.put("View", "Ver");
m.put("View source", "Ver fuente");
m.put("View statistics", "Ver estadísticas");
@@ -4596,6 +4621,7 @@ public class Translation_es extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "solicitud de extracción a las ramas \"{0}\" es descartada");
m.put("pull request to branches \"{0}\" is merged", "solicitud de extracción a las ramas \"{0}\" es fusionada");
m.put("pull request to branches \"{0}\" is opened", "solicitud de extracción a las ramas \"{0}\" es abierta");
+ m.put("pull request {0}", "solicitud de extracción {0}");
m.put("pull requests", "solicitudes de extracción");
m.put("reconciliation (need administrator permission)", "reconciliación (requiere permiso de administrador)");
m.put("reports", "informes");
@@ -4690,19 +4716,15 @@ public class Translation_es extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "{javax.validation.constraints.NotEmpty.message}");
m.put("{javax.validation.constraints.NotNull.message}", "{javax.validation.constraints.NotNull.message}");
m.put("{javax.validation.constraints.Size.message}", "{javax.validation.constraints.Size.message}");
- m.put("AI system prompt has been saved", "El aviso del sistema de IA ha sido guardado");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "También agregue lo siguiente a $HOME/.m2/settings.xml si desea compilar el proyecto desde la línea de comandos");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "Para el trabajo de CI/CD, es más conveniente usar un settings.xml personalizado, por ejemplo, a través del siguiente código en un paso de comando:");
- m.put("Login Command", "Comando de inicio de sesión");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "Asegúrese de iniciar sesión con una cuenta que tenga permiso de lectura de paquetes para el proyecto");
- m.put("Nothing changed yet", "Nada ha cambiado aún");
- m.put("Someone changed file mode since you started editing", "Alguien cambió el modo del archivo desde que comenzó a editar");
- m.put("Someone changed file type since you started editing", "Alguien cambió el tipo de archivo desde que comenzó a editar");
- m.put("System Prompt", "Aviso del sistema");
- m.put("To use this package, add below to project pom.xml", "Para usar este paquete, agregue lo siguiente al pom.xml del proyecto");
+ m.put("All members of entitled groups will be able to access this AI service", "Todos los miembros de los grupos autorizados podrán acceder a este servicio de IA");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "Los proyectos autorizados pueden agregar al usuario de IA como revisor de solicitudes de extracción. En este escenario, el usuario de IA ejecuta tareas usando sus propios permisos.");
+ m.put("Entitled projects will be able to access this AI service", "Los proyectos autorizados podrán acceder a este servicio de IA");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "Los usuarios autorizados pueden interactuar con el usuario de IA a través de la interfaz de chat para realizar tareas como entender la base de código, crear especificaciones de CI/CD o investigar fallos en trabajos de CI/CD. En este modo, el usuario de IA opera con los mismos permisos que el usuario que interactúa con él, ignorando los permisos asignados al propio usuario de IA.");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "Los usuarios autorizados pueden mencionar al usuario de IA en comentarios de problemas o solicitudes de extracción para solicitar asistencia. En este caso, el usuario de IA ejecuta tareas usando sus propios permisos.");
+ m.put("Entitled users will be able to access this AI service", "Los usuarios autorizados podrán acceder a este servicio de IA");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_fr.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_fr.java
index 6d9373b136..a2f60d46fa 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_fr.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_fr.java
@@ -130,6 +130,7 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("AI Settings", "Paramètres de l'IA");
m.put("AI entitlement settings have been saved", "Les paramètres d'autorisation AI ont été enregistrés");
m.put("AI model settings have been saved", "Les paramètres du modèle AI ont été enregistrés");
+ m.put("AI system prompt has been saved", "Le prompt du système AI a été enregistré");
m.put("API Key", "Clé API");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"URL API de votre instance JIRA cloud, par exemple, <tt>https://your-domain.atlassian.net/rest/api/3</tt>");
@@ -279,6 +280,8 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Allow Multiple", "Autoriser multiple");
m.put("Allowed Licenses", "Licences autorisées");
m.put("Allowed Self Sign-Up Email Domain", "Domaine d'email autorisé pour l'inscription automatique");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "Ajoutez également ci-dessous à $HOME/.m2/settings.xml si vous souhaitez compiler le projet depuis la ligne de commande");
m.put("Always", "Toujours");
m.put("Always Pull Image", "Toujours tirer l'image");
m.put("An issue already linked for {0}. Unlink it first", "Un problème est déjà lié pour {0}. Dissociez-le d'abord");
@@ -423,6 +426,8 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Belonging Groups", "Groupes d'appartenance");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"Ci-dessous quelques critères courants. Tapez dans la boîte de recherche ci-dessus pour voir la liste complète et les combinaisons disponibles.");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "Le contenu ci-dessous est restauré à partir d'une modification non enregistrée. <a class=\"clear-unsaved-change\">Effacer</a> pour annuler");
m.put("Below content is restored from an unsaved change. Clear to discard", "Le contenu ci-dessous est restauré à partir d'une modification non enregistrée. Effacer pour abandonner");
m.put("Below information will also be sent", "Les informations ci-dessous seront également envoyées");
m.put("Binary file.", "Fichier binaire.");
@@ -598,9 +603,13 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Changes since this comment", "Changements depuis ce commentaire");
m.put("Channel Notification", "Notification de canal");
m.put("Chart Metadata", "Métadonnées du graphique");
+ m.put("Chat Preserve Days", "Jours de conservation du chat");
m.put("Chat deleted", "Chat supprimé");
+ m.put("Chat preserve days setting has been saved", "Le paramètre des jours de conservation du chat a été enregistré");
m.put("Chat with", "Chat avec");
m.put("Chat with AI", "Chat avec AI");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "Les chats plus anciens que le nombre de jours spécifié seront automatiquement supprimés lors de la maintenance quotidienne.");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"Consultez <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">le guide de GitHub</a> sur la façon de générer et d'utiliser des clés GPG pour signer vos commits");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1202,7 +1211,7 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Enter your details to create your account", "Entrez vos informations pour créer votre compte");
m.put("Enter your details to login to your account", "Entrez vos informations pour vous connecter à votre compte");
m.put("Enter your user name or email to reset password", "Entrez votre nom d'utilisateur ou e-mail pour réinitialiser le mot de passe");
- m.put("Entitle to All Users", "Attribuer à tous les utilisateurs");
+ m.put("Entitle to All Users and Projects", "Attribuer à tous les utilisateurs et projets");
m.put("Entitled Groups", "Groupes autorisés");
m.put("Entitled Projects", "Projets autorisés");
m.put("Entitled Users", "Utilisateurs autorisés");
@@ -1321,7 +1330,6 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("File missing or obsolete", "Fichier manquant ou obsolète");
m.put("File name", "Nom du fichier");
m.put("File name patterns such as *.java, *.c", "Modèles de noms de fichiers tels que *.java, *.c");
- m.put("File path to get text content", "Chemin du fichier pour obtenir le contenu texte");
m.put("Files", "Fichiers");
m.put("Files to Be Analyzed", "Fichiers à analyser");
m.put("Filter", "Filtre");
@@ -1364,13 +1372,14 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Fixing...", "Correction...");
m.put("Float", "Flottant");
m.put("Flush", "Vider");
- m.put("Folder path to list all files and subfolders", "Chemin du dossier pour lister tous les fichiers et sous-dossiers");
m.put("Follow below instructions to publish packages into this project", "Suivez les instructions ci-dessous pour publier des packages dans ce projet");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"Suivez les étapes ci-dessous pour installer l'agent sur une machine distante (compatible Linux/Windows/Mac OS X/FreeBSD) :");
m.put("For CI/CD job, add this gem to Gemfile like below", "Pour un travail CI/CD, ajoutez ce gem au Gemfile comme ci-dessous");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"Pour un travail CI/CD, ajoutez ce package à requirements.txt et exécutez la commande ci-dessous pour installer le package via une étape de commande");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "Pour un travail CI/CD, il est plus pratique d'utiliser un settings.xml personnalisé, par exemple via le code ci-dessous dans une étape de commande :");
m.put("For CI/CD job, run below to add package repository via command step", "Pour un travail CI/CD, exécutez la commande ci-dessous pour ajouter le dépôt de packages via une étape de commande");
m.put("For CI/CD job, run below to add package source via command step", "Pour un travail CI/CD, exécutez la commande ci-dessous pour ajouter la source du package via une étape de commande");
m.put("For CI/CD job, run below to add source via command step", "Pour un travail CI/CD, exécutez la commande ci-dessous pour ajouter la source via une étape de commande");
@@ -1678,6 +1687,7 @@ public class Translation_fr extends TranslationResourceBundle {
"État invalide. Veuillez vous assurer que vous visitez OneDev en utilisant l'URL du serveur spécifiée dans les paramètres système");
m.put("Invalid subscription key", "Clé d'abonnement invalide");
m.put("Invalid working period", "Période de travail invalide");
+ m.put("Investigate build failure with AI", "Enquêter sur l'échec de la construction avec l'IA");
m.put("Invitation sent to \"{0}\"", "Invitation envoyée à \"{0}\"");
m.put("Invitation to \"{0}\" deleted", "Invitation à \"{0}\" supprimée");
m.put("Invitations", "Invitations");
@@ -1914,6 +1924,7 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Log Work", "Journal de Travail");
m.put("Log not available for offline agent", "Journal non disponible pour l'agent hors ligne");
m.put("Log work", "Journal de travail");
+ m.put("Login Command", "Commande de connexion");
m.put("Login Name", "Nom de Connexion");
m.put("Login and generate refresh token", "Connexion et génération de jeton de rafraîchissement");
m.put("Login name already used by another account", "Nom de connexion déjà utilisé par un autre compte");
@@ -1959,6 +1970,8 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "Assurez-vous que le compte a l'autorisation de package ${permission} sur le projet");
m.put("Make sure the account has package read permission over the project", "Assurez-vous que le compte a l'autorisation de lecture de package sur le projet");
m.put("Make sure the user has package write permission over the project", "Assurez-vous que l'utilisateur a l'autorisation d'écriture de package sur le projet");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "Assurez-vous de vous connecter avec un compte qui a la permission de lecture du package pour le projet");
m.put("Malformed %sbase query", "Requête %sbase malformée");
m.put("Malformed %squery", "Requête %s malformée");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "Spécification de build malformée (importer projet : {0}, importer révision : {1})");
@@ -2010,6 +2023,7 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Merged", "Fusionné");
m.put("Merged pull request \"{0}\" ({1})", "Requête de fusion \"{0}\" fusionnée ({1})");
m.put("Merges pull request", "Fusionne la requête de tirage");
+ m.put("Message is too long. Max {0} characters", "Le message est trop long. Max {0} caractères");
m.put("Meta", "Méta");
m.put("Meta Info", "Infos méta");
m.put("Microsoft 365", "Microsoft 365");
@@ -2239,6 +2253,7 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Not run", "Non exécuté");
m.put("Not specified", "Non spécifié");
m.put("Note", "Note");
+ m.put("Nothing changed yet", "Rien n'a encore changé");
m.put("Nothing to preview", "Rien à prévisualiser");
m.put("Notification", "Notification");
m.put("Notifications", "Notifications");
@@ -2350,6 +2365,7 @@ public class Translation_fr extends TranslationResourceBundle {
"Spécifiez éventuellement des <span class='text-info'>plateformes séparées par des virgules</span> à construire, par exemple <tt>linux/amd64,linux/arm64</tt>. Laissez vide pour construire pour la plateforme du nœud exécutant la tâche.");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"Spécifiez éventuellement des <span class='text-info'>plateformes séparées par des virgules</span> à analyser, par exemple <tt>linux/amd64,linux/arm64</tt>. Laissez vide pour analyser toutes les plateformes dans la disposition OCI.");
+ m.put("Optionally specify API key for authentication", "Spécifiez éventuellement la clé API pour l'authentification");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"Spécifiez éventuellement le Dockerfile relatif à <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>l'espace de travail de la tâche</a>. Laissez vide pour utiliser le fichier <tt>Dockerfile</tt> sous le chemin de construction spécifié ci-dessus.");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "Spécifiez éventuellement une configuration JavaScript à utiliser par Renovate CLI.");
@@ -2563,8 +2579,8 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Ordered List", "Liste ordonnée");
m.put("Ordered list", "Liste ordonnée");
m.put("Ordinary", "Ordinaire");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "Ordinaire : Compte normal<br>Service : Le compte de service n'a pas de mot de passe ni d'adresses e-mail, et ne générera pas de notifications pour ses activités<br>AI : Compte AI (en cours de développement)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "Ordinaire : Compte normal<br>Service : Le compte de service n'a pas de mot de passe ni d'adresses e-mail, et ne générera pas de notifications pour ses activités<br>IA : Compte IA pour répondre aux questions sur la base de code, éditer la spécification CI/CD, enquêter sur l'échec d'un travail ou examiner une demande de tirage");
m.put("Osv License Scanner", "Scanner de licence Osv");
m.put("Osv Vulnerability Scanner", "Scanner de vulnérabilité Osv");
m.put("Other", "Autre");
@@ -3352,6 +3368,8 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "Certains commits liés au commentaire de code sont manquants");
m.put("Some related commits of the pull request are missing", "Certains commits liés à la demande de tirage sont manquants");
m.put("Some required builds not passed", "Certains builds requis n'ont pas réussi");
+ m.put("Someone changed file mode since you started editing", "Quelqu'un a changé le mode du fichier depuis que vous avez commencé à éditer");
+ m.put("Someone changed file type since you started editing", "Quelqu'un a changé le type de fichier depuis que vous avez commencé à éditer");
m.put("Someone made below change since you started editing", "Quelqu'un a effectué le changement ci-dessous depuis que vous avez commencé à éditer");
m.put("Sort", "Trier");
m.put("Source", "Source");
@@ -3382,6 +3400,8 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"Spécifie l'attribut contenant le nom du groupe dans l'entrée LDAP du groupe trouvé. La valeur de cet attribut sera mappée à un groupe OneDev. Cet attribut est normalement défini sur <i>cn</i>");
m.put("Specifies who can access this AI service", "Spécifie qui peut accéder à ce service AI");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "Spécifie qui peut accéder à ce service d'IA. Le service d'IA peut être accessible selon les approches suivantes :");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"Spécifie le fichier de résultats de test .net TRX relatif à <a href='https://docs.onedev.io/concepts#job-workspace'>l'espace de travail du job</a>, par exemple <tt>TestResults/*.trx</tt>. Utilisez * ou ? pour la correspondance de modèle");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3825,6 +3845,7 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("System Date", "Date système");
m.put("System Email Address", "Adresse email système");
m.put("System Maintenance", "Maintenance système");
+ m.put("System Prompt", "Prompt du système");
m.put("System Setting", "Paramètre système");
m.put("System Settings", "Paramètres système");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4050,6 +4071,7 @@ public class Translation_fr extends TranslationResourceBundle {
"Pour éviter les doublons, le temps estimé/restant affiché ici n'inclut pas ceux agrégés depuis \"{0}\"");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"Pour éviter les doublons, le temps passé affiché ici n'inclut pas ceux agrégés depuis \"{0}\"");
+ m.put("To use this package, add below to project pom.xml", "Pour utiliser ce package, ajoutez ci-dessous au pom.xml du projet");
m.put("Toggle change history", "Basculer l'historique des modifications");
m.put("Toggle comments", "Basculer les commentaires");
m.put("Toggle commits", "Basculer les commits");
@@ -4305,6 +4327,9 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("Verification Code", "Code de vérification");
m.put("Verification email sent, please check it", "Email de vérification envoyé, veuillez le vérifier");
m.put("Verify", "Vérifier");
+ m.put("Via chat interface", "Via l'interface de chat");
+ m.put("Via mention in issue or pull request comments", "Via une mention dans les commentaires des problèmes ou des demandes de tirage");
+ m.put("Via pull request reviewer", "Via le réviseur de demande de tirage");
m.put("View", "Voir");
m.put("View source", "Voir la source");
m.put("View statistics", "Voir les statistiques");
@@ -4596,6 +4621,7 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "pull request vers les branches \"{0}\" est rejetée");
m.put("pull request to branches \"{0}\" is merged", "pull request vers les branches \"{0}\" est fusionnée");
m.put("pull request to branches \"{0}\" is opened", "pull request vers les branches \"{0}\" est ouverte");
+ m.put("pull request {0}", "demande de tirage {0}");
m.put("pull requests", "pull requests");
m.put("reconciliation (need administrator permission)", "réconciliation (nécessite une autorisation administrateur)");
m.put("reports", "rapports");
@@ -4690,19 +4716,15 @@ public class Translation_fr extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "{javax.validation.constraints.NotEmpty.message}");
m.put("{javax.validation.constraints.NotNull.message}", "{javax.validation.constraints.NotNull.message}");
m.put("{javax.validation.constraints.Size.message}", "{javax.validation.constraints.Size.message}");
- m.put("AI system prompt has been saved", "Le prompt du système AI a été enregistré");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "Ajoutez également ci-dessous à $HOME/.m2/settings.xml si vous souhaitez compiler le projet depuis la ligne de commande");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "Pour un travail CI/CD, il est plus pratique d'utiliser un settings.xml personnalisé, par exemple via le code ci-dessous dans une étape de commande :");
- m.put("Login Command", "Commande de connexion");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "Assurez-vous de vous connecter avec un compte qui a la permission de lecture du package pour le projet");
- m.put("Nothing changed yet", "Rien n'a encore changé");
- m.put("Someone changed file mode since you started editing", "Quelqu'un a changé le mode du fichier depuis que vous avez commencé à éditer");
- m.put("Someone changed file type since you started editing", "Quelqu'un a changé le type de fichier depuis que vous avez commencé à éditer");
- m.put("System Prompt", "Prompt du système");
- m.put("To use this package, add below to project pom.xml", "Pour utiliser ce package, ajoutez ci-dessous au pom.xml du projet");
+ m.put("All members of entitled groups will be able to access this AI service", "Tous les membres des groupes autorisés pourront accéder à ce service d'IA");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "Les projets autorisés peuvent ajouter l'utilisateur IA en tant que réviseur de demande de tirage. Dans ce scénario, l'utilisateur IA exécute des tâches en utilisant ses propres autorisations.");
+ m.put("Entitled projects will be able to access this AI service", "Les projets autorisés pourront accéder à ce service d'IA");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "Les utilisateurs autorisés peuvent interagir avec l'utilisateur IA via l'interface de chat pour effectuer des tâches telles que comprendre la base de code, rédiger des spécifications CI/CD ou enquêter sur les échecs de tâches CI/CD. Dans ce mode, l'utilisateur IA opère avec les mêmes autorisations que l'utilisateur interagissant avec lui, en ignorant les autorisations attribuées à l'utilisateur IA lui-même.");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "Les utilisateurs autorisés peuvent mentionner l'utilisateur IA dans les commentaires des problèmes ou des demandes de tirage pour demander de l'aide. Dans ce cas, l'utilisateur IA exécute des tâches en utilisant ses propres autorisations.");
+ m.put("Entitled users will be able to access this AI service", "Les utilisateurs autorisés pourront accéder à ce service d'IA");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_it.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_it.java
index e510edb698..c79040c24e 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_it.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_it.java
@@ -130,6 +130,7 @@ public class Translation_it extends TranslationResourceBundle {
m.put("AI Settings", "Impostazioni AI");
m.put("AI entitlement settings have been saved", "Le impostazioni di autorizzazione AI sono state salvate");
m.put("AI model settings have been saved", "Le impostazioni del modello AI sono state salvate");
+ m.put("AI system prompt has been saved", "Il prompt del sistema AI è stato salvato");
m.put("API Key", "Chiave API");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"URL API della tua istanza cloud JIRA, ad esempio, <tt>https://your-domain.atlassian.net/rest/api/3</tt>");
@@ -279,6 +280,8 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Allow Multiple", "Consenti multipli");
m.put("Allowed Licenses", "Licenze consentite");
m.put("Allowed Self Sign-Up Email Domain", "Dominio email per auto-iscrizione consentito");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "Aggiungi anche quanto segue a $HOME/.m2/settings.xml se vuoi compilare il progetto dalla riga di comando");
m.put("Always", "Sempre");
m.put("Always Pull Image", "Scarica sempre immagine");
m.put("An issue already linked for {0}. Unlink it first", "Un problema è già collegato per {0}. Scollegalo prima");
@@ -423,6 +426,8 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Belonging Groups", "Gruppi di appartenenza");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"Di seguito sono riportati alcuni criteri comuni. Digita nella casella di ricerca sopra per visualizzare l'elenco completo e le combinazioni disponibili.");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "Il contenuto sottostante è stato ripristinato da una modifica non salvata. <a class=\"clear-unsaved-change\">Cancella</a> per scartare");
m.put("Below content is restored from an unsaved change. Clear to discard", "Il contenuto sottostante è stato ripristinato da una modifica non salvata. Cancella per scartare");
m.put("Below information will also be sent", "Le informazioni sottostanti saranno anche inviate");
m.put("Binary file.", "File binario.");
@@ -598,9 +603,13 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Changes since this comment", "Modifiche da questo commento");
m.put("Channel Notification", "Notifica del canale");
m.put("Chart Metadata", "Metadati del grafico");
+ m.put("Chat Preserve Days", "Giorni di conservazione chat");
m.put("Chat deleted", "Chat eliminata");
+ m.put("Chat preserve days setting has been saved", "Impostazione dei giorni di conservazione chat è stata salvata");
m.put("Chat with", "Chatta con");
m.put("Chat with AI", "Chatta con AI");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "Le chat più vecchie del numero specificato di giorni verranno automaticamente eliminate durante la manutenzione giornaliera.");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"Consulta <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">la guida di GitHub</a> su come generare e utilizzare le chiavi GPG per firmare i tuoi commit");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1202,7 +1211,7 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Enter your details to create your account", "Inserisci i tuoi dati per creare il tuo account");
m.put("Enter your details to login to your account", "Inserisci i tuoi dati per accedere al tuo account");
m.put("Enter your user name or email to reset password", "Inserisci il tuo nome utente o email per reimpostare la password");
- m.put("Entitle to All Users", "Concedi a Tutti gli Utenti");
+ m.put("Entitle to All Users and Projects", "Concedi a Tutti gli Utenti e Progetti");
m.put("Entitled Groups", "Gruppi Autorizzati");
m.put("Entitled Projects", "Progetti Autorizzati");
m.put("Entitled Users", "Utenti Autorizzati");
@@ -1321,7 +1330,6 @@ public class Translation_it extends TranslationResourceBundle {
m.put("File missing or obsolete", "File mancante o obsoleto");
m.put("File name", "nome file");
m.put("File name patterns such as *.java, *.c", "modelli nome file come *.java, *.c");
- m.put("File path to get text content", "Percorso del file per ottenere il contenuto del testo");
m.put("Files", "File");
m.put("Files to Be Analyzed", "File da Analizzare");
m.put("Filter", "Filtro");
@@ -1364,13 +1372,14 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Fixing...", "Correzione...");
m.put("Float", "Float");
m.put("Flush", "Svuota");
- m.put("Folder path to list all files and subfolders", "Percorso della cartella per elencare tutti i file e le sottocartelle");
m.put("Follow below instructions to publish packages into this project", "Segui le istruzioni seguenti per pubblicare pacchetti in questo progetto");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"Segui i passaggi seguenti per installare l'agente su una macchina remota (supporta Linux/Windows/Mac OS X/FreeBSD):");
m.put("For CI/CD job, add this gem to Gemfile like below", "Per il lavoro CI/CD, aggiungi questa gemma a Gemfile come segue");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"Per il lavoro CI/CD, aggiungi questo pacchetto a requirements.txt ed esegui il comando seguente per installare il pacchetto tramite il passaggio del comando");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "Per il lavoro CI/CD, è più conveniente utilizzare un settings.xml personalizzato, ad esempio tramite il codice seguente in un passaggio di comando:");
m.put("For CI/CD job, run below to add package repository via command step", "Per il lavoro CI/CD, esegui il comando seguente per aggiungere il repository del pacchetto tramite il passaggio del comando");
m.put("For CI/CD job, run below to add package source via command step", "Per il lavoro CI/CD, esegui il comando seguente per aggiungere la sorgente del pacchetto tramite il passaggio del comando");
m.put("For CI/CD job, run below to add source via command step", "Per il lavoro CI/CD, esegui il comando seguente per aggiungere la sorgente tramite il passaggio del comando");
@@ -1678,6 +1687,7 @@ public class Translation_it extends TranslationResourceBundle {
"Stato non valido. Assicurati di visitare OneDev utilizzando l'url del server specificato nelle impostazioni di sistema");
m.put("Invalid subscription key", "Chiave di abbonamento non valida");
m.put("Invalid working period", "Periodo di lavoro non valido");
+ m.put("Investigate build failure with AI", "Indagare sul fallimento della build con l'AI");
m.put("Invitation sent to \"{0}\"", "Invito inviato a \"{0}\"");
m.put("Invitation to \"{0}\" deleted", "Invito a \"{0}\" eliminato");
m.put("Invitations", "Inviti");
@@ -1914,6 +1924,7 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Log Work", "Registra Lavoro");
m.put("Log not available for offline agent", "Registro non disponibile per l'agente offline");
m.put("Log work", "Registra lavoro");
+ m.put("Login Command", "Comando di accesso");
m.put("Login Name", "Nome di Accesso");
m.put("Login and generate refresh token", "Accedi e genera token di aggiornamento");
m.put("Login name already used by another account", "Nome di accesso già utilizzato da un altro account");
@@ -1959,6 +1970,8 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "Assicurati che l'account abbia il permesso di ${permission} del pacchetto sul progetto");
m.put("Make sure the account has package read permission over the project", "Assicurati che l'account abbia il permesso di lettura del pacchetto sul progetto");
m.put("Make sure the user has package write permission over the project", "Assicurati che l'utente abbia il permesso di scrittura del pacchetto sul progetto");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "Assicurati di accedere con un account che abbia il permesso di lettura del pacchetto per il progetto");
m.put("Malformed %sbase query", "Query %sbase malformata");
m.put("Malformed %squery", "Query %s malformata");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "Specifica di build malformata (importa progetto: {0}, importa revisione: {1})");
@@ -2010,6 +2023,7 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Merged", "Unito");
m.put("Merged pull request \"{0}\" ({1})", "Pull request unita \"{0}\" ({1})");
m.put("Merges pull request", "Unisce pull request");
+ m.put("Message is too long. Max {0} characters", "Il messaggio è troppo lungo. Max {0} caratteri");
m.put("Meta", "Meta");
m.put("Meta Info", "Informazioni Meta");
m.put("Microsoft 365", "Microsoft 365");
@@ -2239,6 +2253,7 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Not run", "Non eseguito");
m.put("Not specified", "Non specificato");
m.put("Note", "Nota");
+ m.put("Nothing changed yet", "Niente è ancora cambiato");
m.put("Nothing to preview", "Niente da visualizzare in anteprima");
m.put("Notification", "Notifica");
m.put("Notifications", "Notifiche");
@@ -2350,6 +2365,7 @@ public class Translation_it extends TranslationResourceBundle {
"Specifica facoltativamente <span class='text-info'>piattaforme separate da virgola</span> da costruire, ad esempio <tt>linux/amd64,linux/arm64</tt>. Lascia vuoto per costruire per la piattaforma del nodo che esegue il job");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"Specifica facoltativamente <span class='text-info'>piattaforme separate da virgola</span> da scansionare, ad esempio <tt>linux/amd64,linux/arm64</tt>. Lascia vuoto per scansionare tutte le piattaforme nel layout OCI");
+ m.put("Optionally specify API key for authentication", "Specifica facoltativamente la chiave API per l'autenticazione");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"Specifica facoltativamente il Dockerfile relativo a <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Lascia vuoto per utilizzare il file <tt>Dockerfile</tt> sotto il percorso di build specificato sopra");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "Specifica facoltativamente la configurazione JavaScript da utilizzare con la CLI di Renovate");
@@ -2563,8 +2579,8 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Ordered List", "Elenco Ordinato");
m.put("Ordered list", "Elenco ordinato");
m.put("Ordinary", "Ordinario");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "Ordinario: Account normale<br>Servizio: L'account di servizio non ha password e indirizzi email, e non genererà notifiche per le sue attività<br>AI: Account AI (in lavorazione)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "Ordinario: Account normale<br>Servizio: L'account di servizio non ha password e indirizzi email, e non genererà notifiche per le sue attività<br>AI: Account AI per rispondere a domande sulla base di codice, modificare le specifiche CI/CD, indagare sui fallimenti dei job o rivedere le pull request");
m.put("Osv License Scanner", "Scanner di Licenze Osv");
m.put("Osv Vulnerability Scanner", "Scanner di Vulnerabilità Osv");
m.put("Other", "Altro");
@@ -3352,6 +3368,8 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "Alcuni commit correlati al commento del codice mancano");
m.put("Some related commits of the pull request are missing", "Alcuni commit correlati alla pull request mancano");
m.put("Some required builds not passed", "Alcune build richieste non sono passate");
+ m.put("Someone changed file mode since you started editing", "Qualcuno ha cambiato la modalità del file da quando hai iniziato a modificare");
+ m.put("Someone changed file type since you started editing", "Qualcuno ha cambiato il tipo di file da quando hai iniziato a modificare");
m.put("Someone made below change since you started editing", "Qualcuno ha apportato la seguente modifica da quando hai iniziato a modificare");
m.put("Sort", "Ordina");
m.put("Source", "Sorgente");
@@ -3382,6 +3400,8 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"Specifica l'attributo contenente il nome del gruppo all'interno della voce LDAP del gruppo trovato. Il valore di questo attributo sarà mappato a un gruppo OneDev. Questo attributo è normalmente impostato su <i>cn</i>");
m.put("Specifies who can access this AI service", "Specifica chi può accedere a questo servizio AI");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "Specifica chi può accedere a questo servizio AI. Il servizio AI può essere accessibile nei seguenti modi:");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"Specifica il file di risultati del test .net TRX relativo a <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, ad esempio <tt>TestResults/*.trx</tt>. Usa * o ? per la corrispondenza del pattern");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3825,6 +3845,7 @@ public class Translation_it extends TranslationResourceBundle {
m.put("System Date", "Data di Sistema");
m.put("System Email Address", "Indirizzo Email di Sistema");
m.put("System Maintenance", "Manutenzione del Sistema");
+ m.put("System Prompt", "Prompt di sistema");
m.put("System Setting", "Impostazione del Sistema");
m.put("System Settings", "Impostazioni del Sistema");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4050,6 +4071,7 @@ public class Translation_it extends TranslationResourceBundle {
"Per evitare duplicazioni, il tempo stimato/rimanente mostrato qui non include quelli aggregati da \"{0}\"");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"Per evitare duplicazioni, il tempo trascorso mostrato qui non include quelli aggregati da \"{0}\"");
+ m.put("To use this package, add below to project pom.xml", "Per utilizzare questo pacchetto, aggiungi quanto segue al pom.xml del progetto");
m.put("Toggle change history", "Attiva/disattiva la cronologia delle modifiche");
m.put("Toggle comments", "Attiva/disattiva i commenti");
m.put("Toggle commits", "Attiva/disattiva i commit");
@@ -4305,6 +4327,9 @@ public class Translation_it extends TranslationResourceBundle {
m.put("Verification Code", "Codice di verifica");
m.put("Verification email sent, please check it", "Email di verifica inviata, per favore controlla");
m.put("Verify", "Verifica");
+ m.put("Via chat interface", "Tramite interfaccia chat");
+ m.put("Via mention in issue or pull request comments", "Tramite menzione nei commenti di issue o pull request");
+ m.put("Via pull request reviewer", "Tramite revisore delle pull request");
m.put("View", "Visualizza");
m.put("View source", "Visualizza sorgente");
m.put("View statistics", "Visualizza statistiche");
@@ -4596,6 +4621,7 @@ public class Translation_it extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "la pull request sui branch \"{0}\" è scartata");
m.put("pull request to branches \"{0}\" is merged", "la pull request sui branch \"{0}\" è unita");
m.put("pull request to branches \"{0}\" is opened", "la pull request sui branch \"{0}\" è aperta");
+ m.put("pull request {0}", "pull request {0}");
m.put("pull requests", "pull request");
m.put("reconciliation (need administrator permission)", "riconciliazione (richiede permessi di amministratore)");
m.put("reports", "report");
@@ -4690,19 +4716,15 @@ public class Translation_it extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "{javax.validation.constraints.NotEmpty.message}");
m.put("{javax.validation.constraints.NotNull.message}", "{javax.validation.constraints.NotNull.message}");
m.put("{javax.validation.constraints.Size.message}", "{javax.validation.constraints.Size.message}");
- m.put("AI system prompt has been saved", "Il prompt del sistema AI è stato salvato");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "Aggiungi anche quanto segue a $HOME/.m2/settings.xml se vuoi compilare il progetto dalla riga di comando");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "Per il lavoro CI/CD, è più conveniente utilizzare un settings.xml personalizzato, ad esempio tramite il codice seguente in un passaggio di comando:");
- m.put("Login Command", "Comando di accesso");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "Assicurati di accedere con un account che abbia il permesso di lettura del pacchetto per il progetto");
- m.put("Nothing changed yet", "Niente è ancora cambiato");
- m.put("Someone changed file mode since you started editing", "Qualcuno ha cambiato la modalità del file da quando hai iniziato a modificare");
- m.put("Someone changed file type since you started editing", "Qualcuno ha cambiato il tipo di file da quando hai iniziato a modificare");
- m.put("System Prompt", "Prompt di sistema");
- m.put("To use this package, add below to project pom.xml", "Per utilizzare questo pacchetto, aggiungi quanto segue al pom.xml del progetto");
+ m.put("All members of entitled groups will be able to access this AI service", "Tutti i membri dei gruppi autorizzati potranno accedere a questo servizio AI");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "I progetti autorizzati possono aggiungere l'utente AI come revisore delle pull request. In questo scenario, l'utente AI esegue compiti utilizzando le proprie autorizzazioni.");
+ m.put("Entitled projects will be able to access this AI service", "I progetti autorizzati potranno accedere a questo servizio AI");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "Gli utenti autorizzati possono interagire con l'utente AI tramite l'interfaccia chat per eseguire compiti come comprendere il codice, scrivere specifiche CI/CD o investigare i fallimenti dei job CI/CD. In questa modalità, l'utente AI opera con le stesse autorizzazioni dell'utente che interagisce con esso, ignorando le autorizzazioni assegnate all'utente AI stesso.");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "Gli utenti autorizzati possono menzionare l'utente AI nei commenti di issue o pull request per richiedere assistenza. In questo caso, l'utente AI esegue compiti utilizzando le proprie autorizzazioni.");
+ m.put("Entitled users will be able to access this AI service", "Gli utenti autorizzati potranno accedere a questo servizio AI");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_ja.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_ja.java
index 4bc164eb6b..bb5619fe81 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_ja.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_ja.java
@@ -130,6 +130,7 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("AI Settings", "AI設定");
m.put("AI entitlement settings have been saved", "AI権限設定が保存されました");
m.put("AI model settings have been saved", "AIモデル設定が保存されました");
+ m.put("AI system prompt has been saved", "AIシステムプロンプトが保存されました");
m.put("API Key", "APIキー");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"例えば、<tt>https://your-domain.atlassian.net/rest/api/3</tt> のような JIRA クラウドインスタンスの API URL");
@@ -279,6 +280,8 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Allow Multiple", "複数を許可");
m.put("Allowed Licenses", "許可されたライセンス");
m.put("Allowed Self Sign-Up Email Domain", "許可されたセルフサインアップメールドメイン");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "コマンドラインからプロジェクトをコンパイルしたい場合は、以下を$HOME/.m2/settings.xmlに追加してください");
m.put("Always", "常に");
m.put("Always Pull Image", "常にイメージをプル");
m.put("An issue already linked for {0}. Unlink it first", "{0}に既にリンクされた課題があります。まずリンクを解除してください");
@@ -423,6 +426,8 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Belonging Groups", "所属グループ");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"以下は一般的な条件です。上の検索ボックスに入力して完全なリストと利用可能な組み合わせを表示してください。");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "以下の内容は未保存の変更から復元されました。<a class=\"clear-unsaved-change\">クリア</a>して破棄");
m.put("Below content is restored from an unsaved change. Clear to discard", "以下の内容は未保存の変更から復元されました。クリアして破棄してください");
m.put("Below information will also be sent", "以下の情報も送信されます");
m.put("Binary file.", "バイナリファイル");
@@ -598,9 +603,13 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Changes since this comment", "このコメント以降の変更");
m.put("Channel Notification", "チャンネル通知");
m.put("Chart Metadata", "チャートメタデータ");
+ m.put("Chat Preserve Days", "チャット保存日数");
m.put("Chat deleted", "チャットが削除されました");
+ m.put("Chat preserve days setting has been saved", "チャット保存日数の設定が保存されました");
m.put("Chat with", "とのチャット");
m.put("Chat with AI", "AIとのチャット");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "指定された日数より古いチャットは、日次メンテナンス中に自動的に削除されます。");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"コミットに署名するためのGPGキーを生成して使用する方法については、<a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHubのガイド</a>を確認してください");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1202,7 +1211,7 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Enter your details to create your account", "アカウントを作成するために詳細を入力してください");
m.put("Enter your details to login to your account", "アカウントにログインするための詳細を入力してください");
m.put("Enter your user name or email to reset password", "パスワードをリセットするには、ユーザー名またはメールを入力してください");
- m.put("Entitle to All Users", "すべてのユーザーに権限を付与");
+ m.put("Entitle to All Users and Projects", "すべてのユーザーとプロジェクトに権限を付与");
m.put("Entitled Groups", "権限を持つグループ");
m.put("Entitled Projects", "権限を持つプロジェクト");
m.put("Entitled Users", "権限を持つユーザー");
@@ -1321,7 +1330,6 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("File missing or obsolete", "ファイルが欠落しているか廃止されています");
m.put("File name", "ファイル名");
m.put("File name patterns such as *.java, *.c", "ファイル名パターン(例: *.java, *.c)");
- m.put("File path to get text content", "テキストコンテンツを取得するファイルパス");
m.put("Files", "ファイル一覧");
m.put("Files to Be Analyzed", "分析対象のファイル");
m.put("Filter", "フィルター");
@@ -1364,13 +1372,14 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Fixing...", "修正中...");
m.put("Float", "浮動小数点");
m.put("Flush", "フラッシュ");
- m.put("Folder path to list all files and subfolders", "すべてのファイルとサブフォルダを一覧表示するフォルダパス");
m.put("Follow below instructions to publish packages into this project", "以下の手順に従って、このプロジェクトにパッケージを公開してください");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"以下の手順に従って、リモートマシンにエージェントをインストールしてください(Linux/Windows/Mac OS X/FreeBSD対応):");
m.put("For CI/CD job, add this gem to Gemfile like below", "CI/CDジョブの場合、以下のようにGemfileにこのgemを追加してください");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"CI/CDジョブの場合、requirements.txtにこのパッケージを追加し、以下のコマンドステップでパッケージをインストールしてください");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "CI/CDジョブでは、カスタムsettings.xmlを使用する方が便利です。例えば、コマンドステップで以下のコードを使用します:");
m.put("For CI/CD job, run below to add package repository via command step", "CI/CDジョブの場合、以下のコマンドステップでパッケージリポジトリを追加してください");
m.put("For CI/CD job, run below to add package source via command step", "CI/CDジョブの場合、以下のコマンドステップでパッケージソースを追加してください");
m.put("For CI/CD job, run below to add source via command step", "CI/CDジョブの場合、以下のコマンドステップでソースを追加してください");
@@ -1678,6 +1687,7 @@ public class Translation_ja extends TranslationResourceBundle {
"無効な状態です。システム設定で指定されたサーバーURLを使用してOneDevを訪問していることを確認してください");
m.put("Invalid subscription key", "無効なサブスクリプションキー");
m.put("Invalid working period", "無効な作業期間");
+ m.put("Investigate build failure with AI", "AIでビルド失敗を調査");
m.put("Invitation sent to \"{0}\"", "\"{0}\"に招待を送信しました");
m.put("Invitation to \"{0}\" deleted", "\"{0}\"への招待を削除しました");
m.put("Invitations", "招待");
@@ -1914,6 +1924,7 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Log Work", "作業ログ");
m.put("Log not available for offline agent", "オフラインエージェントではログは利用できません");
m.put("Log work", "作業ログ");
+ m.put("Login Command", "ログインコマンド");
m.put("Login Name", "ログイン名");
m.put("Login and generate refresh token", "ログインしてリフレッシュトークンを生成");
m.put("Login name already used by another account", "ログイン名は他のアカウントで既に使用されています");
@@ -1959,6 +1970,8 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "アカウントがプロジェクトに対するパッケージ${permission}権限を持っていることを確認してください");
m.put("Make sure the account has package read permission over the project", "アカウントがプロジェクトに対するパッケージ読み取り権限を持っていることを確認してください");
m.put("Make sure the user has package write permission over the project", "ユーザーがプロジェクトに対するパッケージ書き込み権限を持っていることを確認してください");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "プロジェクトのパッケージ読み取り権限を持つアカウントでログインしていることを確認してください");
m.put("Malformed %sbase query", "不正な%sbaseクエリ");
m.put("Malformed %squery", "不正な%sクエリ");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "不正なビルド仕様(インポートプロジェクト: {0}, インポートリビジョン: {1})");
@@ -2010,6 +2023,7 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Merged", "マージ済み");
m.put("Merged pull request \"{0}\" ({1})", "プルリクエスト「{0}」({1})がマージされました");
m.put("Merges pull request", "プルリクエストをマージします");
+ m.put("Message is too long. Max {0} characters", "メッセージが長すぎます。最大{0}文字");
m.put("Meta", "メタ");
m.put("Meta Info", "メタ情報");
m.put("Microsoft 365", "Microsoft 365");
@@ -2239,6 +2253,7 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Not run", "未実行");
m.put("Not specified", "未指定");
m.put("Note", "注記");
+ m.put("Nothing changed yet", "まだ何も変更されていません");
m.put("Nothing to preview", "プレビューするものがありません");
m.put("Notification", "通知");
m.put("Notifications", "通知一覧");
@@ -2350,6 +2365,7 @@ public class Translation_ja extends TranslationResourceBundle {
"オプションで、ビルドするプラットフォームを<span class='text-info'>カンマ区切り</span>で指定してください。例: <tt>linux/amd64,linux/arm64</tt>。ジョブを実行しているノードのプラットフォームでビルドする場合は空のままにしてください。");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"オプションで、スキャンするプラットフォームを<span class='text-info'>カンマ区切り</span>で指定してください。例: <tt>linux/amd64,linux/arm64</tt>。OCIレイアウト内のすべてのプラットフォームをスキャンする場合は空のままにしてください。");
+ m.put("Optionally specify API key for authentication", "認証のためにAPIキーを任意で指定");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"オプションで、<a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>ジョブワークスペース</a>に対するDockerfileの相対パスを指定してください。上記で指定したビルドパスの下にある<tt>Dockerfile</tt>ファイルを使用する場合は空のままにしてください。");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "オプションで、Renovate CLIで使用するJavaScript設定を指定してください。");
@@ -2563,8 +2579,8 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Ordered List", "順序付きリスト");
m.put("Ordered list", "順序付きリスト");
m.put("Ordinary", "通常");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "通常: 通常のアカウント<br>サービス: サービスアカウントにはパスワードとメールアドレスがなく、その活動に対する通知は生成されません<br>AI: AIアカウント(作業中)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "通常: 通常のアカウント<br>サービス: サービスアカウントにはパスワードとメールアドレスがなく、その活動に対する通知は生成されません<br>AI: コードベースに関する質問に答えたり、CI/CD仕様を編集したり、ジョブの失敗を調査したり、プルリクエストをレビューするAIアカウント");
m.put("Osv License Scanner", "Osvライセンススキャナー");
m.put("Osv Vulnerability Scanner", "Osv脆弱性スキャナー");
m.put("Other", "その他");
@@ -3352,6 +3368,8 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "コードコメントに関連する一部のコミットが欠落しています");
m.put("Some related commits of the pull request are missing", "プルリクエストに関連する一部のコミットが欠落しています");
m.put("Some required builds not passed", "必要なビルドがいくつか通過していません");
+ m.put("Someone changed file mode since you started editing", "編集を開始してから誰かがファイルモードを変更しました");
+ m.put("Someone changed file type since you started editing", "編集を開始してから誰かがファイルタイプを変更しました");
m.put("Someone made below change since you started editing", "編集を開始してから以下の変更が行われました。");
m.put("Sort", "ソート");
m.put("Source", "ソース");
@@ -3382,6 +3400,8 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"見つかったグループ LDAP エントリ内のグループ名を含む属性を指定します。この属性の値は OneDev グループにマッピングされます。この属性は通常 <i>cn</i> に設定されます");
m.put("Specifies who can access this AI service", "このAIサービスにアクセスできる人を指定します");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "このAIサービスにアクセスできる人を指定します。AIサービスには以下の方法でアクセスできます:");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"<a href='https://docs.onedev.io/concepts#job-workspace'>ジョブワークスペース</a>に対する .net TRX テスト結果ファイルを指定します。例: <tt>TestResults/*.trx</tt>。パターンマッチには * または ? を使用してください");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3825,6 +3845,7 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("System Date", "システム日付");
m.put("System Email Address", "システムメールアドレス");
m.put("System Maintenance", "システムメンテナンス");
+ m.put("System Prompt", "システムプロンプト");
m.put("System Setting", "システム設定");
m.put("System Settings", "システム設定");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4050,6 +4071,7 @@ public class Translation_ja extends TranslationResourceBundle {
"重複を避けるため、ここに表示される推定/残り時間には\"{0}\"から集計されたものは含まれていません");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"重複を避けるため、ここに表示される費やした時間には\"{0}\"から集計されたものは含まれていません");
+ m.put("To use this package, add below to project pom.xml", "このパッケージを使用するには、以下をプロジェクトのpom.xmlに追加してください");
m.put("Toggle change history", "変更履歴を切り替える");
m.put("Toggle comments", "コメントを切り替える");
m.put("Toggle commits", "コミットを切り替える");
@@ -4305,6 +4327,9 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("Verification Code", "確認コード");
m.put("Verification email sent, please check it", "確認メールが送信されました。確認してください");
m.put("Verify", "確認する");
+ m.put("Via chat interface", "チャットインターフェースを通じて");
+ m.put("Via mention in issue or pull request comments", "問題やプルリクエストのコメントでの言及を通じて");
+ m.put("Via pull request reviewer", "プルリクエストのレビュアーを通じて");
m.put("View", "表示");
m.put("View source", "ソースを表示");
m.put("View statistics", "統計を表示");
@@ -4596,6 +4621,7 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "ブランチ \"{0}\" へのプルリクエストは破棄されました");
m.put("pull request to branches \"{0}\" is merged", "ブランチ \"{0}\" へのプルリクエストはマージされました");
m.put("pull request to branches \"{0}\" is opened", "ブランチ \"{0}\" へのプルリクエストは開かれました");
+ m.put("pull request {0}", "プルリクエスト{0}");
m.put("pull requests", "プルリクエスト");
m.put("reconciliation (need administrator permission)", "調整 (管理者権限が必要)");
m.put("reports", "レポート");
@@ -4690,19 +4716,15 @@ public class Translation_ja extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "{javax.validation.constraints.NotEmpty.message}");
m.put("{javax.validation.constraints.NotNull.message}", "{javax.validation.constraints.NotNull.message}");
m.put("{javax.validation.constraints.Size.message}", "{javax.validation.constraints.Size.message}");
- m.put("AI system prompt has been saved", "AIシステムプロンプトが保存されました");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "コマンドラインからプロジェクトをコンパイルしたい場合は、以下を$HOME/.m2/settings.xmlに追加してください");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "CI/CDジョブでは、カスタムsettings.xmlを使用する方が便利です。例えば、コマンドステップで以下のコードを使用します:");
- m.put("Login Command", "ログインコマンド");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "プロジェクトのパッケージ読み取り権限を持つアカウントでログインしていることを確認してください");
- m.put("Nothing changed yet", "まだ何も変更されていません");
- m.put("Someone changed file mode since you started editing", "編集を開始してから誰かがファイルモードを変更しました");
- m.put("Someone changed file type since you started editing", "編集を開始してから誰かがファイルタイプを変更しました");
- m.put("System Prompt", "システムプロンプト");
- m.put("To use this package, add below to project pom.xml", "このパッケージを使用するには、以下をプロジェクトのpom.xmlに追加してください");
+ m.put("All members of entitled groups will be able to access this AI service", "権限を持つグループのすべてのメンバーは、このAIサービスにアクセスできます。");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "権限を持つプロジェクトは、AIユーザーをプルリクエストのレビュアーとして追加できます。このシナリオでは、AIユーザーは自身の権限を使用してタスクを実行します。");
+ m.put("Entitled projects will be able to access this AI service", "権限を持つプロジェクトは、このAIサービスにアクセスできます。");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "権限を持つユーザーは、チャットインターフェースを通じてAIユーザーと対話し、コードベースの理解、CI/CD仕様の作成、CI/CDジョブの失敗の調査などのタスクを実行できます。このモードでは、AIユーザーはそれと対話するユーザーと同じ権限で動作し、AIユーザー自身に割り当てられた権限を無視します。");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "権限を持つユーザーは、問題やプルリクエストのコメントでAIユーザーに言及して支援を求めることができます。この場合、AIユーザーは自身の権限を使用してタスクを実行します。");
+ m.put("Entitled users will be able to access this AI service", "権限を持つユーザーは、このAIサービスにアクセスできます。");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_ko.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_ko.java
index f473c37a71..c79c860249 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_ko.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_ko.java
@@ -130,6 +130,7 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("AI Settings", "AI 설정");
m.put("AI entitlement settings have been saved", "AI 권한 설정이 저장되었습니다");
m.put("AI model settings have been saved", "AI 모델 설정이 저장되었습니다");
+ m.put("AI system prompt has been saved", "AI 시스템 프롬프트가 저장되었습니다");
m.put("API Key", "API 키");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"예를 들어, <tt>https://your-domain.atlassian.net/rest/api/3</tt>와 같은 JIRA 클라우드 인스턴스의 API URL");
@@ -279,6 +280,8 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Allow Multiple", "다중 허용");
m.put("Allowed Licenses", "허용된 라이선스");
m.put("Allowed Self Sign-Up Email Domain", "허용된 자체 가입 이메일 도메인");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "프로젝트를 명령줄에서 컴파일하려면 아래 내용을 $HOME/.m2/settings.xml에 추가하세요");
m.put("Always", "항상");
m.put("Always Pull Image", "항상 이미지 가져오기");
m.put("An issue already linked for {0}. Unlink it first", "{0}에 대해 이미 연결된 이슈가 있습니다. 먼저 연결을 해제하세요");
@@ -423,6 +426,8 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Belonging Groups", "소속 그룹");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"아래는 일반적인 기준입니다. 위의 검색 상자에 입력하여 전체 목록과 사용 가능한 조합을 확인하세요.");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "아래 내용은 저장되지 않은 변경 사항에서 복원되었습니다. <a class=\"clear-unsaved-change\">지우기</a>하여 폐기");
m.put("Below content is restored from an unsaved change. Clear to discard", "아래 내용은 저장되지 않은 변경 사항에서 복원되었습니다. 삭제하려면 지우세요.");
m.put("Below information will also be sent", "아래 정보도 전송됩니다");
m.put("Binary file.", "바이너리 파일.");
@@ -598,9 +603,13 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Changes since this comment", "이 댓글 이후 변경 사항");
m.put("Channel Notification", "채널 알림");
m.put("Chart Metadata", "차트 메타데이터");
+ m.put("Chat Preserve Days", "채팅 보존 일수");
m.put("Chat deleted", "채팅이 삭제되었습니다");
+ m.put("Chat preserve days setting has been saved", "채팅 보존 일수 설정이 저장되었습니다");
m.put("Chat with", "채팅 상대");
m.put("Chat with AI", "AI와 채팅");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "지정된 일수보다 오래된 채팅은 일일 유지보수 중 자동으로 삭제됩니다.");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"커밋에 서명을 하기 위해 GPG 키를 생성하고 사용하는 방법에 대한 <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub 가이드</a>를 확인하세요");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1202,7 +1211,7 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Enter your details to create your account", "계정을 생성하려면 세부 정보를 입력하세요");
m.put("Enter your details to login to your account", "계정에 로그인하려면 세부 정보를 입력하세요");
m.put("Enter your user name or email to reset password", "비밀번호를 재설정하려면 사용자 이름 또는 이메일을 입력하세요");
- m.put("Entitle to All Users", "모든 사용자에게 권한 부여");
+ m.put("Entitle to All Users and Projects", "모든 사용자 및 프로젝트에 권한 부여");
m.put("Entitled Groups", "권한이 부여된 그룹");
m.put("Entitled Projects", "권한이 부여된 프로젝트");
m.put("Entitled Users", "권한이 부여된 사용자");
@@ -1321,7 +1330,6 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("File missing or obsolete", "파일 누락 또는 오래됨");
m.put("File name", "파일 이름");
m.put("File name patterns such as *.java, *.c", "파일 이름 패턴 예: *.java, *.c");
- m.put("File path to get text content", "텍스트 내용을 가져올 파일 경로");
m.put("Files", "파일들");
m.put("Files to Be Analyzed", "분석할 파일들");
m.put("Filter", "필터");
@@ -1364,13 +1372,14 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Fixing...", "수정 중...");
m.put("Float", "부동");
m.put("Flush", "플러시");
- m.put("Folder path to list all files and subfolders", "모든 파일 및 하위 폴더를 나열할 폴더 경로");
m.put("Follow below instructions to publish packages into this project", "아래 지침을 따라 이 프로젝트에 패키지를 게시하세요");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"원격 머신에 에이전트를 설치하려면 아래 단계를 따르세요 (Linux/Windows/Mac OS X/FreeBSD 지원):");
m.put("For CI/CD job, add this gem to Gemfile like below", "CI/CD 작업의 경우, 아래와 같이 Gemfile에 이 gem을 추가하세요");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"CI/CD 작업의 경우, requirements.txt에 이 패키지를 추가하고 아래 명령 단계를 실행하여 패키지를 설치하세요");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "CI/CD 작업의 경우, 아래 코드와 같이 명령 단계에서 사용자 정의 settings.xml을 사용하는 것이 더 편리합니다:");
m.put("For CI/CD job, run below to add package repository via command step", "CI/CD 작업의 경우, 아래 명령 단계를 실행하여 패키지 저장소를 추가하세요");
m.put("For CI/CD job, run below to add package source via command step", "CI/CD 작업의 경우, 아래 명령 단계를 실행하여 패키지 소스를 추가하세요");
m.put("For CI/CD job, run below to add source via command step", "CI/CD 작업의 경우, 아래 명령 단계를 실행하여 소스를 추가하세요");
@@ -1678,6 +1687,7 @@ public class Translation_ko extends TranslationResourceBundle {
"유효하지 않은 상태입니다. 시스템 설정에 지정된 서버 URL을 사용하여 OneDev를 방문하고 있는지 확인하세요");
m.put("Invalid subscription key", "잘못된 구독 키");
m.put("Invalid working period", "잘못된 작업 기간");
+ m.put("Investigate build failure with AI", "AI로 빌드 실패 조사");
m.put("Invitation sent to \"{0}\"", "\"{0}\"로 초대장이 발송되었습니다");
m.put("Invitation to \"{0}\" deleted", "\"{0}\"에 대한 초대장이 삭제되었습니다");
m.put("Invitations", "초대장");
@@ -1914,6 +1924,7 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Log Work", "작업 로그");
m.put("Log not available for offline agent", "오프라인 에이전트에서는 로그를 사용할 수 없습니다");
m.put("Log work", "작업 로그");
+ m.put("Login Command", "로그인 명령");
m.put("Login Name", "로그인 이름");
m.put("Login and generate refresh token", "로그인하고 새로 고침 토큰 생성");
m.put("Login name already used by another account", "다른 계정에서 이미 사용 중인 로그인 이름");
@@ -1959,6 +1970,8 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "계정이 프로젝트에 대한 패키지 ${permission} 권한이 있는지 확인하세요");
m.put("Make sure the account has package read permission over the project", "계정이 프로젝트에 대한 패키지 읽기 권한이 있는지 확인하세요");
m.put("Make sure the user has package write permission over the project", "사용자가 프로젝트에 대한 패키지 쓰기 권한이 있는지 확인하세요");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "프로젝트에 대한 패키지 읽기 권한이 있는 계정으로 로그인했는지 확인하세요");
m.put("Malformed %sbase query", "잘못된 %sbase 쿼리");
m.put("Malformed %squery", "잘못된 %s쿼리");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "잘못된 빌드 사양 (프로젝트 가져오기: {0}, 리비전 가져오기: {1})");
@@ -2010,6 +2023,7 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Merged", "병합됨");
m.put("Merged pull request \"{0}\" ({1})", "병합된 풀 리퀘스트 \"{0}\" ({1})");
m.put("Merges pull request", "풀 리퀘스트 병합");
+ m.put("Message is too long. Max {0} characters", "메시지가 너무 깁니다. 최대 {0}자");
m.put("Meta", "메타");
m.put("Meta Info", "메타 정보");
m.put("Microsoft 365", "Microsoft 365");
@@ -2239,6 +2253,7 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Not run", "실행되지 않음");
m.put("Not specified", "지정되지 않음");
m.put("Note", "노트");
+ m.put("Nothing changed yet", "아직 변경된 것이 없습니다");
m.put("Nothing to preview", "미리 볼 내용이 없습니다");
m.put("Notification", "알림");
m.put("Notifications", "알림들");
@@ -2350,6 +2365,7 @@ public class Translation_ko extends TranslationResourceBundle {
"선택적으로 <span class='text-info'>쉼표로 구분된</span> 빌드 플랫폼을 지정하세요. 예를 들어 <tt>linux/amd64,linux/arm64</tt>. 작업을 실행하는 노드의 플랫폼으로 빌드하려면 비워 두세요.");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"선택적으로 <span class='text-info'>쉼표로 구분된</span> 스캔 플랫폼을 지정하세요. 예를 들어 <tt>linux/amd64,linux/arm64</tt>. OCI 레이아웃의 모든 플랫폼을 스캔하려면 비워 두세요.");
+ m.put("Optionally specify API key for authentication", "인증을 위해 API 키를 선택적으로 지정");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"선택적으로 <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>작업 워크스페이스</a>에 상대적인 Dockerfile을 지정하세요. 위에서 지정한 빌드 경로 아래의 <tt>Dockerfile</tt> 파일을 사용하려면 비워 두세요.");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "선택적으로 Renovate CLI에서 사용할 JavaScript 구성을 지정하세요.");
@@ -2563,8 +2579,8 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Ordered List", "정렬된 목록");
m.put("Ordered list", "정렬된 목록");
m.put("Ordinary", "일반");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "일반: 일반 계정<br>서비스: 서비스 계정은 비밀번호와 이메일 주소가 없으며, 활동에 대한 알림을 생성하지 않습니다<br>AI: AI 계정 (작업 진행 중)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "일반: 일반 계정<br>서비스: 서비스 계정은 비밀번호와 이메일 주소가 없으며, 활동에 대한 알림을 생성하지 않습니다<br>AI: 코드 베이스에 대한 질문에 답변하고, CI/CD 사양을 편집하며, 작업 실패를 조사하거나 풀 리퀘스트를 검토하는 AI 계정");
m.put("Osv License Scanner", "Osv 라이센스 스캐너");
m.put("Osv Vulnerability Scanner", "Osv 취약점 스캐너");
m.put("Other", "기타");
@@ -3352,6 +3368,8 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "코드 댓글과 관련된 일부 커밋이 누락되었습니다");
m.put("Some related commits of the pull request are missing", "풀 리퀘스트와 관련된 일부 커밋이 누락되었습니다");
m.put("Some required builds not passed", "필수 빌드 중 일부가 통과하지 못했습니다");
+ m.put("Someone changed file mode since you started editing", "편집을 시작한 이후로 누군가 파일 모드를 변경했습니다");
+ m.put("Someone changed file type since you started editing", "편집을 시작한 이후로 누군가 파일 유형을 변경했습니다");
m.put("Someone made below change since you started editing", "편집을 시작한 이후 아래 변경 사항이 있었습니다.");
m.put("Sort", "정렬");
m.put("Source", "소스");
@@ -3382,6 +3400,8 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"찾은 그룹 LDAP 항목 내부에서 그룹 이름을 포함하는 속성을 지정합니다. 이 속성의 값은 OneDev 그룹에 매핑됩니다. 일반적으로 이 속성은 <i>cn</i>으로 설정됩니다");
m.put("Specifies who can access this AI service", "이 AI 서비스에 접근할 수 있는 사람을 지정합니다");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "이 AI 서비스에 접근할 수 있는 대상을 지정합니다. AI 서비스는 아래 방법으로 접근할 수 있습니다:");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"<a href='https://docs.onedev.io/concepts#job-workspace'>작업 공간</a> 상대 경로로 .net TRX 테스트 결과 파일을 지정합니다. 예: <tt>TestResults/*.trx</tt>. 패턴 매칭을 위해 * 또는 ?를 사용하세요");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3825,6 +3845,7 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("System Date", "시스템 날짜");
m.put("System Email Address", "시스템 이메일 주소");
m.put("System Maintenance", "시스템 유지보수");
+ m.put("System Prompt", "시스템 프롬프트");
m.put("System Setting", "시스템 설정");
m.put("System Settings", "시스템 설정");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4050,6 +4071,7 @@ public class Translation_ko extends TranslationResourceBundle {
"중복을 피하기 위해 여기 표시된 추정/남은 시간은 \"{0}\"에서 집계된 시간을 포함하지 않습니다");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"중복을 피하기 위해 여기 표시된 소요 시간은 \"{0}\"에서 집계된 시간을 포함하지 않습니다");
+ m.put("To use this package, add below to project pom.xml", "이 패키지를 사용하려면 아래 내용을 프로젝트 pom.xml에 추가하세요");
m.put("Toggle change history", "변경 기록 토글");
m.put("Toggle comments", "댓글 토글");
m.put("Toggle commits", "커밋 토글");
@@ -4305,6 +4327,9 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("Verification Code", "확인 코드");
m.put("Verification email sent, please check it", "확인 이메일이 발송되었습니다. 확인해 주세요");
m.put("Verify", "확인");
+ m.put("Via chat interface", "채팅 인터페이스를 통해");
+ m.put("Via mention in issue or pull request comments", "이슈 또는 풀 리퀘스트 댓글에서 언급을 통해");
+ m.put("Via pull request reviewer", "풀 리퀘스트 리뷰어를 통해");
m.put("View", "보기");
m.put("View source", "소스 보기");
m.put("View statistics", "통계 보기");
@@ -4596,6 +4621,7 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "브랜치 \"{0}\"에 대한 풀 리퀘스트가 폐기됨");
m.put("pull request to branches \"{0}\" is merged", "브랜치 \"{0}\"에 대한 풀 리퀘스트가 병합됨");
m.put("pull request to branches \"{0}\" is opened", "브랜치 \"{0}\"에 대한 풀 리퀘스트가 열림");
+ m.put("pull request {0}", "풀 리퀘스트 {0}");
m.put("pull requests", "풀 리퀘스트들");
m.put("reconciliation (need administrator permission)", "조정 (관리자 권한 필요)");
m.put("reports", "보고서");
@@ -4690,19 +4716,15 @@ public class Translation_ko extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "{javax.validation.constraints.NotEmpty.message}");
m.put("{javax.validation.constraints.NotNull.message}", "{javax.validation.constraints.NotNull.message}");
m.put("{javax.validation.constraints.Size.message}", "{javax.validation.constraints.Size.message}");
- m.put("AI system prompt has been saved", "AI 시스템 프롬프트가 저장되었습니다");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "프로젝트를 명령줄에서 컴파일하려면 아래 내용을 $HOME/.m2/settings.xml에 추가하세요");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "CI/CD 작업의 경우, 아래 코드와 같이 명령 단계에서 사용자 정의 settings.xml을 사용하는 것이 더 편리합니다:");
- m.put("Login Command", "로그인 명령");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "프로젝트에 대한 패키지 읽기 권한이 있는 계정으로 로그인했는지 확인하세요");
- m.put("Nothing changed yet", "아직 변경된 것이 없습니다");
- m.put("Someone changed file mode since you started editing", "편집을 시작한 이후로 누군가 파일 모드를 변경했습니다");
- m.put("Someone changed file type since you started editing", "편집을 시작한 이후로 누군가 파일 유형을 변경했습니다");
- m.put("System Prompt", "시스템 프롬프트");
- m.put("To use this package, add below to project pom.xml", "이 패키지를 사용하려면 아래 내용을 프로젝트 pom.xml에 추가하세요");
+ m.put("All members of entitled groups will be able to access this AI service", "권한이 있는 그룹의 모든 구성원은 이 AI 서비스에 접근할 수 있습니다.");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "권한이 있는 프로젝트는 AI 사용자를 풀 리퀘스트 리뷰어로 추가할 수 있습니다. 이 시나리오에서는 AI 사용자가 자신의 권한을 사용하여 작업을 수행합니다.");
+ m.put("Entitled projects will be able to access this AI service", "권한이 있는 프로젝트는 이 AI 서비스에 접근할 수 있습니다.");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "권한이 있는 사용자는 채팅 인터페이스를 통해 AI 사용자와 상호 작용하여 코드베이스 이해, CI/CD 사양 작성, CI/CD 작업 실패 조사와 같은 작업을 수행할 수 있습니다. 이 모드에서는 AI 사용자가 상호 작용하는 사용자와 동일한 권한으로 작동하며, AI 사용자에게 할당된 권한은 무시됩니다.");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "권한이 있는 사용자는 이슈나 풀 리퀘스트 댓글에서 AI 사용자를 언급하여 도움을 요청할 수 있습니다. 이 경우 AI 사용자가 자신의 권한을 사용하여 작업을 수행합니다.");
+ m.put("Entitled users will be able to access this AI service", "권한이 있는 사용자는 이 AI 서비스에 접근할 수 있습니다.");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_pt.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_pt.java
index 2fa178deda..dbeeb57d3c 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_pt.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_pt.java
@@ -130,6 +130,7 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("AI Settings", "Configurações de IA");
m.put("AI entitlement settings have been saved", "Configurações de direitos de IA foram salvas");
m.put("AI model settings have been saved", "Configurações do modelo de IA foram salvas");
+ m.put("AI system prompt has been saved", "O prompt do sistema de IA foi salvo");
m.put("API Key", "Chave de API");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"URL da API da sua instância JIRA cloud, por exemplo, <tt>https://your-domain.atlassian.net/rest/api/3</tt>");
@@ -279,6 +280,8 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Allow Multiple", "Permitir Múltiplos");
m.put("Allowed Licenses", "Licenças Permitidas");
m.put("Allowed Self Sign-Up Email Domain", "Domínio de Email Permitido para Auto Cadastro");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "Além disso, adicione abaixo ao $HOME/.m2/settings.xml se você quiser compilar o projeto a partir da linha de comando");
m.put("Always", "Sempre");
m.put("Always Pull Image", "Sempre Puxar Imagem");
m.put("An issue already linked for {0}. Unlink it first", "Um problema já está vinculado a {0}. Desvincule-o primeiro");
@@ -423,6 +426,8 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Belonging Groups", "Grupos Pertencentes");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"Abaixo estão alguns critérios comuns. Digite na caixa de pesquisa acima para visualizar a lista completa e combinações disponíveis.");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "O conteúdo abaixo foi restaurado de uma alteração não salva. <a class=\"clear-unsaved-change\">Limpar</a> para descartar");
m.put("Below content is restored from an unsaved change. Clear to discard", "O conteúdo abaixo foi restaurado de uma alteração não salva. Limpar para descartar");
m.put("Below information will also be sent", "As informações abaixo também serão enviadas");
m.put("Binary file.", "Arquivo binário.");
@@ -598,9 +603,13 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Changes since this comment", "Alterações desde este comentário");
m.put("Channel Notification", "Notificação de Canal");
m.put("Chart Metadata", "Metadados do Gráfico");
+ m.put("Chat Preserve Days", "Dias de Preservação do Chat");
m.put("Chat deleted", "Chat excluído");
+ m.put("Chat preserve days setting has been saved", "A configuração de dias de preservação do chat foi salva");
m.put("Chat with", "Conversar com");
m.put("Chat with AI", "Conversar com IA");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "Chats mais antigos que o número especificado de dias serão automaticamente deletados durante a manutenção diária.");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"Confira o <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">guia do GitHub</a> sobre como gerar e usar chaves GPG para assinar seus commits");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1202,7 +1211,7 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Enter your details to create your account", "Insira seus dados para criar sua conta");
m.put("Enter your details to login to your account", "Insira seus dados para fazer login na sua conta");
m.put("Enter your user name or email to reset password", "Digite seu nome de usuário ou email para redefinir a senha");
- m.put("Entitle to All Users", "Conceder a Todos os Usuários");
+ m.put("Entitle to All Users and Projects", "Conceder a Todos os Usuários e Projetos");
m.put("Entitled Groups", "Grupos Autorizados");
m.put("Entitled Projects", "Projetos Autorizados");
m.put("Entitled Users", "Usuários Autorizados");
@@ -1321,7 +1330,6 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("File missing or obsolete", "Arquivo ausente ou obsoleto");
m.put("File name", "nome do arquivo");
m.put("File name patterns such as *.java, *.c", "Padrões de nome de arquivo como *.java, *.c");
- m.put("File path to get text content", "Caminho do arquivo para obter o conteúdo do texto");
m.put("Files", "Arquivos");
m.put("Files to Be Analyzed", "Arquivos a Serem Analisados");
m.put("Filter", "Filtro");
@@ -1364,13 +1372,14 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Fixing...", "Corrigindo...");
m.put("Float", "Float");
m.put("Flush", "Descarregar");
- m.put("Folder path to list all files and subfolders", "Caminho da pasta para listar todos os arquivos e subpastas");
m.put("Follow below instructions to publish packages into this project", "Siga as instruções abaixo para publicar pacotes neste projeto");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"Siga os passos abaixo para instalar o agente na máquina remota (suporta Linux/Windows/Mac OS X/FreeBSD):");
m.put("For CI/CD job, add this gem to Gemfile like below", "Para trabalho CI/CD, adicione esta gem ao Gemfile como abaixo");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"Para trabalho CI/CD, adicione este pacote ao requirements.txt e execute o comando abaixo para instalar o pacote via etapa de comando");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "Para trabalho de CI/CD, é mais conveniente usar um settings.xml personalizado, por exemplo, através do código abaixo em um passo de comando:");
m.put("For CI/CD job, run below to add package repository via command step", "Para trabalho CI/CD, execute o comando abaixo para adicionar o repositório de pacotes via etapa de comando");
m.put("For CI/CD job, run below to add package source via command step", "Para trabalho CI/CD, execute o comando abaixo para adicionar a fonte do pacote via etapa de comando");
m.put("For CI/CD job, run below to add source via command step", "Para trabalho CI/CD, execute o comando abaixo para adicionar a fonte via etapa de comando");
@@ -1678,6 +1687,7 @@ public class Translation_pt extends TranslationResourceBundle {
"Estado inválido. Por favor, certifique-se de que está visitando o OneDev usando a URL do servidor especificada na configuração do sistema");
m.put("Invalid subscription key", "Chave de assinatura inválida");
m.put("Invalid working period", "Período de trabalho inválido");
+ m.put("Investigate build failure with AI", "Investigar falha de build com IA");
m.put("Invitation sent to \"{0}\"", "Convite enviado para \"{0}\"");
m.put("Invitation to \"{0}\" deleted", "Convite para \"{0}\" excluído");
m.put("Invitations", "Convites");
@@ -1914,6 +1924,7 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Log Work", "Registrar Trabalho");
m.put("Log not available for offline agent", "Log não disponível para agente offline");
m.put("Log work", "Registrar trabalho");
+ m.put("Login Command", "Comando de Login");
m.put("Login Name", "Nome de Login");
m.put("Login and generate refresh token", "Faça login e gere o token de atualização");
m.put("Login name already used by another account", "Nome de login já usado por outra conta");
@@ -1959,6 +1970,8 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "Certifique-se de que a conta tem permissão de pacote ${permission} sobre o projeto");
m.put("Make sure the account has package read permission over the project", "Certifique-se de que a conta tem permissão de leitura de pacote sobre o projeto");
m.put("Make sure the user has package write permission over the project", "Certifique-se de que o usuário tem permissão de escrita de pacote sobre o projeto");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "Certifique-se de fazer login com uma conta que tenha permissão de leitura de pacote para o projeto");
m.put("Malformed %sbase query", "Consulta %sbase malformada");
m.put("Malformed %squery", "Consulta %s malformada");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "Especificação de build malformada (importar projeto: {0}, importar revisão: {1})");
@@ -2010,6 +2023,7 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Merged", "Mesclado");
m.put("Merged pull request \"{0}\" ({1})", "Pull request mesclado \"{0}\" ({1})");
m.put("Merges pull request", "Mescla pull request");
+ m.put("Message is too long. Max {0} characters", "A mensagem é muito longa. Máximo de {0} caracteres");
m.put("Meta", "Meta");
m.put("Meta Info", "Informações Meta");
m.put("Microsoft 365", "Microsoft 365");
@@ -2239,6 +2253,7 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Not run", "Não executado");
m.put("Not specified", "Não especificado");
m.put("Note", "Nota");
+ m.put("Nothing changed yet", "Nada mudou ainda");
m.put("Nothing to preview", "Nada para visualizar");
m.put("Notification", "Notificação");
m.put("Notifications", "Notificações");
@@ -2350,6 +2365,7 @@ public class Translation_pt extends TranslationResourceBundle {
"Opcionalmente especifique <span class='text-info'>plataformas separadas por vírgula</span> para construir, por exemplo <tt>linux/amd64,linux/arm64</tt>. Deixe vazio para construir para a plataforma do nó que executa o trabalho");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"Opcionalmente especifique <span class='text-info'>plataformas separadas por vírgula</span> para escanear, por exemplo <tt>linux/amd64,linux/arm64</tt>. Deixe vazio para escanear todas as plataformas no layout OCI");
+ m.put("Optionally specify API key for authentication", "Opcionalmente, especifique a chave de API para autenticação");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"Opcionalmente especifique o Dockerfile relativo ao <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>espaço de trabalho do trabalho</a>. Deixe vazio para usar o arquivo <tt>Dockerfile</tt> no caminho de construção especificado acima");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "Opcionalmente especifique a configuração JavaScript a ser usada pelo Renovate CLI");
@@ -2563,8 +2579,8 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Ordered List", "Lista Ordenada");
m.put("Ordered list", "Lista ordenada");
m.put("Ordinary", "Ordinário");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "Ordinário: Conta normal<br>Serviço: Conta de serviço não possui senha e endereços de e-mail, e não gerará notificações para suas atividades<br>IA: Conta de IA (em desenvolvimento)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "Ordinário: Conta normal<br>Serviço: Conta de serviço não possui senha e endereços de e-mail, e não gerará notificações para suas atividades<br>IA: Conta de IA para responder perguntas sobre a base de código, editar especificações de CI/CD, investigar falhas de trabalho ou revisar pull requests");
m.put("Osv License Scanner", "Scanner de Licença Osv");
m.put("Osv Vulnerability Scanner", "Scanner de Vulnerabilidade Osv");
m.put("Other", "Outro");
@@ -3352,6 +3368,8 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "Alguns commits relacionados ao comentário de código estão faltando");
m.put("Some related commits of the pull request are missing", "Alguns commits relacionados à solicitação de pull estão faltando");
m.put("Some required builds not passed", "Algumas builds obrigatórias não foram aprovadas");
+ m.put("Someone changed file mode since you started editing", "Alguém mudou o modo do arquivo desde que você começou a editar");
+ m.put("Someone changed file type since you started editing", "Alguém mudou o tipo de arquivo desde que você começou a editar");
m.put("Someone made below change since you started editing", "Alguém fez a alteração abaixo desde que você começou a editar");
m.put("Sort", "Ordenar");
m.put("Source", "Fonte");
@@ -3382,6 +3400,8 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"Especifica o atributo que contém o nome do grupo dentro da entrada LDAP do grupo encontrado. O valor deste atributo será mapeado para um grupo do OneDev. Este atributo normalmente é definido como <i>cn</i>");
m.put("Specifies who can access this AI service", "Especifica quem pode acessar este serviço de IA");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "Especifica quem pode acessar este serviço de IA. O serviço de IA pode ser acessado nas abordagens abaixo:");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"Especifique o arquivo de resultado de teste .net TRX relativo ao <a href='https://docs.onedev.io/concepts#job-workspace'>workspace do job</a>, por exemplo <tt>TestResults/*.trx</tt>. Use * ou ? para correspondência de padrão");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3825,6 +3845,7 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("System Date", "Data do Sistema");
m.put("System Email Address", "Endereço de Email do Sistema");
m.put("System Maintenance", "Manutenção do Sistema");
+ m.put("System Prompt", "Prompt do Sistema");
m.put("System Setting", "Configuração do Sistema");
m.put("System Settings", "Configurações do Sistema");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4050,6 +4071,7 @@ public class Translation_pt extends TranslationResourceBundle {
"Para evitar duplicação, o tempo estimado/restante mostrado aqui não inclui aqueles agregados de \"{0}\"");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"Para evitar duplicação, o tempo gasto mostrado aqui não inclui aqueles agregados de \"{0}\"");
+ m.put("To use this package, add below to project pom.xml", "Para usar este pacote, adicione abaixo ao pom.xml do projeto");
m.put("Toggle change history", "Alternar histórico de alterações");
m.put("Toggle comments", "Alternar comentários");
m.put("Toggle commits", "Alternar commits");
@@ -4305,6 +4327,9 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("Verification Code", "Código de Verificação");
m.put("Verification email sent, please check it", "Email de verificação enviado, por favor verifique");
m.put("Verify", "Verificar");
+ m.put("Via chat interface", "Através da interface de chat");
+ m.put("Via mention in issue or pull request comments", "Através de menção em comentários de issues ou pull requests");
+ m.put("Via pull request reviewer", "Através de revisor de pull request");
m.put("View", "Visualizar");
m.put("View source", "Visualizar fonte");
m.put("View statistics", "Visualizar estatísticas");
@@ -4596,6 +4621,7 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "pull request para branches \"{0}\" é descartado");
m.put("pull request to branches \"{0}\" is merged", "pull request para branches \"{0}\" é mesclado");
m.put("pull request to branches \"{0}\" is opened", "pull request para branches \"{0}\" está aberto");
+ m.put("pull request {0}", "pull request {0}");
m.put("pull requests", "pull requests");
m.put("reconciliation (need administrator permission)", "reconciliação (necessita permissão de administrador)");
m.put("reports", "relatórios");
@@ -4690,19 +4716,15 @@ public class Translation_pt extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "{javax.validation.constraints.NotEmpty.message}");
m.put("{javax.validation.constraints.NotNull.message}", "{javax.validation.constraints.NotNull.message}");
m.put("{javax.validation.constraints.Size.message}", "{javax.validation.constraints.Size.message}");
- m.put("AI system prompt has been saved", "O prompt do sistema de IA foi salvo");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "Além disso, adicione abaixo ao $HOME/.m2/settings.xml se você quiser compilar o projeto a partir da linha de comando");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "Para trabalho de CI/CD, é mais conveniente usar um settings.xml personalizado, por exemplo, através do código abaixo em um passo de comando:");
- m.put("Login Command", "Comando de Login");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "Certifique-se de fazer login com uma conta que tenha permissão de leitura de pacote para o projeto");
- m.put("Nothing changed yet", "Nada mudou ainda");
- m.put("Someone changed file mode since you started editing", "Alguém mudou o modo do arquivo desde que você começou a editar");
- m.put("Someone changed file type since you started editing", "Alguém mudou o tipo de arquivo desde que você começou a editar");
- m.put("System Prompt", "Prompt do Sistema");
- m.put("To use this package, add below to project pom.xml", "Para usar este pacote, adicione abaixo ao pom.xml do projeto");
+ m.put("All members of entitled groups will be able to access this AI service", "Todos os membros dos grupos autorizados poderão acessar este serviço de IA");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "Projetos autorizados podem adicionar o usuário de IA como revisor de pull request. Neste cenário, o usuário de IA executa tarefas usando suas próprias permissões.");
+ m.put("Entitled projects will be able to access this AI service", "Projetos autorizados poderão acessar este serviço de IA");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "Usuários autorizados podem interagir com o usuário de IA através da interface de chat para realizar tarefas como entender a base de código, criar especificações de CI/CD ou investigar falhas em jobs de CI/CD. Neste modo, o usuário de IA opera com as mesmas permissões do usuário que está interagindo com ele, ignorando as permissões atribuídas ao próprio usuário de IA.");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "Usuários autorizados podem mencionar o usuário de IA em comentários de issues ou pull requests para solicitar assistência. Neste caso, o usuário de IA executa tarefas usando suas próprias permissões.");
+ m.put("Entitled users will be able to access this AI service", "Usuários autorizados poderão acessar este serviço de IA");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh.java
index 55ce520deb..833169bb94 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh.java
@@ -38,6 +38,7 @@ public class Translation_zh extends TranslationResourceBundle {
- 'artifact' should be translated as 制品
- 'pull request' should be translated as 合并请求
- 'job' should be translated as 任务
+ - 'entitled' should be translated as 被授权的
""")
public static void init(Map<String, String> m) {
m.clear();
@@ -154,6 +155,7 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("AI Settings", "AI 设置");
m.put("AI entitlement settings have been saved", "AI 权限设置已保存");
m.put("AI model settings have been saved", "AI 模型设置已保存");
+ m.put("AI system prompt has been saved", "AI 系统提示已保存");
m.put("API Key", "API 密钥");
m.put("API url of your JIRA cloud instance, for instance, <tt>https://your-domain.atlassian.net/rest/api/3</tt>",
"你的JIRA云实例的API地址,例如:<tt>https://your-domain.atlassian.net/rest/api/3</tt>");
@@ -303,6 +305,8 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Allow Multiple", "允许多个");
m.put("Allowed Licenses", "允许的许可证");
m.put("Allowed Self Sign-Up Email Domain", "允许自助注册的邮箱域名");
+ m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
+ "如果您想从命令行编译项目,请将以下内容添加到 $HOME/.m2/settings.xml");
m.put("Always", "总是");
m.put("Always Pull Image", "始终拉取镜像");
m.put("An issue already linked for {0}. Unlink it first", "已链接到 {0}。先取消链接");
@@ -447,6 +451,8 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Belonging Groups", "所属组");
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"以下是一些常见的条件。在搜索框中输入以查看完整列表和可用组合。");
+ m.put("Below content is restored from an unsaved change. <a class=\"clear-unsaved-change\">Clear</a> to discard",
+ "以下内容是从未保存的更改中恢复的。<a class=\"clear-unsaved-change\">清除</a>以丢弃");
m.put("Below content is restored from an unsaved change. Clear to discard", "以下内容从未保存的更改中恢复。清除以丢弃");
m.put("Below information will also be sent", "以下信息也将被发送");
m.put("Binary file.", "二进制文件");
@@ -622,9 +628,13 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Changes since this comment", "此评论后的变更");
m.put("Channel Notification", "频道通知");
m.put("Chart Metadata", "Chart 元数据");
+ m.put("Chat Preserve Days", "聊天保留天数");
m.put("Chat deleted", "聊天已删除");
+ m.put("Chat preserve days setting has been saved", "聊天保留天数设置已保存");
m.put("Chat with", "聊天对象");
m.put("Chat with AI", "与 AI 聊天");
+ m.put("Chats older than the specified number of days will be automatically deleted during daily maintenance.",
+ "超过指定天数的聊天将在每日维护期间自动删除。");
m.put("Check <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub's guide</a> on how to generate and use GPG keys to sign your commits",
"检查 <a href=\"https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#gpg-commit-signature-verification\" target=\"_blank\">GitHub 的指南</a> 如何生成和使用 GPG 密钥来签署您的提交");
m.put("Check <a href=\"https://docs.onedev.io/administration-guide/agent-management\" target=\"_blank\">agent management</a> for details, including instructions on how to run agent as service",
@@ -1226,7 +1236,7 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Enter your details to create your account", "输入您的详细信息以创建您的账户");
m.put("Enter your details to login to your account", "输入您的详细信息登录到您的账户");
m.put("Enter your user name or email to reset password", "输入您的用户名或邮箱以重置密码");
- m.put("Entitle to All Users", "授权给所有用户");
+ m.put("Entitle to All Users and Projects", "授权给所有用户和项目");
m.put("Entitled Groups", "授权组");
m.put("Entitled Projects", "授权项目");
m.put("Entitled Users", "授权用户");
@@ -1345,7 +1355,6 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("File missing or obsolete", "文件缺失或过时");
m.put("File name", "文件名");
m.put("File name patterns such as *.java, *.c", "文件名模式,如 *.java, *.c");
- m.put("File path to get text content", "文件路径以获取文本内容");
m.put("Files", "文件");
m.put("Files to Be Analyzed", "要分析的文件");
m.put("Filter", "过滤");
@@ -1388,13 +1397,14 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Fixing...", "修复中...");
m.put("Float", "浮点数");
m.put("Flush", "刷新");
- m.put("Folder path to list all files and subfolders", "文件夹路径以列出所有文件和子文件夹");
m.put("Follow below instructions to publish packages into this project", "按照以下说明将包发布到此项目");
m.put("Follow below steps to install agent on remote machine (supports Linux/Windows/Mac OS X/FreeBSD):",
"按照以下步骤在远程机器上安装代理(支持 Linux/Windows/Mac OS X/FreeBSD):");
m.put("For CI/CD job, add this gem to Gemfile like below", "对于 CI/CD 任务,将此 gem 添加到 Gemfile 中,如下所示");
m.put("For CI/CD job, add this package to requirements.txt and run below to install the package via command step",
"对于 CI/CD 任务,将此包添加到 requirements.txt 中,并运行以下命令通过命令步骤安装包");
+ m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
+ "对于 CI/CD 任务,使用自定义 settings.xml 更方便,例如通过在命令步骤中使用以下代码:");
m.put("For CI/CD job, run below to add package repository via command step", "对于 CI/CD 任务,运行以下命令通过命令步骤添加包仓库");
m.put("For CI/CD job, run below to add package source via command step", "对于 CI/CD 任务,运行以下命令通过命令步骤添加包源");
m.put("For CI/CD job, run below to add source via command step", "对于 CI/CD 任务,运行以下命令通过命令步骤添加源");
@@ -1702,6 +1712,7 @@ public class Translation_zh extends TranslationResourceBundle {
"无效的状态。请确保您使用系统设置中指定的服务器URL访问OneDev");
m.put("Invalid subscription key", "无效的订阅密钥");
m.put("Invalid working period", "无效的工作时间");
+ m.put("Investigate build failure with AI", "使用 AI 调查构建失败");
m.put("Invitation sent to \"{0}\"", "邀请已发送至 \"{0}\"");
m.put("Invitation to \"{0}\" deleted", "邀请已取消: \"{0}\"");
m.put("Invitations", "邀请");
@@ -1938,6 +1949,7 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Log Work", "记录工作");
m.put("Log not available for offline agent", "离线代理的日志不可用");
m.put("Log work", "记录工作");
+ m.put("Login Command", "登录命令");
m.put("Login Name", "登录名称");
m.put("Login and generate refresh token", "登录并生成刷新令牌");
m.put("Login name already used by another account", "登录名已被另一个账户使用");
@@ -1983,6 +1995,8 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Make sure the account has package ${permission} permission over the project", "确保账户对项目具有包 ${permission} 权限");
m.put("Make sure the account has package read permission over the project", "确保账户对项目具有包读权限");
m.put("Make sure the user has package write permission over the project", "确保用户对项目具有包写权限");
+ m.put("Make sure to log in with an account that has package read permission for the project",
+ "确保使用对项目具有包读取权限的账户登录");
m.put("Malformed %sbase query", "解析%s基准查询时出错");
m.put("Malformed %squery", "解析%s查询时出错");
m.put("Malformed build spec (import project: {0}, import revision: {1})", "构建规范格式错误(导入项目:{0},导入版本:{1})");
@@ -2034,6 +2048,7 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Merged", "合并");
m.put("Merged pull request \"{0}\" ({1})", "合并合并请求 \"{0}\"({1})");
m.put("Merges pull request", "合并请求");
+ m.put("Message is too long. Max {0} characters", "消息太长。最大 {0} 个字符");
m.put("Meta", "元");
m.put("Meta Info", "元数据");
m.put("Microsoft 365", "Microsoft 365");
@@ -2263,6 +2278,7 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Not run", "未运行");
m.put("Not specified", "未指定");
m.put("Note", "备注");
+ m.put("Nothing changed yet", "尚未更改任何内容");
m.put("Nothing to preview", "没有预览内容");
m.put("Notification", "通知");
m.put("Notifications", "通知");
@@ -2374,6 +2390,7 @@ public class Translation_zh extends TranslationResourceBundle {
"可选择指定 <span class='text-info'>逗号分隔</span> 的平台,例如 <tt>linux/amd64,linux/arm64</tt>。留空则构建为运行任务的节点的平台");
m.put("Optionally specify <span class='text-info'>comma separated</span> platforms to scan, for instance <tt>linux/amd64,linux/arm64</tt>. Leave empty to scan all platforms in OCI layout",
"可选择指定 <span class='text-info'>逗号分隔</span> 的平台,例如 <tt>linux/amd64,linux/arm64</tt>。留空则扫描 OCI 布局中的所有平台");
+ m.put("Optionally specify API key for authentication", "可选地指定 API 密钥进行身份验证");
m.put("Optionally specify Dockerfile relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. Leave empty to use file <tt>Dockerfile</tt> under build path specified above",
"可选择指定相对于 <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>任务工作区</a> 的 Dockerfile。留空则使用上面指定的构建路径下的文件 <tt>Dockerfile</tt>");
m.put("Optionally specify JavaScript config to be used by Renovate CLI", "可选择指定用于 Renovate CLI 的 JavaScript 配置");
@@ -2587,8 +2604,8 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Ordered List", "有序列表");
m.put("Ordered list", "有序列表");
m.put("Ordinary", "普通");
- m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account (working in progress)",
- "普通:普通账户<br>服务:服务账户没有密码和电子邮件地址,并且不会为其活动生成通知<br>AI:AI 账户(正在进行中)");
+ m.put("Ordinary: Normal account<br>Service: Service account does not have password and email addresses, and will not generate notifications for its activities<br>AI: AI account to answer questions about the code base, edit CI/CD spec, investigate job failure, or review pull request",
+ "普通:普通账户<br>服务:服务账户没有密码和电子邮件地址,并且不会为其活动生成通知<br>AI:AI 账户用于回答关于代码库的问题,编辑 CI/CD 规范,调查任务失败或审查合并请求");
m.put("Osv License Scanner", "OSV 许可证扫描器");
m.put("Osv Vulnerability Scanner", "OSV 漏洞扫描器");
m.put("Other", "其他");
@@ -3376,6 +3393,8 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Some related commits of the code comment is missing", "与代码评论相关的提交缺失");
m.put("Some related commits of the pull request are missing", "与合并请求相关的提交缺失");
m.put("Some required builds not passed", "一些必需的构建未通过");
+ m.put("Someone changed file mode since you started editing", "自您开始编辑以来,有人更改了文件模式");
+ m.put("Someone changed file type since you started editing", "自您开始编辑以来,有人更改了文件类型");
m.put("Someone made below change since you started editing", "自您开始编辑以来,有人进行了以下更改");
m.put("Sort", "排序");
m.put("Source", "源");
@@ -3406,6 +3425,8 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute will be mapped to a OneDev group. This attribute is normally set to <i>cn</i>",
"指定在找到的组 LDAP 条目中包含组名称的属性。此属性的值将映射到 OneDev 组。此属性通常设置为 <i>cn</i>");
m.put("Specifies who can access this AI service", "指定谁可以访问此 AI 服务");
+ m.put("Specifies who can access this AI service. AI service can be accessed in below approaches:",
+ "指定谁可以访问此 AI 服务。AI 服务可以通过以下方式访问:");
m.put("Specify .net TRX test result file relative to <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>, for instance <tt>TestResults/*.trx</tt>. Use * or ? for pattern match",
"指定 .net TRX 测试结果文件相对 <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>,例如 <tt>TestResults/*.trx</tt>。使用 * 或 ? 进行模式匹配");
m.put("Specify <a href='https://docs.onedev.io/tutorials/cicd/job-secrets' target='_blank'>job secret</a> whose value is access token with code write permission over above projects. Commits, issues, and pull requests will also be created under name of the access token owner",
@@ -3849,6 +3870,7 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("System Date", "系统日期");
m.put("System Email Address", "系统电子邮件地址");
m.put("System Maintenance", "系统维护");
+ m.put("System Prompt", "系统提示");
m.put("System Setting", "系统设置");
m.put("System Settings", "系统设置");
m.put("System email address defined in mail setting should be used as recipient of such email, and project name may be appended to this address using to indicate where to create issues. For instance, if system email address is specified as <tt>[email protected]</tt>, sending email to <tt>[email protected]</tt> will create issue in <tt>myproject</tt>. If project name is not appended, OneDev will look up the project using project designation information below",
@@ -4074,6 +4096,7 @@ public class Translation_zh extends TranslationResourceBundle {
"为避免重复,此处显示的估计/剩余时间不包括从 \"{0}\" 聚合的时间");
m.put("To avoid duplication, spent time showing here does not include those aggregated from \"{0}\"",
"为避免重复,这里显示的时间不包括从 \"{0}\" 聚合的时间");
+ m.put("To use this package, add below to project pom.xml", "要使用此包,请将以下内容添加到项目 pom.xml");
m.put("Toggle change history", "切换更改历史");
m.put("Toggle comments", "切换评论");
m.put("Toggle commits", "切换提交");
@@ -4329,6 +4352,9 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("Verification Code", "验证码");
m.put("Verification email sent, please check it", "验证电子邮件已发送,请检查");
m.put("Verify", "验证");
+ m.put("Via chat interface", "通过聊天界面");
+ m.put("Via mention in issue or pull request comments", "通过在工单或合并请求评论中提到");
+ m.put("Via pull request reviewer", "通过合并请求审查者");
m.put("View", "查看");
m.put("View source", "查看源代码");
m.put("View statistics", "查看统计信息");
@@ -4620,6 +4646,7 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("pull request to branches \"{0}\" is discarded", "分支 \"{0}\" 的合并请求被放弃");
m.put("pull request to branches \"{0}\" is merged", "分支 \"{0}\" 的合并请求被合并");
m.put("pull request to branches \"{0}\" is opened", "分支 \"{0}\" 的合并请求被创建");
+ m.put("pull request {0}", "合并请求 {0}");
m.put("pull requests", "合并请求");
m.put("reconciliation (need administrator permission)", "一致性检查(需要管理员权限)");
m.put("reports", "报告");
@@ -4714,19 +4741,15 @@ public class Translation_zh extends TranslationResourceBundle {
m.put("{javax.validation.constraints.NotEmpty.message}", "不能为空");
m.put("{javax.validation.constraints.NotNull.message}", "不能为空");
m.put("{javax.validation.constraints.Size.message}", "至少需要指定一个值");
- m.put("AI system prompt has been saved", "AI 系统提示已保存");
- m.put("Also add below to $HOME/.m2/settings.xml if you want to compile project from command line",
- "如果您想从命令行编译项目,请将以下内容添加到 $HOME/.m2/settings.xml");
- m.put("For CI/CD job, it is more convenient to use a custom settings.xml, for instance via below code in a command step:",
- "对于 CI/CD 任务,使用自定义 settings.xml 更方便,例如通过在命令步骤中使用以下代码:");
- m.put("Login Command", "登录命令");
- m.put("Make sure to log in with an account that has package read permission for the project",
- "确保使用对项目具有包读取权限的账户登录");
- m.put("Nothing changed yet", "尚未更改任何内容");
- m.put("Someone changed file mode since you started editing", "自您开始编辑以来,有人更改了文件模式");
- m.put("Someone changed file type since you started editing", "自您开始编辑以来,有人更改了文件类型");
- m.put("System Prompt", "系统提示");
- m.put("To use this package, add below to project pom.xml", "要使用此包,请将以下内容添加到项目 pom.xml");
+ m.put("All members of entitled groups will be able to access this AI service", "被授权的组的所有成员将能够访问此 AI 服务");
+ m.put("Entitled projects can add the AI user as a pull request reviewer. In this scenario, the AI user executes tasks using its own permissions.",
+ "被授权的项目可以将 AI 用户添加为合并请求的审查者。在这种情况下,AI 用户使用其自身的权限执行任务。");
+ m.put("Entitled projects will be able to access this AI service", "被授权的项目将能够访问此 AI 服务");
+ m.put("Entitled users can interact with the AI user through the chat interface to perform tasks such as understanding codebase, authoring CI/CD spec, or investigating CI/CD job failures. In this mode, the AI user operates with same permissions as the user interacting with it, ignoring permissions assigned to the AI user itself.",
+ "被授权的用户可以通过聊天界面与 AI 用户互动,以执行诸如理解代码库、编写 CI/CD 规范或调查 CI/CD 任务失败等任务。在此模式下,AI 用户以与与其互动的用户相同的权限操作,忽略分配给 AI 用户本身的权限。");
+ m.put("Entitled users can mention the AI user in issue or pull request comments to request assistance. In this case, the AI user executes tasks using its own permissions.",
+ "被授权的用户可以在工单或合并请求评论中提及 AI 用户以请求帮助。在这种情况下,AI 用户使用其自身的权限执行任务。");
+ m.put("Entitled users will be able to access this AI service", "被授权的用户将能够访问此 AI 服务");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/websocket/AiToolExecution.java b/server-core/src/main/java/io/onedev/server/web/websocket/AiToolExecution.java
new file mode 100644
index 0000000000..4e3d205951
--- /dev/null
+++ b/server-core/src/main/java/io/onedev/server/web/websocket/AiToolExecution.java
@@ -0,0 +1,42 @@
+package io.onedev.server.web.websocket;
+
+import java.util.concurrent.CompletableFuture;
+
+import javax.annotation.Nullable;
+
+import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import io.onedev.server.ai.ToolExecutionResult;
+
+public class AiToolExecution implements IWebSocketPushMessage {
+
+ private final String toolName;
+
+ private final JsonNode toolArguments;
+
+ private volatile CompletableFuture<ToolExecutionResult> future;
+
+ public AiToolExecution(String toolName, JsonNode toolArguments) {
+ this.toolName = toolName;
+ this.toolArguments = toolArguments;
+ }
+
+ public String getToolName() {
+ return toolName;
+ }
+
+ public JsonNode getToolArguments() {
+ return toolArguments;
+ }
+
+ @Nullable
+ public CompletableFuture<ToolExecutionResult> getFuture() {
+ return future;
+ }
+
+ public void setFuture(CompletableFuture<ToolExecutionResult> future) {
+ this.future = future;
+ }
+}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/web/websocket/ChatToolExecution.java b/server-core/src/main/java/io/onedev/server/web/websocket/ChatToolExecution.java
deleted file mode 100644
index 1053b8351f..0000000000
--- a/server-core/src/main/java/io/onedev/server/web/websocket/ChatToolExecution.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package io.onedev.server.web.websocket;
-
-import java.util.concurrent.CompletableFuture;
-
-import javax.annotation.Nullable;
-
-import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class ChatToolExecution implements IWebSocketPushMessage {
-
- private final String toolName;
-
- private final JsonNode toolArguments;
-
- private volatile CompletableFuture<Result> executionFuture;
-
- public ChatToolExecution(String toolName, JsonNode toolArguments) {
- this.toolName = toolName;
- this.toolArguments = toolArguments;
- }
-
- public String getToolName() {
- return toolName;
- }
-
- public JsonNode getToolArguments() {
- return toolArguments;
- }
-
- @Nullable
- public CompletableFuture<Result> getExecutionFuture() {
- return executionFuture;
- }
-
- public void setExecutionFuture(CompletableFuture<Result> executionFuture) {
- this.executionFuture = executionFuture;
- }
-
- public static class Result {
-
- private final String content;
-
- private final boolean asSystemMessage;
-
- public Result(String content, boolean asSystemMessage) {
- this.content = content;
- this.asSystemMessage = asSystemMessage;
- }
-
- public String getContent() {
- return content;
- }
-
- public boolean isAsSystemMessage() {
- return asSystemMessage;
- }
-
- }
-}
\ No newline at end of file
diff --git a/server-ee b/server-ee
index 100802d5f6..6c0f27eafc 160000
--- a/server-ee
+++ b/server-ee
@@ -1 +1 @@
-Subproject commit 100802d5f6305cec8fd86b42b4860f288107c084
+Subproject commit 6c0f27eafce2e93d52de32ec4b5b1e564f093068
diff --git a/server-plugin/pom.xml b/server-plugin/pom.xml
index b810d0797c..844733b37a 100644
--- a/server-plugin/pom.xml
+++ b/server-plugin/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-archetype/pom.xml b/server-plugin/server-plugin-archetype/pom.xml
index 7aa2c6a45c..0cab38dbf8 100644
--- a/server-plugin/server-plugin-archetype/pom.xml
+++ b/server-plugin/server-plugin-archetype/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<build>
<resources>
diff --git a/server-plugin/server-plugin-authenticator-ldap/pom.xml b/server-plugin/server-plugin-authenticator-ldap/pom.xml
index 05ee004114..1be449ded4 100644
--- a/server-plugin/server-plugin-authenticator-ldap/pom.xml
+++ b/server-plugin/server-plugin-authenticator-ldap/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.authenticator.ldap.LdapModule</moduleClass>
diff --git a/server-plugin/server-plugin-buildspec-bazel/pom.xml b/server-plugin/server-plugin-buildspec-bazel/pom.xml
index 1f2f52d1f4..57d8f719cb 100644
--- a/server-plugin/server-plugin-buildspec-bazel/pom.xml
+++ b/server-plugin/server-plugin-buildspec-bazel/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.buildspec.bazel.BazelModule</moduleClass>
diff --git a/server-plugin/server-plugin-buildspec-cmake/pom.xml b/server-plugin/server-plugin-buildspec-cmake/pom.xml
index ce783ef6ed..a5c596ee51 100644
--- a/server-plugin/server-plugin-buildspec-cmake/pom.xml
+++ b/server-plugin/server-plugin-buildspec-cmake/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-buildspec-dotnet/pom.xml b/server-plugin/server-plugin-buildspec-dotnet/pom.xml
index b170036bd7..6bd39911d2 100644
--- a/server-plugin/server-plugin-buildspec-dotnet/pom.xml
+++ b/server-plugin/server-plugin-buildspec-dotnet/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-buildspec-golang/pom.xml b/server-plugin/server-plugin-buildspec-golang/pom.xml
index 7e2d7fb63e..f205094792 100644
--- a/server-plugin/server-plugin-buildspec-golang/pom.xml
+++ b/server-plugin/server-plugin-buildspec-golang/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-buildspec-gradle/pom.xml b/server-plugin/server-plugin-buildspec-gradle/pom.xml
index 50bbe538bc..2ecb0d5262 100644
--- a/server-plugin/server-plugin-buildspec-gradle/pom.xml
+++ b/server-plugin/server-plugin-buildspec-gradle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-buildspec-maven/pom.xml b/server-plugin/server-plugin-buildspec-maven/pom.xml
index 73c2a4070f..4dfb4e7305 100644
--- a/server-plugin/server-plugin-buildspec-maven/pom.xml
+++ b/server-plugin/server-plugin-buildspec-maven/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-buildspec-node/pom.xml b/server-plugin/server-plugin-buildspec-node/pom.xml
index 5a01ca4e76..8f326abc29 100644
--- a/server-plugin/server-plugin-buildspec-node/pom.xml
+++ b/server-plugin/server-plugin-buildspec-node/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.buildspec.node.NodePluginModule</moduleClass>
diff --git a/server-plugin/server-plugin-buildspec-python/pom.xml b/server-plugin/server-plugin-buildspec-python/pom.xml
index adec252e12..881fdaffe3 100644
--- a/server-plugin/server-plugin-buildspec-python/pom.xml
+++ b/server-plugin/server-plugin-buildspec-python/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-buildspec-rust/pom.xml b/server-plugin/server-plugin-buildspec-rust/pom.xml
index e6568a2a43..6b2428837f 100644
--- a/server-plugin/server-plugin-buildspec-rust/pom.xml
+++ b/server-plugin/server-plugin-buildspec-rust/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-executor-kubernetes/pom.xml b/server-plugin/server-plugin-executor-kubernetes/pom.xml
index 2a38f2637b..f92af66f40 100644
--- a/server-plugin/server-plugin-executor-kubernetes/pom.xml
+++ b/server-plugin/server-plugin-executor-kubernetes/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.executor.kubernetes.KubernetesModule</moduleClass>
diff --git a/server-plugin/server-plugin-executor-remotedocker/pom.xml b/server-plugin/server-plugin-executor-remotedocker/pom.xml
index 480fec1e25..13f1009031 100644
--- a/server-plugin/server-plugin-executor-remotedocker/pom.xml
+++ b/server-plugin/server-plugin-executor-remotedocker/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-executor-remoteshell/pom.xml b/server-plugin/server-plugin-executor-remoteshell/pom.xml
index a4381b576c..7c35a4d7ef 100644
--- a/server-plugin/server-plugin-executor-remoteshell/pom.xml
+++ b/server-plugin/server-plugin-executor-remoteshell/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-executor-serverdocker/pom.xml b/server-plugin/server-plugin-executor-serverdocker/pom.xml
index 9602d59720..3dbc9d406f 100644
--- a/server-plugin/server-plugin-executor-serverdocker/pom.xml
+++ b/server-plugin/server-plugin-executor-serverdocker/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.executor.serverdocker.ServerDockerModule</moduleClass>
diff --git a/server-plugin/server-plugin-executor-servershell/pom.xml b/server-plugin/server-plugin-executor-servershell/pom.xml
index f912909ba4..4e4d0915f2 100644
--- a/server-plugin/server-plugin-executor-servershell/pom.xml
+++ b/server-plugin/server-plugin-executor-servershell/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.executor.servershell.ServerShellModule</moduleClass>
diff --git a/server-plugin/server-plugin-import-bitbucketcloud/pom.xml b/server-plugin/server-plugin-import-bitbucketcloud/pom.xml
index d8ab0c36bc..9fa5bd4e6e 100644
--- a/server-plugin/server-plugin-import-bitbucketcloud/pom.xml
+++ b/server-plugin/server-plugin-import-bitbucketcloud/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.imports.bitbucketcloud.BitbucketModule</moduleClass>
diff --git a/server-plugin/server-plugin-import-gitea/pom.xml b/server-plugin/server-plugin-import-gitea/pom.xml
index 82bf788417..3022a6c47b 100644
--- a/server-plugin/server-plugin-import-gitea/pom.xml
+++ b/server-plugin/server-plugin-import-gitea/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.imports.gitea.GiteaModule</moduleClass>
diff --git a/server-plugin/server-plugin-import-github/pom.xml b/server-plugin/server-plugin-import-github/pom.xml
index 49e532ab01..0117e3e0d0 100644
--- a/server-plugin/server-plugin-import-github/pom.xml
+++ b/server-plugin/server-plugin-import-github/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.imports.github.GitHubModule</moduleClass>
diff --git a/server-plugin/server-plugin-import-gitlab/pom.xml b/server-plugin/server-plugin-import-gitlab/pom.xml
index e0fc6f5951..20e270987e 100644
--- a/server-plugin/server-plugin-import-gitlab/pom.xml
+++ b/server-plugin/server-plugin-import-gitlab/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.imports.gitlab.GitLabModule</moduleClass>
diff --git a/server-plugin/server-plugin-import-jiracloud/pom.xml b/server-plugin/server-plugin-import-jiracloud/pom.xml
index dbbc3f810c..8ec248078c 100644
--- a/server-plugin/server-plugin-import-jiracloud/pom.xml
+++ b/server-plugin/server-plugin-import-jiracloud/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.imports.jiracloud.JiraModule</moduleClass>
diff --git a/server-plugin/server-plugin-import-url/pom.xml b/server-plugin/server-plugin-import-url/pom.xml
index eed9f27852..a6b8dfe167 100644
--- a/server-plugin/server-plugin-import-url/pom.xml
+++ b/server-plugin/server-plugin-import-url/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.imports.url.UrlModule</moduleClass>
diff --git a/server-plugin/server-plugin-import-youtrack/pom.xml b/server-plugin/server-plugin-import-youtrack/pom.xml
index 42206f0f93..d02a90e265 100644
--- a/server-plugin/server-plugin-import-youtrack/pom.xml
+++ b/server-plugin/server-plugin-import-youtrack/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.imports.youtrack.YouTrackModule</moduleClass>
diff --git a/server-plugin/server-plugin-mail-gmail/pom.xml b/server-plugin/server-plugin-mail-gmail/pom.xml
index 9b0fbffcad..50f592556b 100644
--- a/server-plugin/server-plugin-mail-gmail/pom.xml
+++ b/server-plugin/server-plugin-mail-gmail/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.mail.gmail.GmailModule</moduleClass>
diff --git a/server-plugin/server-plugin-mail-office365/pom.xml b/server-plugin/server-plugin-mail-office365/pom.xml
index 18cecdc1d2..ca53083603 100644
--- a/server-plugin/server-plugin-mail-office365/pom.xml
+++ b/server-plugin/server-plugin-mail-office365/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.mail.office365.Office365Module</moduleClass>
diff --git a/server-plugin/server-plugin-mail-smtpimap/pom.xml b/server-plugin/server-plugin-mail-smtpimap/pom.xml
index 275b6f4512..30332a50ea 100644
--- a/server-plugin/server-plugin-mail-smtpimap/pom.xml
+++ b/server-plugin/server-plugin-mail-smtpimap/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.mail.smtpimap.SmtpImapModule</moduleClass>
diff --git a/server-plugin/server-plugin-notification-discord/pom.xml b/server-plugin/server-plugin-notification-discord/pom.xml
index 0c79bbfd60..15cb5be5cf 100644
--- a/server-plugin/server-plugin-notification-discord/pom.xml
+++ b/server-plugin/server-plugin-notification-discord/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.notification.discord.DiscordModule</moduleClass>
diff --git a/server-plugin/server-plugin-notification-ntfy/pom.xml b/server-plugin/server-plugin-notification-ntfy/pom.xml
index e8b5882819..4c2ab2a690 100644
--- a/server-plugin/server-plugin-notification-ntfy/pom.xml
+++ b/server-plugin/server-plugin-notification-ntfy/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.notification.ntfy.NtfyModule</moduleClass>
diff --git a/server-plugin/server-plugin-notification-slack/pom.xml b/server-plugin/server-plugin-notification-slack/pom.xml
index 84a2227c53..9fcf7d527c 100644
--- a/server-plugin/server-plugin-notification-slack/pom.xml
+++ b/server-plugin/server-plugin-notification-slack/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.notification.slack.SlackModule</moduleClass>
diff --git a/server-plugin/server-plugin-pack-container/pom.xml b/server-plugin/server-plugin-pack-container/pom.xml
index cd9ae6d7e6..9e18029a8c 100644
--- a/server-plugin/server-plugin-pack-container/pom.xml
+++ b/server-plugin/server-plugin-pack-container/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-pack-gem/pom.xml b/server-plugin/server-plugin-pack-gem/pom.xml
index a2f5ad9bae..bd49892d96 100644
--- a/server-plugin/server-plugin-pack-gem/pom.xml
+++ b/server-plugin/server-plugin-pack-gem/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-pack-helm/pom.xml b/server-plugin/server-plugin-pack-helm/pom.xml
index 6d8b3274e4..10c2692f17 100644
--- a/server-plugin/server-plugin-pack-helm/pom.xml
+++ b/server-plugin/server-plugin-pack-helm/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-pack-maven/pom.xml b/server-plugin/server-plugin-pack-maven/pom.xml
index c8b60fb5e0..fbaa07f3fc 100644
--- a/server-plugin/server-plugin-pack-maven/pom.xml
+++ b/server-plugin/server-plugin-pack-maven/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-pack-npm/pom.xml b/server-plugin/server-plugin-pack-npm/pom.xml
index 1ea4a4c0ee..4afc3de49f 100644
--- a/server-plugin/server-plugin-pack-npm/pom.xml
+++ b/server-plugin/server-plugin-pack-npm/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-pack-nuget/pom.xml b/server-plugin/server-plugin-pack-nuget/pom.xml
index 3403b519ce..85afecf78c 100644
--- a/server-plugin/server-plugin-pack-nuget/pom.xml
+++ b/server-plugin/server-plugin-pack-nuget/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-pack-pypi/pom.xml b/server-plugin/server-plugin-pack-pypi/pom.xml
index df092002c7..64ab18b0c3 100644
--- a/server-plugin/server-plugin-pack-pypi/pom.xml
+++ b/server-plugin/server-plugin-pack-pypi/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-checkstyle/pom.xml b/server-plugin/server-plugin-report-checkstyle/pom.xml
index de4208614f..672fce6536 100644
--- a/server-plugin/server-plugin-report-checkstyle/pom.xml
+++ b/server-plugin/server-plugin-report-checkstyle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-clippy/pom.xml b/server-plugin/server-plugin-report-clippy/pom.xml
index ee613b9528..af224dc424 100644
--- a/server-plugin/server-plugin-report-clippy/pom.xml
+++ b/server-plugin/server-plugin-report-clippy/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-clover/pom.xml b/server-plugin/server-plugin-report-clover/pom.xml
index 73ef18fbe9..2ebc51d9a7 100644
--- a/server-plugin/server-plugin-report-clover/pom.xml
+++ b/server-plugin/server-plugin-report-clover/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-cobertura/pom.xml b/server-plugin/server-plugin-report-cobertura/pom.xml
index c3c5dc88c0..c4a9a7d8af 100644
--- a/server-plugin/server-plugin-report-cobertura/pom.xml
+++ b/server-plugin/server-plugin-report-cobertura/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-coverage/pom.xml b/server-plugin/server-plugin-report-coverage/pom.xml
index 22e68ea305..7f283e7bb4 100644
--- a/server-plugin/server-plugin-report-coverage/pom.xml
+++ b/server-plugin/server-plugin-report-coverage/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.report.coverage.CoverageModule</moduleClass>
diff --git a/server-plugin/server-plugin-report-cpd/pom.xml b/server-plugin/server-plugin-report-cpd/pom.xml
index 3e9548ffdb..0e064c519d 100644
--- a/server-plugin/server-plugin-report-cpd/pom.xml
+++ b/server-plugin/server-plugin-report-cpd/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-cppcheck/pom.xml b/server-plugin/server-plugin-report-cppcheck/pom.xml
index 958881032e..77a995f56e 100644
--- a/server-plugin/server-plugin-report-cppcheck/pom.xml
+++ b/server-plugin/server-plugin-report-cppcheck/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-gtest/pom.xml b/server-plugin/server-plugin-report-gtest/pom.xml
index 9672661489..655e85a222 100644
--- a/server-plugin/server-plugin-report-gtest/pom.xml
+++ b/server-plugin/server-plugin-report-gtest/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-html/pom.xml b/server-plugin/server-plugin-report-html/pom.xml
index f6ff210194..f5766b99b4 100644
--- a/server-plugin/server-plugin-report-html/pom.xml
+++ b/server-plugin/server-plugin-report-html/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.report.html.HtmlModule</moduleClass>
diff --git a/server-plugin/server-plugin-report-jacoco/pom.xml b/server-plugin/server-plugin-report-jacoco/pom.xml
index 562ca80020..3f789f2fac 100644
--- a/server-plugin/server-plugin-report-jacoco/pom.xml
+++ b/server-plugin/server-plugin-report-jacoco/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-jest/pom.xml b/server-plugin/server-plugin-report-jest/pom.xml
index 823acbae24..c55b43a74c 100644
--- a/server-plugin/server-plugin-report-jest/pom.xml
+++ b/server-plugin/server-plugin-report-jest/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-junit/pom.xml b/server-plugin/server-plugin-report-junit/pom.xml
index 0cf9034e9a..4d609fcfcb 100644
--- a/server-plugin/server-plugin-report-junit/pom.xml
+++ b/server-plugin/server-plugin-report-junit/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-markdown/pom.xml b/server-plugin/server-plugin-report-markdown/pom.xml
index 20279afa96..87e710a1ea 100644
--- a/server-plugin/server-plugin-report-markdown/pom.xml
+++ b/server-plugin/server-plugin-report-markdown/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.report.markdown.MarkdownModule</moduleClass>
diff --git a/server-plugin/server-plugin-report-mypy/pom.xml b/server-plugin/server-plugin-report-mypy/pom.xml
index a842f3def8..319e4a6a9b 100644
--- a/server-plugin/server-plugin-report-mypy/pom.xml
+++ b/server-plugin/server-plugin-report-mypy/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-pmd/pom.xml b/server-plugin/server-plugin-report-pmd/pom.xml
index 60f3648e17..12cbc4a5a5 100644
--- a/server-plugin/server-plugin-report-pmd/pom.xml
+++ b/server-plugin/server-plugin-report-pmd/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-problem/pom.xml b/server-plugin/server-plugin-report-problem/pom.xml
index e9b0f2dd2c..d76f70ec93 100644
--- a/server-plugin/server-plugin-report-problem/pom.xml
+++ b/server-plugin/server-plugin-report-problem/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.report.problem.ProblemModule</moduleClass>
diff --git a/server-plugin/server-plugin-report-pylint/pom.xml b/server-plugin/server-plugin-report-pylint/pom.xml
index 9602865e87..13e688ea38 100644
--- a/server-plugin/server-plugin-report-pylint/pom.xml
+++ b/server-plugin/server-plugin-report-pylint/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-roslynator/pom.xml b/server-plugin/server-plugin-report-roslynator/pom.xml
index 2c77ba80c8..94a1206c38 100644
--- a/server-plugin/server-plugin-report-roslynator/pom.xml
+++ b/server-plugin/server-plugin-report-roslynator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-ruff/pom.xml b/server-plugin/server-plugin-report-ruff/pom.xml
index 509d4c7792..efa2d828eb 100644
--- a/server-plugin/server-plugin-report-ruff/pom.xml
+++ b/server-plugin/server-plugin-report-ruff/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-spotbugs/pom.xml b/server-plugin/server-plugin-report-spotbugs/pom.xml
index 7fb9719c3b..ef557a135f 100644
--- a/server-plugin/server-plugin-report-spotbugs/pom.xml
+++ b/server-plugin/server-plugin-report-spotbugs/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-trx/pom.xml b/server-plugin/server-plugin-report-trx/pom.xml
index f91f5c4eb2..4838db4780 100644
--- a/server-plugin/server-plugin-report-trx/pom.xml
+++ b/server-plugin/server-plugin-report-trx/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-report-unittest/pom.xml b/server-plugin/server-plugin-report-unittest/pom.xml
index 12f4d61c33..bd49a69fe2 100644
--- a/server-plugin/server-plugin-report-unittest/pom.xml
+++ b/server-plugin/server-plugin-report-unittest/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.report.unittest.UnitTestModule</moduleClass>
diff --git a/server-plugin/server-plugin-sso-discord/pom.xml b/server-plugin/server-plugin-sso-discord/pom.xml
index f41a78bbf2..763d2b1310 100644
--- a/server-plugin/server-plugin-sso-discord/pom.xml
+++ b/server-plugin/server-plugin-sso-discord/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.sso.discord.DiscordModule</moduleClass>
diff --git a/server-plugin/server-plugin-sso-openid/pom.xml b/server-plugin/server-plugin-sso-openid/pom.xml
index 37b311079d..96b3f26173 100644
--- a/server-plugin/server-plugin-sso-openid/pom.xml
+++ b/server-plugin/server-plugin-sso-openid/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.sso.openid.OpenIdModule</moduleClass>
diff --git a/server-product/pom.xml b/server-product/pom.xml
index 80e1ad91c7..8153c59728 100644
--- a/server-product/pom.xml
+++ b/server-product/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server</artifactId>
- <version>13.1.7</version>
+ <version>14.0.0</version>
</parent>
<dependencies>
<dependency>