The Unified and Autonomous Development Platform
wip: AI user
Robin Shenb9ee6f987b30
diff --git a/pom.xml b/pom.xmlindex d46068e026..938d3b8c64 100644--- a/pom.xml+++ b/pom.xml@@ -627,6 +627,11 @@<artifactId>fastexcel</artifactId><version>0.15.7</version></dependency>+ <dependency>+ <groupId>dev.langchain4j</groupId>+ <artifactId>langchain4j-core</artifactId>+ <version>${langchain4j.version}</version>+ </dependency><dependency><groupId>dev.langchain4j</groupId><artifactId>langchain4j-open-ai</artifactId>diff --git a/server-core/pom.xml b/server-core/pom.xmlindex bc9fa38541..dcb83173d8 100644--- a/server-core/pom.xml+++ b/server-core/pom.xml@@ -383,6 +383,10 @@<groupId>dev.langchain4j</groupId><artifactId>langchain4j-open-ai</artifactId></dependency>+ <dependency>+ <groupId>dev.langchain4j</groupId>+ <artifactId>langchain4j-core</artifactId>+ </dependency></dependencies><properties><kotlin.version>1.9.23</kotlin.version>diff --git a/server-core/src/main/java/dev/langchain4j/internal/RetryUtils.java b/server-core/src/main/java/dev/langchain4j/internal/RetryUtils.javanew file mode 100644index 0000000000..0934fd83cd--- /dev/null+++ b/server-core/src/main/java/dev/langchain4j/internal/RetryUtils.java@@ -0,0 +1,327 @@+package dev.langchain4j.internal;++import java.util.Random;+import java.util.concurrent.Callable;++import org.slf4j.Logger;+import org.slf4j.LoggerFactory;++import dev.langchain4j.Internal;+import dev.langchain4j.exception.LangChain4jException;+import dev.langchain4j.exception.NonRetriableException;+import io.onedev.server.exception.ExceptionUtils;++/**+ * Utility class for retrying actions.+ */+@Internal+public final class RetryUtils {++ private static final Random RANDOM = new Random();++ private RetryUtils() {}++ private static final Logger log = LoggerFactory.getLogger(RetryUtils.class);++ /**+ * This method returns a RetryPolicy.Builder.+ *+ * @return A RetryPolicy.Builder.+ */+ public static RetryPolicy.Builder retryPolicyBuilder() {+ return new RetryPolicy.Builder();+ }++ /**+ * This class encapsulates a retry policy.+ */+ public static final class RetryPolicy {++ /**+ * This class encapsulates a retry policy builder.+ */+ public static final class Builder {++ private int maxRetries = 2;+ private int delayMillis = 1000;+ private double jitterScale = 0.2;+ private double backoffExp = 1.5;++ /**+ * Construct a RetryPolicy.Builder.+ */+ public Builder() {}++ /**+ * Sets the default maximum number of retries.+ *+ * @param maxRetries The maximum number of retries.+ * The action can be executed up to {@code maxRetries + 1} times.+ * @return {@code this}+ */+ public Builder maxRetries(int maxRetries) {+ this.maxRetries = maxRetries;+ return this;+ }++ /**+ * Sets the base delay in milliseconds.+ *+ * <p>The delay is calculated as follows:+ * <ol>+ * <li>Calculate the raw delay in milliseconds as+ * {@code delayMillis * Math.pow(backoffExp, retry)}.</li>+ * <li>Calculate the jitter delay in milliseconds as+ * {@code rawDelayMs + rand.nextInt((int) (rawDelayMs * jitterScale))}.</li>+ * <li>Sleep for the jitter delay in milliseconds.</li>+ * </ol>+ *+ * @param delayMillis The delay in milliseconds.+ * @return {@code this}+ */+ public Builder delayMillis(int delayMillis) {+ this.delayMillis = delayMillis;+ return this;+ }++ /**+ * Sets the jitter scale.+ *+ * <p>The jitter delay in milliseconds is calculated as+ * {@code rawDelayMs + rand.nextInt((int) (rawDelayMs * jitterScale))}.+ *+ * @param jitterScale The jitter scale.+ * @return {@code this}+ */+ public Builder jitterScale(double jitterScale) {+ this.jitterScale = jitterScale;+ return this;+ }++ /**+ * Sets the backoff exponent.+ *+ * @param backoffExp The backoff exponent.+ * @return {@code this}+ */+ public Builder backoffExp(double backoffExp) {+ this.backoffExp = backoffExp;+ return this;+ }++ /**+ * Builds a RetryPolicy.+ *+ * @return A RetryPolicy.+ */+ public RetryPolicy build() {+ return new RetryPolicy(maxRetries, delayMillis, jitterScale, backoffExp);+ }+ }++ private final int maxRetries;+ private final int delayMillis;+ private final double jitterScale;+ private final double backoffExp;++ /**+ * Construct a RetryPolicy.+ *+ * @param maxRetries The maximum number of retries.+ * The action can be executed up to {@code maxRetries + 1} times.+ * @param delayMillis The delay in milliseconds.+ * @param jitterScale The jitter scale.+ * @param backoffExp The backoff exponent.+ */+ public RetryPolicy(int maxRetries, int delayMillis, double jitterScale, double backoffExp) {+ this.maxRetries = maxRetries;+ this.delayMillis = delayMillis;+ this.jitterScale = jitterScale;+ this.backoffExp = backoffExp;+ }++ /**+ * This method returns the raw delay in milliseconds after a given retry.+ *+ * @param retry The retry number.+ * @return The raw delay in milliseconds.+ */+ public double rawDelayMs(int retry) {+ return delayMillis * Math.pow(backoffExp, retry);+ }++ /**+ * This method returns the jitter delay in milliseconds after a given retry.+ *+ * @param retry The retry number.+ * @return The jitter delay in milliseconds.+ */+ public int jitterDelayMillis(int retry) {+ double delay = rawDelayMs(retry);+ double jitter = delay * jitterScale;+ return (int) (delay + RANDOM.nextInt((int) jitter));+ }++ /**+ * This method sleeps after a given retry.+ *+ * @param retry The retry number.+ */+ @JacocoIgnoreCoverageGenerated+ public void sleep(int retry) {+ try {+ Thread.sleep(jitterDelayMillis(retry));+ } catch (InterruptedException ignored) {+ // pass+ }+ }++ /**+ * This method attempts to execute a given action up to 3 times with an exponential backoff.+ * If the action fails on all attempts, it throws a RuntimeException.+ *+ * @param action The action to be executed.+ * @param <T> The type of the result of the action.+ * @return The result of the action if it is successful.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public <T> T withRetry(Callable<T> action) {+ return withRetry(action, maxRetries);+ }++ /**+ * This method attempts to execute a given action up to a specified number of times with an exponential backoff.+ * If the action fails on all attempts, it throws a RuntimeException.+ *+ * @param action The action to be executed.+ * @param maxRetries The maximum number of retries.+ * The action can be executed up to {@code maxRetries + 1} times.+ * @param <T> The type of the result of the action.+ * @return The result of the action if it is successful.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public <T> T withRetry(Callable<T> action, int maxRetries) {+ int retry = 0;+ while (true) {+ try {+ return action.call();+ } catch (NonRetriableException e) {+ throw e;+ } catch (Exception e) {+ if (retry >= maxRetries || ExceptionUtils.find(e, InterruptedException.class) != null) {+ throw e instanceof RuntimeException re ? re : new LangChain4jException(e);+ }++ log.warn(+ "A retriable exception occurred. Remaining retries: %s of %s"+ .formatted(maxRetries - retry, maxRetries),+ e);++ sleep(retry);+ }+ retry++;+ }+ }+ }++ /**+ * Default retry policy used by {@link #withRetry(Callable)}.+ */+ public static final RetryPolicy DEFAULT_RETRY_POLICY = retryPolicyBuilder()+ .maxRetries(2)+ .delayMillis(500)+ .jitterScale(0.2)+ .backoffExp(1.5)+ .build();++ /**+ * This method attempts to execute a given action up to 3 times with an exponential backoff.+ * If the action fails on all attempts, it throws a RuntimeException.+ *+ * @param action The action to be executed.+ * @param <T> The type of the result of the action.+ * @return The result of the action if it is successful.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public static <T> T withRetry(Callable<T> action) {+ return DEFAULT_RETRY_POLICY.withRetry(action);+ }++ /**+ * This method attempts to execute a given action up to a specified number of times with an exponential backoff.+ * If the action fails on all attempts, it throws a RuntimeException.+ *+ * @param action The action to be executed.+ * @param maxRetries The maximum number of retries.+ * The action can be executed up to {@code maxRetries + 1} times.+ * @param <T> The type of the result of the action.+ * @return The result of the action if it is successful.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public static <T> T withRetry(Callable<T> action, int maxRetries) {+ return DEFAULT_RETRY_POLICY.withRetry(action, maxRetries);+ }++ /**+ * This method attempts to execute a given action up to a specified number of times with an exponential backoff.+ * If the action fails on all attempts, it throws a RuntimeException.+ *+ * @param action The action to be executed.+ * @param maxRetries The maximum number of retries.+ * The action can be executed up to {@code maxRetries + 1} times.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public static void withRetry(Runnable action, int maxRetries) {+ DEFAULT_RETRY_POLICY.withRetry(+ () -> {+ action.run();+ return null;+ },+ maxRetries);+ }++ /**+ * This method attempts to execute a given action up to 3 times with an exponential backoff.+ * If the action fails, the Exception causing the failure will be mapped with the default {@link ExceptionMapper}.+ *+ * @param action The action to be executed.+ * @param <T> The type of the result of the action.+ * @return The result of the action if it is successful.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public static <T> T withRetryMappingExceptions(Callable<T> action) {+ return withRetry(() -> ExceptionMapper.DEFAULT.withExceptionMapper(action));+ }++ /**+ * This method attempts to execute a given action up to a specified number of times with an exponential backoff.+ * If the action fails, the Exception causing the failure will be mapped with the default {@link ExceptionMapper}.+ *+ * @param action The action to be executed.+ * @param maxRetries The maximum number of retries.+ * The action can be executed up to {@code maxRetries + 1} times.+ * @param <T> The type of the result of the action.+ * @return The result of the action if it is successful.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public static <T> T withRetryMappingExceptions(Callable<T> action, int maxRetries) {+ return withRetryMappingExceptions(action, maxRetries, ExceptionMapper.DEFAULT);+ }++ /**+ * This method attempts to execute a given action up to a specified number of times with an exponential backoff.+ * If the action fails, the Exception causing the failure will be mapped with the provided {@link ExceptionMapper}.+ *+ * @param action The action to be executed.+ * @param maxRetries The maximum number of retries.+ * The action can be executed up to {@code maxRetries + 1} times.+ * @param exceptionMapper The ExceptionMapper used to translate the exception that caused the failure of the action invocation.+ * @param <T> The type of the result of the action.+ * @return The result of the action if it is successful.+ * @throws RuntimeException if the action fails on all attempts.+ */+ public static <T> T withRetryMappingExceptions(+ Callable<T> action, int maxRetries, ExceptionMapper exceptionMapper) {+ return withRetry(() -> exceptionMapper.withExceptionMapper(action), maxRetries);+ }+}diff --git a/server-core/src/main/java/io/onedev/server/CoreModule.java b/server-core/src/main/java/io/onedev/server/CoreModule.javaindex 8071e254f8..90e25a57d5 100644--- a/server-core/src/main/java/io/onedev/server/CoreModule.java+++ b/server-core/src/main/java/io/onedev/server/CoreModule.java@@ -197,6 +197,7 @@ import io.onedev.server.service.BuildMetricService;import io.onedev.server.service.BuildParamService;import io.onedev.server.service.BuildQueryPersonalizationService;import io.onedev.server.service.BuildService;+import io.onedev.server.service.ChatService;import io.onedev.server.service.CodeCommentMentionService;import io.onedev.server.service.CodeCommentQueryPersonalizationService;import io.onedev.server.service.CodeCommentReplyService;@@ -212,6 +213,7 @@ import io.onedev.server.service.EmailAddressService;import io.onedev.server.service.GitLfsLockService;import io.onedev.server.service.GpgKeyService;import io.onedev.server.service.GroupAuthorizationService;+import io.onedev.server.service.GroupEntitlementService;import io.onedev.server.service.GroupService;import io.onedev.server.service.IssueAuthorizationService;import io.onedev.server.service.IssueChangeService;@@ -243,6 +245,7 @@ import io.onedev.server.service.PackLabelService;import io.onedev.server.service.PackQueryPersonalizationService;import io.onedev.server.service.PackService;import io.onedev.server.service.PendingSuggestionApplyService;+import io.onedev.server.service.ProjectEntitlementService;import io.onedev.server.service.ProjectLabelService;import io.onedev.server.service.ProjectLastEventDateService;import io.onedev.server.service.ProjectService;@@ -269,6 +272,7 @@ import io.onedev.server.service.SsoAccountService;import io.onedev.server.service.SsoProviderService;import io.onedev.server.service.StopwatchService;import io.onedev.server.service.UserAuthorizationService;+import io.onedev.server.service.UserEntitlementService;import io.onedev.server.service.UserInvitationService;import io.onedev.server.service.UserService;import io.onedev.server.service.impl.DefaultAccessTokenAuthorizationService;@@ -285,6 +289,7 @@ import io.onedev.server.service.impl.DefaultBuildMetricService;import io.onedev.server.service.impl.DefaultBuildParamService;import io.onedev.server.service.impl.DefaultBuildQueryPersonalizationService;import io.onedev.server.service.impl.DefaultBuildService;+import io.onedev.server.service.impl.DefaultChatService;import io.onedev.server.service.impl.DefaultCodeCommentMentionService;import io.onedev.server.service.impl.DefaultCodeCommentQueryPersonalizationService;import io.onedev.server.service.impl.DefaultCodeCommentReplyService;@@ -300,6 +305,7 @@ import io.onedev.server.service.impl.DefaultEmailAddressService;import io.onedev.server.service.impl.DefaultGitLfsLockService;import io.onedev.server.service.impl.DefaultGpgKeyService;import io.onedev.server.service.impl.DefaultGroupAuthorizationService;+import io.onedev.server.service.impl.DefaultGroupEntitlementService;import io.onedev.server.service.impl.DefaultGroupService;import io.onedev.server.service.impl.DefaultIssueAuthorizationService;import io.onedev.server.service.impl.DefaultIssueChangeService;@@ -331,6 +337,7 @@ import io.onedev.server.service.impl.DefaultPackLabelService;import io.onedev.server.service.impl.DefaultPackQueryPersonalizationService;import io.onedev.server.service.impl.DefaultPackService;import io.onedev.server.service.impl.DefaultPendingSuggestionApplyService;+import io.onedev.server.service.impl.DefaultProjectEntitlementService;import io.onedev.server.service.impl.DefaultProjectLabelService;import io.onedev.server.service.impl.DefaultProjectLastEventDateService;import io.onedev.server.service.impl.DefaultProjectService;@@ -357,6 +364,7 @@ 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.DefaultUserAuthorizationService;+import io.onedev.server.service.impl.DefaultUserEntitlementService;import io.onedev.server.service.impl.DefaultUserInvitationService;import io.onedev.server.service.impl.DefaultUserService;import io.onedev.server.ssh.CommandCreator;@@ -393,6 +401,7 @@ import io.onedev.server.web.DefaultUrlService;import io.onedev.server.web.DefaultWicketFilter;import io.onedev.server.web.DefaultWicketServlet;import io.onedev.server.web.ResourcePackScopeContribution;+import io.onedev.server.web.SessionListener;import io.onedev.server.web.UrlService;import io.onedev.server.web.WebApplication;import io.onedev.server.web.avatar.AvatarService;@@ -600,7 +609,11 @@ public class CoreModule extends AbstractPluginModule {bind(PullRequestDescriptionRevisionService.class).to(DefaultPullRequestDescriptionRevisionService.class);bind(SsoProviderService.class).to(DefaultSsoProviderService.class);bind(SsoAccountService.class).to(DefaultSsoAccountService.class);+ bind(ChatService.class).to(DefaultChatService.class);bind(BaseAuthorizationService.class).to(DefaultBaseAuthorizationService.class);+ bind(GroupEntitlementService.class).to(DefaultGroupEntitlementService.class);+ bind(UserEntitlementService.class).to(DefaultUserEntitlementService.class);+ bind(ProjectEntitlementService.class).to(DefaultProjectEntitlementService.class);bind(WebHookManager.class);@@ -719,6 +732,9 @@ public class CoreModule extends AbstractPluginModule {contributeFromPackage(ExceptionHandler.class, ConstraintViolationExceptionHandler.class);contributeFromPackage(ExceptionHandler.class, PageExpiredExceptionHandler.class);contributeFromPackage(ExceptionHandler.class, WebApplicationExceptionHandler.class);++ contribute(SessionListener.class, DefaultChatService.class);+ contribute(SessionListener.class, DefaultWebSocketService.class);bind(UrlService.class).to(DefaultUrlService.class);bind(CodeCommentEventBroadcaster.class);diff --git a/server-core/src/main/java/io/onedev/server/data/DefaultDataService.java b/server-core/src/main/java/io/onedev/server/data/DefaultDataService.javaindex 96013e5d81..a5d01ffb7b 100644--- a/server-core/src/main/java/io/onedev/server/data/DefaultDataService.java+++ b/server-core/src/main/java/io/onedev/server/data/DefaultDataService.java@@ -2,7 +2,7 @@ package io.onedev.server.data;import static com.google.common.base.Throwables.getStackTraceAsString;import static io.onedev.server.model.User.PROP_NOTIFY_OWN_EVENTS;-import static io.onedev.server.model.User.PROP_SERVICE_ACCOUNT;+import static io.onedev.server.model.User.PROP_TYPE;import static io.onedev.server.model.support.administration.SystemSetting.PROP_CURL_LOCATION;import static io.onedev.server.model.support.administration.SystemSetting.PROP_DISABLE_AUTO_UPDATE_CHECK;import static io.onedev.server.model.support.administration.SystemSetting.PROP_GIT_LOCATION;@@ -92,7 +92,7 @@ import io.onedev.server.model.Role;import io.onedev.server.model.Setting;import io.onedev.server.model.Setting.Key;import io.onedev.server.model.User;-import io.onedev.server.model.support.administration.AISetting;+import io.onedev.server.model.support.administration.AiSetting;import io.onedev.server.model.support.administration.AgentSetting;import io.onedev.server.model.support.administration.AlertSetting;import io.onedev.server.model.support.administration.AuditSetting;@@ -674,7 +674,7 @@ public class DefaultDataService implements DataService, Serializable {if (validator.validate(bean).isEmpty()) {createRoot(bean);} else {- manualConfigs.add(new ManualConfig("Create Administrator Account", null, bean, Sets.newHashSet(PROP_SERVICE_ACCOUNT, PROP_NOTIFY_OWN_EVENTS)) {+ manualConfigs.add(new ManualConfig("Create Administrator Account", null, bean, Sets.newHashSet(PROP_TYPE, PROP_NOTIFY_OWN_EVENTS)) {@Overridepublic void complete() {@@ -884,7 +884,7 @@ public class DefaultDataService implements DataService, Serializable {setting = settingService.findSetting(Key.AI);if (setting == null)- settingService.saveAISetting(new AISetting());+ settingService.saveAiSetting(new AiSetting());if (roleService.get(Role.OWNER_ID) == null) {Role owner = new Role();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.javaindex 64ec05a77d..7c04c53718 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@@ -8382,4 +8382,19 @@ public class DataMigrator {private void migrate214(File dataDir, Stack<Integer> versions) {}+ private void migrate215(File dataDir, Stack<Integer> versions) {+ for (File file : dataDir.listFiles()) {+ if (file.getName().startsWith("Users.xml")) {+ VersionedXmlDoc dom = VersionedXmlDoc.fromFile(file);+ for (Element element : dom.getRootElement().elements()) {+ Element serviceAccountElement = element.element("serviceAccount");+ boolean isServiceAccount = Boolean.parseBoolean(serviceAccountElement.getTextTrim());+ serviceAccountElement.detach();+ element.addElement("type").setText(isServiceAccount ? "SERVICE" : "ORDINARY");+ }+ dom.writeToFile(file, false);+ }+ }+ }+}diff --git a/server-core/src/main/java/io/onedev/server/event/project/issue/IssueChanged.java b/server-core/src/main/java/io/onedev/server/event/project/issue/IssueChanged.javaindex 76e8c08ab3..bb631e485a 100644--- a/server-core/src/main/java/io/onedev/server/event/project/issue/IssueChanged.java+++ b/server-core/src/main/java/io/onedev/server/event/project/issue/IssueChanged.java@@ -26,7 +26,7 @@ public class IssueChanged extends IssueEvent implements CommitAware {private final String comment;public IssueChanged(IssueChange change, @Nullable String comment) {- this(change, comment, !change.getUser().isServiceAccount());+ this(change, comment, change.getUser().getType() != User.Type.SERVICE);}public IssueChanged(IssueChange change, @Nullable String comment, boolean sendNotifications) {diff --git a/server-core/src/main/java/io/onedev/server/event/project/issue/IssueEvent.java b/server-core/src/main/java/io/onedev/server/event/project/issue/IssueEvent.javaindex ace65f77c6..1367457cde 100644--- a/server-core/src/main/java/io/onedev/server/event/project/issue/IssueEvent.java+++ b/server-core/src/main/java/io/onedev/server/event/project/issue/IssueEvent.java@@ -22,7 +22,7 @@ public abstract class IssueEvent extends ProjectEvent {private final boolean sendNotifications;public IssueEvent(User user, Date date, Issue issue) {- this(user, date, issue, !user.isServiceAccount());+ this(user, date, issue, user.getType() != User.Type.SERVICE);}public IssueEvent(User user, Date date, Issue issue, boolean sendNotifications) {diff --git a/server-core/src/main/java/io/onedev/server/model/Chat.java b/server-core/src/main/java/io/onedev/server/model/Chat.javanew file mode 100644index 0000000000..46c8bf88f5--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/model/Chat.java@@ -0,0 +1,116 @@+package io.onedev.server.model;++import java.util.ArrayList;+import java.util.Collection;+import java.util.Comparator;+import java.util.Date;+import java.util.List;++import javax.persistence.CascadeType;+import javax.persistence.Column;+import javax.persistence.Entity;+import javax.persistence.FetchType;+import javax.persistence.Index;+import javax.persistence.JoinColumn;+import javax.persistence.ManyToOne;+import javax.persistence.OneToMany;+import javax.persistence.Table;++import org.apache.commons.lang3.StringUtils;++@Entity+@Table(indexes={@Index(columnList="o_user_id"), @Index(columnList="o_ai_id")})+public class Chat extends AbstractEntity {++ private static final long serialVersionUID = 1L;++ public static final int MAX_TITLE_LEN = 255;++ public static final String PROP_USER = "user";++ public static final String PROP_AI = "ai";++ public static final String PROP_DATE = "date";++ public static final String PROP_TITLE = "title";++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private User user;++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private User ai;++ @Column(nullable=false)+ private Date date;++ @Column(nullable=false, length=MAX_TITLE_LEN)+ private String title = "New chat";++ @OneToMany(mappedBy="chat", cascade=CascadeType.REMOVE)+ private Collection<ChatMessage> messages = new ArrayList<>();++ private transient List<ChatMessage> sortedMessages;++ public User getUser() {+ return user;+ }++ public void setUser(User user) {+ this.user = user;+ }++ public Date getDate() {+ return date;+ }++ public void setDate(Date date) {+ this.date = date;+ }++ public User getAi() {+ return ai;+ }++ public void setAi(User ai) {+ this.ai = ai;+ }++ public String getTitle() {+ return title;+ }++ public void setTitle(String title) {+ this.title = StringUtils.abbreviate(title, MAX_TITLE_LEN);+ }++ public Collection<ChatMessage> getMessages() {+ return messages;+ }++ public void setMessages(Collection<ChatMessage> messages) {+ this.messages = messages;+ }++ public List<ChatMessage> getSortedMessages() {+ if (sortedMessages == null) {+ sortedMessages = new ArrayList<>(messages);+ sortedMessages.sort(Comparator.comparing(ChatMessage::getId));+ }+ return sortedMessages;+ }++ public static String getChangeObservable(Long chatId) {+ return "chat:" + chatId;+ }++ public static String getPartialResponseObservable(Long chatId) {+ return "chat:" + chatId + ":partialResponse";+ }++ public static String getNewMessagesObservable(Long chatId) {+ return "chat:" + chatId + ":newMessages";+ }++}diff --git a/server-core/src/main/java/io/onedev/server/model/ChatMessage.java b/server-core/src/main/java/io/onedev/server/model/ChatMessage.javanew file mode 100644index 0000000000..44696c11e8--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/model/ChatMessage.java@@ -0,0 +1,80 @@+package io.onedev.server.model;++import java.util.LinkedHashMap;++import javax.persistence.Column;+import javax.persistence.Entity;+import javax.persistence.FetchType;+import javax.persistence.Index;+import javax.persistence.JoinColumn;+import javax.persistence.Lob;+import javax.persistence.ManyToOne;+import javax.persistence.Table;++import io.onedev.commons.utils.StringUtils;++@Entity+@Table(indexes={@Index(columnList="o_chat_id")})+public class ChatMessage extends AbstractEntity {++ private static final long serialVersionUID = 1L;++ private static final int MAX_CONTENT_LEN = 100000;++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private Chat chat;++ private boolean error;++ private boolean request;++ @Lob+ @Column(nullable=false, length=MAX_CONTENT_LEN)+ private String content;++ @Lob+ @Column(nullable=false, length=65535)+ private LinkedHashMap<String, String> attachments = new LinkedHashMap<>();++ public Chat getChat() {+ return chat;+ }++ public void setChat(Chat chat) {+ this.chat = chat;+ }++ public String getContent() {+ return content;+ }++ public boolean isError() {+ return error;+ }++ public void setError(boolean error) {+ this.error = error;+ }++ public boolean isRequest() {+ return request;+ }++ public void setRequest(boolean request) {+ this.request = request;+ }++ public void setContent(String content) {+ this.content = StringUtils.abbreviate(content, MAX_CONTENT_LEN);+ }++ public LinkedHashMap<String, String> getAttachments() {+ return attachments;+ }++ public void setAttachments(LinkedHashMap<String, String> attachments) {+ this.attachments = attachments;+ }++}diff --git a/server-core/src/main/java/io/onedev/server/model/Group.java b/server-core/src/main/java/io/onedev/server/model/Group.javaindex 3aa8c2cb08..35e0a945e9 100644--- a/server-core/src/main/java/io/onedev/server/model/Group.java+++ b/server-core/src/main/java/io/onedev/server/model/Group.java@@ -59,6 +59,10 @@ public class Group extends AbstractEntity implements BasePermission {@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)private Collection<Membership> memberships = new ArrayList<>();+ @OneToMany(mappedBy="group", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<GroupEntitlement> entitlements = new ArrayList<>();+private transient Collection<User> members;@Editable(order=100)@@ -133,6 +137,14 @@ public class Group extends AbstractEntity implements BasePermission {this.memberships = memberships;}+ public Collection<GroupEntitlement> getEntitlements() {+ return entitlements;+ }++ public void setEntitlements(Collection<GroupEntitlement> groupEntitlements) {+ this.entitlements = groupEntitlements;+ }+public Collection<User> getMembers() {if (members == null) {members = new HashSet<>();diff --git a/server-core/src/main/java/io/onedev/server/model/GroupEntitlement.java b/server-core/src/main/java/io/onedev/server/model/GroupEntitlement.javanew file mode 100644index 0000000000..789d312ca8--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/model/GroupEntitlement.java@@ -0,0 +1,52 @@+package io.onedev.server.model;++import javax.persistence.Entity;+import javax.persistence.FetchType;+import javax.persistence.Index;+import javax.persistence.JoinColumn;+import javax.persistence.ManyToOne;+import javax.persistence.Table;+import javax.persistence.UniqueConstraint;++import org.hibernate.annotations.Cache;+import org.hibernate.annotations.CacheConcurrencyStrategy;++@Entity+@Table(+ indexes={@Index(columnList="o_ai_id"), @Index(columnList="o_group_id")},+ uniqueConstraints={@UniqueConstraint(columnNames={"o_ai_id", "o_group_id"})+})+@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+public class GroupEntitlement extends AbstractEntity {++ private static final long serialVersionUID = 1L;++ public static final String PROP_AI = "ai";++ public static final String PROP_GROUP = "group";++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private User ai;++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private Group group;++ public User getAi() {+ return ai;+ }++ public void setAi(User ai) {+ this.ai = ai;+ }++ public Group getGroup() {+ return group;+ }++ public void setGroup(Group group) {+ this.group = group;+ }++}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.javaindex f6481f91d5..9a635b0bc3 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@@ -367,6 +367,10 @@ public class Project extends AbstractEntity implements LabelSupport<ProjectLabel@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)private Collection<Iteration> iterations = new ArrayList<>();+ @OneToMany(mappedBy="project", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<ProjectEntitlement> entitlements = new ArrayList<>();+@OneToMany(mappedBy="project", cascade=CascadeType.REMOVE)@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)private Collection<Audit> audits = new ArrayList<>();diff --git a/server-core/src/main/java/io/onedev/server/model/ProjectEntitlement.java b/server-core/src/main/java/io/onedev/server/model/ProjectEntitlement.javanew file mode 100644index 0000000000..8d1ae07c8a--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/model/ProjectEntitlement.java@@ -0,0 +1,52 @@+package io.onedev.server.model;++import javax.persistence.Entity;+import javax.persistence.FetchType;+import javax.persistence.Index;+import javax.persistence.JoinColumn;+import javax.persistence.ManyToOne;+import javax.persistence.Table;+import javax.persistence.UniqueConstraint;++import org.hibernate.annotations.Cache;+import org.hibernate.annotations.CacheConcurrencyStrategy;++@Entity+@Table(+ indexes={@Index(columnList="o_ai_id"), @Index(columnList="o_project_id")},+ uniqueConstraints={@UniqueConstraint(columnNames={"o_ai_id", "o_project_id"})+})+@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+public class ProjectEntitlement extends AbstractEntity {++ private static final long serialVersionUID = 1L;++ public static String PROP_AI = "ai";++ public static String PROP_PROJECT = "project";++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private Project project;++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private User ai;++ public Project getProject() {+ return project;+ }++ public void setProject(Project project) {+ this.project = project;+ }++ public User getAi() {+ return ai;+ }++ public void setAi(User ai) {+ this.ai = ai;+ }++}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.javaindex cf6e872a28..aae463ac8b 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@@ -2,12 +2,14 @@ package io.onedev.server.model;import static io.onedev.server.model.User.PROP_FULL_NAME;import static io.onedev.server.model.User.PROP_NAME;+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.web.translation.Translation._T;import java.util.ArrayList;import java.util.Collection;+import java.util.Comparator;import java.util.LinkedHashMap;import java.util.LinkedHashSet;import java.util.List;@@ -15,7 +17,6 @@ import java.util.Optional;import java.util.Stack;import java.util.stream.Collectors;-import org.jspecify.annotations.Nullable;import javax.persistence.CascadeType;import javax.persistence.Column;import javax.persistence.Entity;@@ -31,6 +32,7 @@ import org.apache.shiro.subject.Subject;import org.eclipse.jgit.lib.PersonIdent;import org.hibernate.annotations.Cache;import org.hibernate.annotations.CacheConcurrencyStrategy;+import org.jspecify.annotations.Nullable;import com.fasterxml.jackson.annotation.JsonIgnore;import com.google.common.base.MoreObjects;@@ -41,11 +43,8 @@ import io.onedev.server.OneDev;import io.onedev.server.annotation.DependsOn;import io.onedev.server.annotation.Editable;import io.onedev.server.annotation.Password;-import io.onedev.server.annotation.SubscriptionRequired;import io.onedev.server.annotation.UserName;-import io.onedev.server.service.EmailAddressService;-import io.onedev.server.service.SettingService;-import io.onedev.server.service.UserService;+import io.onedev.server.model.support.AiSetting;import io.onedev.server.model.support.NamedProjectQuery;import io.onedev.server.model.support.QueryPersonalization;import io.onedev.server.model.support.TwoFactorAuthentication;@@ -54,10 +53,12 @@ import io.onedev.server.model.support.issue.NamedIssueQuery;import io.onedev.server.model.support.pack.NamedPackQuery;import io.onedev.server.model.support.pullrequest.NamedPullRequestQuery;import io.onedev.server.security.SecurityUtils;+import io.onedev.server.service.EmailAddressService;+import io.onedev.server.service.SettingService;+import io.onedev.server.service.UserService;import io.onedev.server.util.facade.UserFacade;import io.onedev.server.util.watch.QuerySubscriptionSupport;import io.onedev.server.util.watch.QueryWatchSupport;-import io.onedev.server.web.util.WicketUtils;@Entity@Table(indexes={@Index(columnList=PROP_NAME), @Index(columnList=PROP_FULL_NAME)})@@ -66,6 +67,8 @@ import io.onedev.server.web.util.WicketUtils;public class User extends AbstractEntity implements AuthenticationInfo {private static final long serialVersionUID = 1L;++ public enum Type {ORDINARY, SERVICE, AI};public static final Long UNKNOWN_ID = -2L;@@ -76,6 +79,8 @@ public class User extends AbstractEntity implements AuthenticationInfo {public static final String SYSTEM_NAME = "OneDev";public static final String SYSTEM_EMAIL_ADDRESS = "system@onedev";++ public static final String AI_EMAIL_ADDRESS = "ai@onedev";public static final String UNKNOWN_NAME = "unknown";@@ -83,7 +88,7 @@ public class User extends AbstractEntity implements AuthenticationInfo {public static final String PROP_FULL_NAME = "fullName";- public static final String PROP_SERVICE_ACCOUNT = "serviceAccount";+ public static final String PROP_TYPE = "type";public static final String PROP_DISABLED = "disabled";@@ -93,7 +98,8 @@ public class User extends AbstractEntity implements AuthenticationInfo {private static ThreadLocal<Stack<User>> stack = ThreadLocal.withInitial(() -> new Stack<>());- private boolean serviceAccount;+ @Column(nullable=false)+ private Type type = Type.ORDINARY;private boolean disabled;@@ -109,6 +115,10 @@ public class User extends AbstractEntity implements AuthenticationInfo {private String fullName;private boolean notifyOwnEvents;++ @Lob+ @Column(length=65535)+ private AiSetting aiSetting = new AiSetting();@JsonIgnore@Lob@@ -229,6 +239,30 @@ public class User extends AbstractEntity implements AuthenticationInfo {@OneToMany(mappedBy=ReviewedDiff.PROP_USER, cascade=CascadeType.REMOVE)private Collection<ReviewedDiff> reviewedDiffs = new ArrayList<>();+ @OneToMany(mappedBy="ai", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<ProjectEntitlement> projectEntitlements = new ArrayList<>();++ @OneToMany(mappedBy="ai", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<GroupEntitlement> groupEntitlements = new ArrayList<>();++ @OneToMany(mappedBy="ai", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<UserEntitlement> userEntitlements = new ArrayList<>();++ @OneToMany(mappedBy="user", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<UserEntitlement> aiEntitlements = new ArrayList<>();++ @OneToMany(mappedBy="ai", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<Chat> aiChats = new ArrayList<>();++ @OneToMany(mappedBy="user", cascade=CascadeType.REMOVE)+ @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+ private Collection<Chat> userChats = new ArrayList<>();+@JsonIgnore@Lob@Column(nullable=false, length=65535)@@ -283,6 +317,8 @@ public class User extends AbstractEntity implements AuthenticationInfo {private transient Optional<EmailAddress> gitEmailAddress;private transient Optional<EmailAddress> publicEmailAddress;++ private transient List<User> entitledAis;public QueryPersonalization<NamedProjectQuery> getProjectQueryPersonalization() {return new QueryPersonalization<NamedProjectQuery>() {@@ -531,14 +567,16 @@ public class User extends AbstractEntity implements AuthenticationInfo {return SecurityUtils.asSubject(getPrincipals());}- @Editable(order=50, name="Service Account", descriptionProvider = "getServiceAccountDescription")- @SubscriptionRequired- public boolean isServiceAccount() {- return serviceAccount;+ @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)")+ public Type getType() {+ return type;}- public void setServiceAccount(boolean serviceAccount) {- this.serviceAccount = serviceAccount;+ public void setType(Type type) {+ this.type = type;}public boolean isDisabled() {@@ -549,20 +587,6 @@ public class User extends AbstractEntity implements AuthenticationInfo {this.disabled = disabled;}- @SuppressWarnings("unused")- private static String getServiceAccountDescription() {- if (!WicketUtils.isSubscriptionActive()) {- return _T(""- + "Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate "- + "notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. "- + "<a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days");- } else {- return _T(""- + "Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate "- + "notifications for its activities");- }- }-@Editable(name="Login Name", order=100)@UserName@NotEmpty@@ -580,7 +604,7 @@ public class User extends AbstractEntity implements AuthenticationInfo {* time*/@Editable(order=150)- @DependsOn(property="serviceAccount", value="false")+ @DependsOn(property="type", value="ORDINARY")@Password(checkPolicy=true, autoComplete="new-password")@NotEmpty@Nullable@@ -614,9 +638,9 @@ public class User extends AbstractEntity implements AuthenticationInfo {public void setFullName(String fullName) {this.fullName = fullName;}-+@Editable(order=400, name="Notify Own Events", description = "Whether or not to send notifications for events generated by yourself")- @DependsOn(property="serviceAccount", value="false")+ @DependsOn(property="type", value="ORDINARY")public boolean isNotifyOwnEvents() {return notifyOwnEvents;}@@ -625,6 +649,14 @@ public class User extends AbstractEntity implements AuthenticationInfo {this.notifyOwnEvents = sendOwnEvents;}+ public AiSetting getAiSetting() {+ return aiSetting;+ }++ public void setAiSetting(AiSetting aiSetting) {+ this.aiSetting = aiSetting;+ }+public Collection<AccessToken> getAccessTokens() {return accessTokens;}@@ -666,7 +698,13 @@ public class User extends AbstractEntity implements AuthenticationInfo {}public PersonIdent asPerson() {- if (isSystem()) {+ if (getType() == SERVICE) {+ throw new ExplicitException("Service account does not have git identity");+ } else if (getType() == AI) {+ return new PersonIdent(getName(), User.AI_EMAIL_ADDRESS);+ } else if (isUnknown()) {+ throw new ExplicitException("Unknown user does not have git identity");+ } else if (isSystem()) {return new PersonIdent(User.SYSTEM_NAME, User.SYSTEM_EMAIL_ADDRESS);} else {EmailAddress emailAddress = getGitEmailAddress();@@ -708,6 +746,38 @@ public class User extends AbstractEntity implements AuthenticationInfo {this.projectAuthorizations = projectAuthorizations;}+ public Collection<ProjectEntitlement> getProjectEntitlements() {+ return projectEntitlements;+ }++ public void setProjectEntitlements(Collection<ProjectEntitlement> projectEntitlements) {+ this.projectEntitlements = projectEntitlements;+ }++ public Collection<GroupEntitlement> getGroupEntitlements() {+ return groupEntitlements;+ }++ public void setGroupEntitlements(Collection<GroupEntitlement> groupEntitlements) {+ this.groupEntitlements = groupEntitlements;+ }++ public Collection<UserEntitlement> getUserEntitlements() {+ return userEntitlements;+ }++ public void setUserEntitlements(Collection<UserEntitlement> userEntitlements) {+ this.userEntitlements = userEntitlements;+ }++ public Collection<UserEntitlement> getAiEntitlements() {+ return aiEntitlements;+ }++ public void setAiEntitlements(Collection<UserEntitlement> aiEntitlements) {+ this.aiEntitlements = aiEntitlements;+ }+public Collection<IssueAuthorization> getIssueAuthorizations() {return issueAuthorizations;}@@ -1106,8 +1176,37 @@ public class User extends AbstractEntity implements AuthenticationInfo {getEmailAddresses().add(emailAddress);}+ public List<User> getEntitledAis() {+ if (entitledAis == null) {+ var userService = OneDev.getInstance(UserService.class);+ var userCache = userService.cloneCache();+ 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())) {+ 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 UserFacade getFacade() {- return new UserFacade(getId(), getName(), getFullName(), isServiceAccount(), isDisabled());+ return new UserFacade(getId(), getName(), getFullName(), getType(), isDisabled(), getAiSetting().isEntitleToAll());}}diff --git a/server-core/src/main/java/io/onedev/server/model/UserEntitlement.java b/server-core/src/main/java/io/onedev/server/model/UserEntitlement.javanew file mode 100644index 0000000000..6091bd633c--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/model/UserEntitlement.java@@ -0,0 +1,52 @@+package io.onedev.server.model;++import javax.persistence.Entity;+import javax.persistence.FetchType;+import javax.persistence.Index;+import javax.persistence.JoinColumn;+import javax.persistence.ManyToOne;+import javax.persistence.Table;+import javax.persistence.UniqueConstraint;++import org.hibernate.annotations.Cache;+import org.hibernate.annotations.CacheConcurrencyStrategy;++@Entity+@Table(+ indexes={@Index(columnList="o_ai_id"), @Index(columnList="o_user_id")},+ uniqueConstraints={@UniqueConstraint(columnNames={"o_ai_id", "o_user_id"})+})+@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)+public class UserEntitlement extends AbstractEntity {++ private static final long serialVersionUID = 1L;++ public static final String PROP_AI = "ai";++ public static final String PROP_USER = "user";++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private User ai;++ @ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)+ private User user;++ public User getAI() {+ return ai;+ }++ public void setAI(User ai) {+ this.ai = ai;+ }++ public User getUser() {+ return user;+ }++ public void setUser(User user) {+ this.user = user;+ }++}diff --git a/server-core/src/main/java/io/onedev/server/model/support/AIModelSetting.java b/server-core/src/main/java/io/onedev/server/model/support/AIModelSetting.javaindex 9caeb4c94b..559f637c95 100644--- a/server-core/src/main/java/io/onedev/server/model/support/AIModelSetting.java+++ b/server-core/src/main/java/io/onedev/server/model/support/AIModelSetting.java@@ -19,19 +19,21 @@ import org.slf4j.LoggerFactory;import com.google.gson.JsonParser;import dev.langchain4j.model.chat.ChatModel;+import dev.langchain4j.model.chat.StreamingChatModel;import dev.langchain4j.model.openai.OpenAiChatModel;+import dev.langchain4j.model.openai.OpenAiStreamingChatModel;import io.onedev.server.annotation.ChoiceProvider;import io.onedev.server.annotation.Editable;import io.onedev.server.util.EditContext;@Editable(order=100)-public class AIModelSetting implements Serializable {+public class AiModelSetting implements Serializable {private static final long serialVersionUID = 1L;private static final int TIMEOUT_SECONDS = 30;- private static final Logger logger = LoggerFactory.getLogger(AIModelSetting.class);+ private static final Logger logger = LoggerFactory.getLogger(AiModelSetting.class);private String baseUrl;@@ -128,4 +130,13 @@ public class AIModelSetting implements Serializable {.build();}+ public StreamingChatModel getStreamingChatModel() {+ return OpenAiStreamingChatModel.builder()+ .apiKey(apiKey)+ .baseUrl(baseUrl)+ .modelName(name)+ .timeout(Duration.ofSeconds(TIMEOUT_SECONDS))+ .build();+ }+}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.javanew file mode 100644index 0000000000..5cfe43fe2e--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/model/support/AISetting.java@@ -0,0 +1,29 @@+package io.onedev.server.model.support;++import java.io.Serializable;++public class AiSetting implements Serializable {++ private static final long serialVersionUID = 1L;++ private AiModelSetting modelSetting;++ private boolean entitleToAll = true;++ public AiModelSetting getModelSetting() {+ return modelSetting;+ }++ public void setModelSetting(AiModelSetting modelSetting) {+ this.modelSetting = modelSetting;+ }++ public boolean isEntitleToAll() {+ return entitleToAll;+ }++ public void setEntitleToAll(boolean entitleToAll) {+ this.entitleToAll = entitleToAll;+ }++}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.javaindex a60e2656fb..f877d33bb1 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@@ -6,24 +6,24 @@ import org.jspecify.annotations.Nullable;import dev.langchain4j.model.chat.ChatModel;import io.onedev.server.annotation.Editable;-import io.onedev.server.model.support.AIModelSetting;+import io.onedev.server.model.support.AiModelSetting;@Editable-public class AISetting implements Serializable {+public class AiSetting implements Serializable {private static final long serialVersionUID = 1L;public static final String PROP_LITE_MODEL_SETTING = "liteModelSetting";- private AIModelSetting liteModelSetting;+ private AiModelSetting liteModelSetting;@Editable(order=100)@Nullable- public AIModelSetting getLiteModelSetting() {+ public AiModelSetting getLiteModelSetting() {return liteModelSetting;}- public void setLiteModelSetting(AIModelSetting liteModelSetting) {+ public void setLiteModelSetting(AiModelSetting liteModelSetting) {this.liteModelSetting = liteModelSetting;}diff --git a/server-core/src/main/java/io/onedev/server/model/support/administration/GlobalIssueSetting.java b/server-core/src/main/java/io/onedev/server/model/support/administration/GlobalIssueSetting.javaindex 8a73b3e6b2..121ae83094 100644--- a/server-core/src/main/java/io/onedev/server/model/support/administration/GlobalIssueSetting.java+++ b/server-core/src/main/java/io/onedev/server/model/support/administration/GlobalIssueSetting.java@@ -205,13 +205,13 @@ public class GlobalIssueSetting implements Serializable {var branchUpdatedSpec = new BranchUpdatedSpec();branchUpdatedSpec.setToState("Closed");- branchUpdatedSpec.setBranches("main");+ branchUpdatedSpec.setBranches("main master");branchUpdatedSpec.setIssueQuery("fixed in current commit");transitionSpecs.add(branchUpdatedSpec);var pullRequestOpenedSpec = new PullRequestOpenedSpec();pullRequestOpenedSpec.setToState("In Review");- pullRequestOpenedSpec.setBranches("main");+ pullRequestOpenedSpec.setBranches("main master");pullRequestOpenedSpec.setIssueQuery("fixed in current pull request");transitionSpecs.add(pullRequestOpenedSpec);diff --git a/server-core/src/main/java/io/onedev/server/notification/BuildNotificationManager.java b/server-core/src/main/java/io/onedev/server/notification/BuildNotificationManager.javaindex 519a4961d0..75d46c2e4d 100644--- a/server-core/src/main/java/io/onedev/server/notification/BuildNotificationManager.java+++ b/server-core/src/main/java/io/onedev/server/notification/BuildNotificationManager.java@@ -107,7 +107,7 @@ public class BuildNotificationManager {@Sessional@Listenpublic void on(BuildEvent event) {- if (!(event instanceof BuildUpdated) && (event.getUser() == null || !event.getUser().isServiceAccount())) {+ if (!(event instanceof BuildUpdated) && (event.getUser() == null || event.getUser().getType() != User.Type.SERVICE)) {Project project = event.getProject();Map<User, Collection<String>> subscribedQueryStrings = new HashMap<>();for (BuildQueryPersonalization personalization: project.getBuildQueryPersonalizations()) {diff --git a/server-core/src/main/java/io/onedev/server/notification/ChannelNotificationManager.java b/server-core/src/main/java/io/onedev/server/notification/ChannelNotificationManager.javaindex 347cb8888d..c4770ea107 100644--- a/server-core/src/main/java/io/onedev/server/notification/ChannelNotificationManager.java+++ b/server-core/src/main/java/io/onedev/server/notification/ChannelNotificationManager.java@@ -72,7 +72,7 @@ public abstract class ChannelNotificationManager<T extends ChannelNotificationSe@Sessional@Listenpublic void on(PullRequestEvent event) {- if (!event.isMinor() && (event.getUser() == null || !event.getUser().isServiceAccount())) {+ if (!event.isMinor() && (event.getUser() == null || event.getUser().getType() != User.Type.SERVICE)) {PullRequest request = event.getRequest();User user = event.getUser();@@ -91,7 +91,7 @@ public abstract class ChannelNotificationManager<T extends ChannelNotificationSe@Sessional@Listenpublic void on(BuildEvent event) {- if (event.getUser() == null || !event.getUser().isServiceAccount()) {+ if (event.getUser() == null || event.getUser().getType() != User.Type.SERVICE) {Build build = event.getBuild();var status = StringUtils.capitalize(build.getStatus().toString().toLowerCase());@@ -107,7 +107,7 @@ public abstract class ChannelNotificationManager<T extends ChannelNotificationSe@Sessional@Listenpublic void on(PackEvent event) {- if (!event.getUser().isServiceAccount()) {+ if (event.getUser().getType() != User.Type.SERVICE) {Pack pack = event.getPack();var title = format("[%s %s] Package published", pack.getType(), pack.getReference(true));postIfApplicable(title, event);@@ -134,7 +134,7 @@ public abstract class ChannelNotificationManager<T extends ChannelNotificationSe@Sessional@Listenpublic void on(CodeCommentEvent event) {- if (!(event instanceof CodeCommentEdited) && !event.getUser().isServiceAccount()) {+ if (!(event instanceof CodeCommentEdited) && event.getUser().getType() != User.Type.SERVICE) {CodeComment comment = event.getComment();String title = format("[Code Comment %s:%s] %s %s",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.javaindex 8d29e738ec..40f22e1950 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@@ -41,7 +41,7 @@ public class CodeCommentNotificationManager {@Listenpublic void on(CodeCommentEvent event) {CodeComment comment = event.getComment();- if (comment.getCompareContext().getPullRequest() == null && !event.getUser().isServiceAccount()) {+ if (comment.getCompareContext().getPullRequest() == null && event.getUser().getType() != User.Type.SERVICE) {MarkdownText markdown = (MarkdownText) event.getCommentText();Collection<User> notifyUsers = new HashSet<>();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.javaindex fbd4d0e4f9..0ed1e0ed93 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@@ -177,7 +177,7 @@ public class IssueNotificationManager {if (user != null) {if (!user.isNotifyOwnEvents() || isNotified(notifiedEmailAddresses, user))notifiedUsers.add(user);- if (!user.isSystem() && !user.isServiceAccount())+ if (!user.isSystem() && user.getType() != User.Type.SERVICE)watchService.watch(issue, user, true);}@@ -208,7 +208,7 @@ public class IssueNotificationManager {}for (User member: entry.getValue().getMembers()) {- if (!member.isServiceAccount())+ if (member.getType() != User.Type.SERVICE)watchService.watch(issue, member, true);authorizationService.authorize(issue, member);}@@ -237,7 +237,7 @@ public class IssueNotificationManager {}for (User each: entry.getValue()) {- if (!each.isServiceAccount())+ if (each.getType() != User.Type.SERVICE)watchService.watch(issue, each, true);authorizationService.authorize(issue, each);}@@ -250,7 +250,7 @@ public class IssueNotificationManager {User mentionedUser = userService.findByName(userName);if (mentionedUser != null) {mentionService.mention(issue, mentionedUser);- if (!mentionedUser.isServiceAccount())+ if (mentionedUser.getType() != User.Type.SERVICE)watchService.watch(issue, mentionedUser, true);authorizationService.authorize(issue, mentionedUser);if (!isNotified(notifiedEmailAddresses, mentionedUser)) {diff --git a/server-core/src/main/java/io/onedev/server/notification/PackNotificationManager.java b/server-core/src/main/java/io/onedev/server/notification/PackNotificationManager.javaindex 52cb241455..8a5df60600 100644--- a/server-core/src/main/java/io/onedev/server/notification/PackNotificationManager.java+++ b/server-core/src/main/java/io/onedev/server/notification/PackNotificationManager.java@@ -83,7 +83,7 @@ public class PackNotificationManager {@Sessional@Listenpublic void on(PackEvent event) {- if (!event.getUser().isServiceAccount()) {+ if (event.getUser().getType() != User.Type.SERVICE) {Project project = event.getProject();Map<User, Collection<String>> subscribedQueryStrings = new HashMap<>();for (PackQueryPersonalization personalization: project.getPackQueryPersonalizations()) {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.javaindex e6cb16fb81..a1a4736344 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@@ -63,7 +63,7 @@ public class PullRequestNotificationManager {@Transactional@Listenpublic void on(PullRequestEvent event) {- if (event.getUser() == null || !event.getUser().isServiceAccount()) {+ if (event.getUser() == null || event.getUser().getType() != User.Type.SERVICE) {PullRequest request = event.getRequest();User user = event.getUser();@@ -131,7 +131,7 @@ public class PullRequestNotificationManager {if (user != null) {if (!user.isNotifyOwnEvents() || isNotified(notifiedEmailAddresses, user))notifiedUsers.add(user);- if (!user.isSystem() && !user.isServiceAccount())+ if (!user.isSystem() && user.getType() != User.Type.SERVICE)watchService.watch(request, user, true);}@@ -144,7 +144,7 @@ public class PullRequestNotificationManager {notifiedUsers.add(committer);}for (User each : committers) {- if (!each.isSystem() && !each.isServiceAccount())+ if (!each.isSystem() && each.getType() != User.Type.SERVICE)watchService.watch(request, each, true);}}@@ -206,7 +206,7 @@ public class PullRequestNotificationManager {}for (User assignee : assignees) {- if (!assignee.isServiceAccount())+ if (assignee.getType() != User.Type.SERVICE)watchService.watch(request, assignee, true);if (!notifiedUsers.contains(assignee)) {String subject = String.format(@@ -232,7 +232,7 @@ public class PullRequestNotificationManager {}for (User reviewer : reviewers) {- if (!reviewer.isServiceAccount())+ if (reviewer.getType() != User.Type.SERVICE)watchService.watch(request, reviewer, true);if (!notifiedUsers.contains(reviewer)) {String subject = String.format(@@ -264,7 +264,7 @@ public class PullRequestNotificationManager {User mentionedUser = userService.findByName(userName);if (mentionedUser != null) {mentionService.mention(request, mentionedUser);- if (!mentionedUser.isServiceAccount())+ if (mentionedUser.getType() != User.Type.SERVICE)watchService.watch(request, mentionedUser, true);if (!isNotified(notifiedEmailAddresses, mentionedUser)) {String subject = String.format(diff --git a/server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java b/server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.javaindex df902069bf..a7352475d7 100644--- a/server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java+++ b/server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java@@ -19,12 +19,13 @@ import javax.ws.rs.core.Response;import org.apache.shiro.authz.UnauthorizedException;import io.onedev.commons.utils.ExplicitException;-import io.onedev.server.service.AuditService;-import io.onedev.server.service.EmailAddressService;-import io.onedev.server.service.SettingService;import io.onedev.server.model.EmailAddress;+import io.onedev.server.model.User;import io.onedev.server.rest.annotation.Api;import io.onedev.server.security.SecurityUtils;+import io.onedev.server.service.AuditService;+import io.onedev.server.service.EmailAddressService;+import io.onedev.server.service.SettingService;@Path("/email-addresses")@Consumes(MediaType.APPLICATION_JSON)@@ -73,8 +74,8 @@ public class EmailAddressResource {throw new UnauthorizedException();else if (owner.isDisabled())throw new ExplicitException("Can not set email address for disabled user");- else if (owner.isServiceAccount())- throw new ExplicitException("Can not set email address for service account");+ else if (owner.getType() != User.Type.ORDINARY)+ throw new ExplicitException("Can not set email address for service or ai user");else if (emailAddressService.findByValue(emailAddress.getValue()) != null)throw new ExplicitException("This email address is already used by another user");diff --git a/server-core/src/main/java/io/onedev/server/rest/resource/UserResource.java b/server-core/src/main/java/io/onedev/server/rest/resource/UserResource.javaindex db64a0c55e..436e7d0c99 100644--- a/server-core/src/main/java/io/onedev/server/rest/resource/UserResource.java+++ b/server-core/src/main/java/io/onedev/server/rest/resource/UserResource.java@@ -1,5 +1,7 @@package io.onedev.server.rest.resource;+import static io.onedev.server.model.User.Type.ORDINARY;+import static io.onedev.server.model.User.Type.SERVICE;import static io.onedev.server.security.SecurityUtils.getAuthUser;import static java.util.stream.Collectors.toList;@@ -101,10 +103,10 @@ public class UserResource {private UserData getData(User user) {var data = new UserData();data.setDisabled(user.isDisabled());- data.setServiceAccount(user.isServiceAccount());+ data.setType(user.getType());data.setName(user.getName());data.setFullName(user.getFullName());- if (!user.isServiceAccount())+ if (user.getType() != SERVICE)data.setNotifyOwnEvents(user.isNotifyOwnEvents());return data;}@@ -333,14 +335,14 @@ public class UserResource {if (userService.findByName(data.getName()) != null)throw new ExplicitException("Login name is already used by another user");- if (!data.isServiceAccount() && emailAddressService.findByValue(data.getEmailAddress()) != null)+ if (data.getType() == ORDINARY && emailAddressService.findByValue(data.getEmailAddress()) != null)throw new ExplicitException("Email address is already used by another user");User user = new User();- user.setServiceAccount(data.isServiceAccount());+ user.setType(data.getType());user.setName(data.getName());user.setFullName(data.getFullName());- if (data.isServiceAccount()) {+ if (data.getType() != ORDINARY) {userService.create(user);} else {user.setNotifyOwnEvents(data.isNotifyOwnEvents());@@ -383,7 +385,7 @@ public class UserResource {String oldName = user.getName();user.setName(data.getName());user.setFullName(data.getFullName());- if (!user.isServiceAccount())+ if (user.getType() != SERVICE)user.setNotifyOwnEvents(data.isNotifyOwnEvents());userService.update(user, oldName);@@ -462,9 +464,9 @@ public class UserResource {auditService.audit(null, "changed password of account \"" + user.getName() + "\" via RESTful API", null, null);return Response.ok().build();} else if (user.isDisabled()) {- throw new ExplicitException("Can not set password for disabled user");- } else if (user.isServiceAccount()) {- throw new ExplicitException("Can not set password for service account");+ throw new ExplicitException("Can not set password for disabled account");+ } else if (user.getType() != ORDINARY) {+ throw new ExplicitException("Can not set password for service or AI account");} else if (user.equals(getAuthUser())) {if (user.getPassword() == null) {throw new ExplicitException("The user is currently authenticated via external system, "@@ -488,9 +490,9 @@ public class UserResource {User user = userService.load(userId);if (user.isDisabled()) {- throw new ExplicitException("Can not reset two factor authentication for disabled user");- } else if (user.isServiceAccount()) {- throw new ExplicitException("Can not reset two factor authentication for service account");+ throw new ExplicitException("Can not reset two factor authentication for disabled account");+ } else if (user.getType() != ORDINARY) {+ throw new ExplicitException("Can not reset two factor authentication for service or AI account");} else {user.setTwoFactorAuthentication(null);userService.update(user, null);@@ -509,8 +511,8 @@ public class UserResource {if (user.isDisabled())throw new ExplicitException("Can not set queries and watches for disabled user");- else if (user.isServiceAccount())- throw new ExplicitException("Can not set queries and watches for service account");+ else if (user.getType() != ORDINARY)+ throw new ExplicitException("Can not set queries and watches for service or ai account");var oldAuditContent = VersionedXmlDoc.fromBean(getQueriesAndWatches(user)).toXML();@@ -587,8 +589,8 @@ public class UserResource {@Api(order=10, description="Whether or not the user is disabled")private boolean disabled;- @Api(order=50, description="Whether or not the user is a service account")- private boolean serviceAccount;+ @Api(order=50, description="Type of the user")+ private User.Type type;@Api(order=100, description="Login name of the user")private String name;@@ -607,12 +609,12 @@ public class UserResource {this.disabled = disabled;}- public boolean isServiceAccount() {- return serviceAccount;+ public User.Type getType() {+ return type;}- public void setServiceAccount(boolean serviceAccount) {- this.serviceAccount = serviceAccount;+ public void setType(User.Type type) {+ this.type = type;}public String getName() {@@ -645,8 +647,8 @@ public class UserResource {private static final long serialVersionUID = 1L;- @Api(order=50, exampleProvider="getServiceAccountExample", description="Create user as service account")- private boolean serviceAccount;+ @Api(order=50, exampleProvider = "getTypeExample", description="Specify account type")+ private User.Type type;@Api(order=100, description="Login name of the user")private String name;@@ -662,17 +664,17 @@ public class UserResource {@Api(order=400, description = "Whether or not to notify user on own events. Only required if not created as service account")private boolean notifyOwnEvents;- public boolean isServiceAccount() {- return serviceAccount;+ public User.Type getType() {+ return type;}- public void setServiceAccount(boolean serviceAccount) {- this.serviceAccount = serviceAccount;+ public void setType(User.Type type) {+ this.type = type;}@SuppressWarnings("unused")- private static boolean getServiceAccountExample() {- return false;+ private static User.Type getTypeExample() {+ return ORDINARY;}@UserNamediff --git a/server-core/src/main/java/io/onedev/server/security/realm/PasswordAuthenticatingRealm.java b/server-core/src/main/java/io/onedev/server/security/realm/PasswordAuthenticatingRealm.javaindex c01b71860c..16b73f266e 100644--- a/server-core/src/main/java/io/onedev/server/security/realm/PasswordAuthenticatingRealm.java+++ b/server-core/src/main/java/io/onedev/server/security/realm/PasswordAuthenticatingRealm.java@@ -1,5 +1,6 @@package io.onedev.server.security.realm;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.validation.validator.UserNameValidator.normalizeUserName;import static io.onedev.server.web.translation.Translation._T;@@ -145,8 +146,8 @@ public class PasswordAuthenticatingRealm extends AuthenticatingRealm {if (user != null) {if (user.isDisabled())throw new DisabledAccountException(_T("Account is disabled"));- else if (user.isServiceAccount())- throw new DisabledAccountException(_T("Service account not allowed to login"));+ else if (user.getType() != ORDINARY)+ throw new DisabledAccountException(_T("Service or AI account not allowed to login"));if (user.getPassword() == null) {var authenticator = settingService.getAuthenticator();if (authenticator != null) {diff --git a/server-core/src/main/java/io/onedev/server/service/ChatService.java b/server-core/src/main/java/io/onedev/server/service/ChatService.javanew file mode 100644index 0000000000..83a680848c--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/ChatService.java@@ -0,0 +1,23 @@+package io.onedev.server.service;++import java.util.List;++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.support.ChatResponding;++public interface ChatService extends EntityService<Chat> {++ List<Chat> query(User user, User ai, String term, int count);++ void createOrUpdate(Chat chat);++ void sendRequest(String sessionId, ChatMessage request);++ @Nullable+ ChatResponding getResponding(String sessionId, Chat chat);++}diff --git a/server-core/src/main/java/io/onedev/server/service/GroupEntitlementService.java b/server-core/src/main/java/io/onedev/server/service/GroupEntitlementService.javanew file mode 100644index 0000000000..79d3a3d1fa--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/GroupEntitlementService.java@@ -0,0 +1,14 @@+package io.onedev.server.service;++import java.util.Collection;++import io.onedev.server.model.GroupEntitlement;+import io.onedev.server.model.User;++public interface GroupEntitlementService extends EntityService<GroupEntitlement> {++ void syncEntitlements(User ai, Collection<GroupEntitlement> entitlements);++ void create(GroupEntitlement entitlement);++}diff --git a/server-core/src/main/java/io/onedev/server/service/ProjectEntitlementService.java b/server-core/src/main/java/io/onedev/server/service/ProjectEntitlementService.javanew file mode 100644index 0000000000..4807581c0a--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/ProjectEntitlementService.java@@ -0,0 +1,14 @@+package io.onedev.server.service;++import java.util.Collection;++import io.onedev.server.model.ProjectEntitlement;+import io.onedev.server.model.User;++public interface ProjectEntitlementService extends EntityService<ProjectEntitlement> {++ void syncEntitlements(User ai, Collection<ProjectEntitlement> entitlements);++ void create(ProjectEntitlement entitlement);++}diff --git a/server-core/src/main/java/io/onedev/server/service/SettingService.java b/server-core/src/main/java/io/onedev/server/service/SettingService.javaindex 6b5985c834..f451c78ead 100644--- a/server-core/src/main/java/io/onedev/server/service/SettingService.java+++ b/server-core/src/main/java/io/onedev/server/service/SettingService.java@@ -9,7 +9,7 @@ import org.jspecify.annotations.Nullable;import io.onedev.server.annotation.NoDBAccess;import io.onedev.server.model.Setting;import io.onedev.server.model.Setting.Key;-import io.onedev.server.model.support.administration.AISetting;+import io.onedev.server.model.support.administration.AiSetting;import io.onedev.server.model.support.administration.AgentSetting;import io.onedev.server.model.support.administration.AlertSetting;import io.onedev.server.model.support.administration.AuditSetting;@@ -173,9 +173,9 @@ public interface SettingService extends EntityService<Setting> {PerformanceSetting getPerformanceSetting();- AISetting getAISetting();+ AiSetting getAiSetting();- void saveAISetting(AISetting aiSetting);+ void saveAiSetting(AiSetting aiSetting);void saveSshSetting(SshSetting sshSetting);diff --git a/server-core/src/main/java/io/onedev/server/service/UserEntitlementService.java b/server-core/src/main/java/io/onedev/server/service/UserEntitlementService.javanew file mode 100644index 0000000000..fd307d6da6--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/UserEntitlementService.java@@ -0,0 +1,14 @@+package io.onedev.server.service;++import java.util.Collection;++import io.onedev.server.model.User;+import io.onedev.server.model.UserEntitlement;++public interface UserEntitlementService extends EntityService<UserEntitlement> {++ void syncEntitlements(User ai, Collection<UserEntitlement> entitlements);++ void create(UserEntitlement entitlement);++}diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultChatService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultChatService.javanew file mode 100644index 0000000000..41c5814c92--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultChatService.java@@ -0,0 +1,293 @@+package io.onedev.server.service.impl;++import java.util.List;+import java.util.Map;+import java.util.concurrent.ConcurrentHashMap;+import java.util.concurrent.CountDownLatch;+import java.util.concurrent.ExecutorService;+import java.util.concurrent.Future;+import java.util.stream.Collectors;++import javax.inject.Inject;+import javax.inject.Singleton;++import org.hibernate.criterion.Order;+import org.hibernate.criterion.Restrictions;+import org.jspecify.annotations.Nullable;+import org.slf4j.Logger;+import org.slf4j.LoggerFactory;++import dev.langchain4j.data.message.AiMessage;+import dev.langchain4j.data.message.SystemMessage;+import dev.langchain4j.data.message.UserMessage;+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 io.onedev.commons.utils.StringUtils;+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.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.service.ChatService;+import io.onedev.server.service.support.ChatResponding;+import io.onedev.server.web.SessionListener;+import io.onedev.server.web.websocket.WebSocketService;++@Singleton+public class DefaultChatService extends BaseEntityService<Chat> implements ChatService, SessionListener {++ 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 PARTIAL_RESPONSE_NOTIFICATION_INTERVAL = 1000;++ @Inject+ private ExecutorService executorService;++ @Inject+ private TransactionService transactionService;++ @Inject+ private WebSocketService webSocketService;++ 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_DATE));+ return query(criteria);+ }++ @Override+ public void createOrUpdate(Chat chat) {+ dao.persist(chat);+ }++ @Sessional+ @Override+ public ChatResponding getResponding(String sessionId, Chat chat) {+ return getResponding(sessionId, chat.getId());+ }++ @Transactional+ @Override+ public void sendRequest(String sessionId, ChatMessage request) {+ var requestId = request.getId();+ var chatId = request.getChat().getId();+ var modelSetting = request.getChat().getAi().getAiSetting().getModelSetting();+ var messages = request.getChat().getSortedMessages()+ .stream()+ .filter(it->!it.isError())+ .collect(Collectors.toList());++ if (messages.size() > MAX_HISTORY_MESSAGES)+ messages = messages.subList(messages.size()-MAX_HISTORY_MESSAGES, messages.size());++ var langchain4jMessages = messages.stream()+ .map(it -> {+ var content = it.getContent();+ if (!it.equals(request))+ content = StringUtils.abbreviate(content, MAX_HISTORY_MESSAGE_LEN);+ if (it.isRequest())+ return new UserMessage(content);+ else+ return new AiMessage(content);+ })+ .collect(Collectors.toList());++ var future = executorService.submit(() -> {+ var latch = new CountDownLatch(1);+ var handler = new StreamingChatResponseHandler() {++ private long lastPartialResponseNotificationTime = System.currentTimeMillis();++ @Override+ public void onPartialResponse(PartialResponse partialResponse, PartialResponseContext context) {+ if (latch.getCount() == 0) {+ context.streamingHandle().cancel();+ } else {+ var responding = getResponding(sessionId, chatId, requestId);+ if (responding != null) {+ var content = responding.getContent();+ if (content == null)+ content = "";+ content += partialResponse.text();+ responding.content = content;+ if (System.currentTimeMillis() - lastPartialResponseNotificationTime > PARTIAL_RESPONSE_NOTIFICATION_INTERVAL) {+ lastPartialResponseNotificationTime = System.currentTimeMillis();+ webSocketService.notifyObservableChange(Chat.getPartialResponseObservable(chatId), null);+ }+ }+ }+ }++ @Override+ public void onPartialThinking(PartialThinking partialThinking, PartialThinkingContext context) {+ if (latch.getCount() == 0)+ context.streamingHandle().cancel();+ }++ @Override+ public void onPartialToolCall(PartialToolCall partialToolCall, PartialToolCallContext context) {+ if (latch.getCount() == 0)+ context.streamingHandle().cancel();+ }++ @Override+ public void onCompleteResponse(ChatResponse completeResponse) {+ try {+ createResponseIfNecessary(sessionId, chatId, requestId, completeResponse.aiMessage().text(), null);+ } finally {+ latch.countDown();+ }+ }++ @Override+ public void onError(Throwable error) {+ try {+ createResponseIfNecessary(sessionId, chatId, requestId, "Error getting chat response, check server log for details", error);+ } finally {+ latch.countDown();+ }+ }++ };+ try {+ modelSetting.getStreamingChatModel().chat(langchain4jMessages, handler);+ transactionService.run(() -> {+ var chat = load(chatId);+ var requests = chat.getMessages().stream().filter(it->it.isRequest()).collect(Collectors.toList());+ if (requests.size() == 1) {+ var systemPrompt = String.format("""+ Summarize provided message to get a compact title with below requirements:+ 1. It should be within %d characters+ 2. Only title is returned, no other text or comments+ """, Chat.MAX_TITLE_LEN);+ var title = modelSetting.getChatModel().chat(new SystemMessage(systemPrompt), new UserMessage(requests.get(0).getContent())).aiMessage().text();+ chat.setTitle(title);+ webSocketService.notifyObservableChange(Chat.getChangeObservable(chatId), null);+ }+ });+ latch.await();+ } catch (Exception e) {+ if (ExceptionUtils.find(e, InterruptedException.class) == null) {+ logger.error("Error getting chat response", e);+ String errorMessage = e.getMessage();+ if (errorMessage == null)+ errorMessage = "Error getting chat response, check server log for details";+ createResponseIfNecessary(sessionId, chatId, requestId, errorMessage, e);+ } else {+ var responding = getResponding(sessionId, chatId, requestId);+ if (responding != null && responding.getContent() != null)+ createResponseIfNecessary(sessionId, chatId, requestId, responding.getContent(), null);+ }+ } finally {+ latch.countDown();+ 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, future));+ 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;+ }++ private void createResponseIfNecessary(String sessionId, Long chatId, Long requestId, String content, @Nullable Throwable throwable) {+ var responding = getResponding(sessionId, chatId, requestId);+ if (responding != null) {+ transactionService.run(() -> {+ var chat = load(chatId);+ if (throwable != null)+ logger.error("Error getting chat response", throwable);+ var response = new ChatMessage();+ response.setChat(chat);+ response.setError(throwable != null);+ response.setContent(content);+ dao.persist(response);+ webSocketService.notifyObservableChange(Chat.getNewMessagesObservable(chatId), null);+ });+ };+ }++ @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();+ }+ }++ 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 filediff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultGroupEntitlementService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultGroupEntitlementService.javanew file mode 100644index 0000000000..6686eed1b1--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultGroupEntitlementService.java@@ -0,0 +1,63 @@+package io.onedev.server.service.impl;++import java.util.Collection;+import java.util.List;+import java.util.stream.Collectors;++import javax.inject.Singleton;++import com.google.common.base.Preconditions;++import io.onedev.server.model.GroupEntitlement;+import io.onedev.server.model.User;+import io.onedev.server.persistence.annotation.Transactional;+import io.onedev.server.service.GroupEntitlementService;++@Singleton+public class DefaultGroupEntitlementService extends BaseEntityService<GroupEntitlement>+ implements GroupEntitlementService {++ @Override+ public List<GroupEntitlement> query() {+ return query(true);+ }++ @Override+ public int count() {+ return count(true);+ }++ @Transactional+ @Override+ public void syncEntitlements(User ai, Collection<GroupEntitlement> entitlements) {+ var newGroups = entitlements.stream()+ .map(GroupEntitlement::getGroup)+ .collect(Collectors.toSet());++ ai.getGroupEntitlements().removeIf(it -> {+ if (!newGroups.contains(it.getGroup())) {+ delete(it);+ return true;+ }+ return false;+ });++ var existingGroups = ai.getGroupEntitlements().stream()+ .map(GroupEntitlement::getGroup)+ .collect(Collectors.toSet());+ entitlements.stream()+ .filter(it -> !existingGroups.contains(it.getGroup()))+ .forEach(it -> {+ ai.getGroupEntitlements().add(it);+ dao.persist(it);+ });+ }++ @Transactional+ @Override+ public void create(GroupEntitlement entitlement) {+ Preconditions.checkState(entitlement.isNew());+ dao.persist(entitlement);+ }++}diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueChangeService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueChangeService.javaindex 730c7c4b82..8f8da53a2a 100644--- a/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueChangeService.java+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueChangeService.java@@ -1,5 +1,6 @@package io.onedev.server.service.impl;+import static io.onedev.server.model.User.Type.SERVICE;import static java.lang.Integer.MAX_VALUE;import java.util.ArrayList;@@ -170,7 +171,7 @@ public class DefaultIssueChangeService extends BaseEntityService<IssueChange>@Transactional@Overridepublic void create(IssueChange change, @Nullable String note) {- create(change, note, !change.getUser().isServiceAccount());+ create(change, note, change.getUser().getType() != SERVICE);}@Transactional@@ -317,7 +318,7 @@ public class DefaultIssueChangeService extends BaseEntityService<IssueChange>@Transactional@Overridepublic void addSchedule(User user, Issue issue, Iteration iteration) {- addSchedule(user, issue, iteration, !user.isServiceAccount());+ addSchedule(user, issue, iteration, user.getType() != SERVICE);}protected void addSchedule(User user, Issue issue, Iteration iteration, boolean sendNotifications) {@@ -348,7 +349,7 @@ public class DefaultIssueChangeService extends BaseEntityService<IssueChange>@Transactional@Overridepublic void removeSchedule(User user, Issue issue, Iteration iteration) {- removeSchedule(user, issue, iteration, !user.isServiceAccount());+ removeSchedule(user, issue, iteration, user.getType() != SERVICE);}@Transactionaldiff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultProjectEntitlementService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultProjectEntitlementService.javanew file mode 100644index 0000000000..3ff18bbe11--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultProjectEntitlementService.java@@ -0,0 +1,63 @@+package io.onedev.server.service.impl;++import java.util.Collection;+import java.util.List;+import java.util.stream.Collectors;++import javax.inject.Singleton;++import com.google.common.base.Preconditions;++import io.onedev.server.model.ProjectEntitlement;+import io.onedev.server.model.User;+import io.onedev.server.persistence.annotation.Transactional;+import io.onedev.server.service.ProjectEntitlementService;++@Singleton+public class DefaultProjectEntitlementService extends BaseEntityService<ProjectEntitlement>+ implements ProjectEntitlementService {++ @Override+ public List<ProjectEntitlement> query() {+ return query(true);+ }++ @Override+ public int count() {+ return count(true);+ }++ @Transactional+ @Override+ public void syncEntitlements(User ai, Collection<ProjectEntitlement> entitlements) {+ var newProjects = entitlements.stream()+ .map(ProjectEntitlement::getProject)+ .collect(Collectors.toSet());++ ai.getProjectEntitlements().removeIf(it -> {+ if (!newProjects.contains(it.getProject())) {+ delete(it);+ return true;+ }+ return false;+ });++ var existingProjects = ai.getProjectEntitlements().stream()+ .map(ProjectEntitlement::getProject)+ .collect(Collectors.toSet());+ entitlements.stream()+ .filter(it -> !existingProjects.contains(it.getProject()))+ .forEach(it -> {+ ai.getProjectEntitlements().add(it);+ dao.persist(it);+ });+ }++ @Transactional+ @Override+ public void create(ProjectEntitlement entitlement) {+ Preconditions.checkState(entitlement.isNew());+ dao.persist(entitlement);+ }++}diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultSettingService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultSettingService.javaindex 619274ddbc..17c4176d70 100644--- a/server-core/src/main/java/io/onedev/server/service/impl/DefaultSettingService.java+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultSettingService.java@@ -30,7 +30,7 @@ import io.onedev.server.event.entity.EntityPersisted;import io.onedev.server.event.system.SystemStarting;import io.onedev.server.model.Setting;import io.onedev.server.model.Setting.Key;-import io.onedev.server.model.support.administration.AISetting;+import io.onedev.server.model.support.administration.AiSetting;import io.onedev.server.model.support.administration.AgentSetting;import io.onedev.server.model.support.administration.AlertSetting;import io.onedev.server.model.support.administration.AuditSetting;@@ -168,8 +168,8 @@ public class DefaultSettingService extends BaseEntityService<Setting> implements}@Override- public AISetting getAISetting() {- return (AISetting) getSettingValue(Key.AI);+ public AiSetting getAiSetting() {+ return (AiSetting) getSettingValue(Key.AI);}@Override@@ -304,7 +304,7 @@ public class DefaultSettingService extends BaseEntityService<Setting> implements@Transactional@Override- public void saveAISetting(AISetting aiSetting) {+ public void saveAiSetting(AiSetting aiSetting) {saveSetting(Key.AI, aiSetting);}diff --git a/server-core/src/main/java/io/onedev/server/service/impl/DefaultUserEntitlementService.java b/server-core/src/main/java/io/onedev/server/service/impl/DefaultUserEntitlementService.javanew file mode 100644index 0000000000..2a9a5a21ab--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/impl/DefaultUserEntitlementService.java@@ -0,0 +1,63 @@+package io.onedev.server.service.impl;++import java.util.Collection;+import java.util.List;+import java.util.stream.Collectors;++import javax.inject.Singleton;++import com.google.common.base.Preconditions;++import io.onedev.server.model.User;+import io.onedev.server.model.UserEntitlement;+import io.onedev.server.persistence.annotation.Transactional;+import io.onedev.server.service.UserEntitlementService;++@Singleton+public class DefaultUserEntitlementService extends BaseEntityService<UserEntitlement>+ implements UserEntitlementService {++ @Override+ public List<UserEntitlement> query() {+ return query(true);+ }++ @Override+ public int count() {+ return count(true);+ }++ @Transactional+ @Override+ public void syncEntitlements(User ai, Collection<UserEntitlement> entitlements) {+ var newUsers = entitlements.stream()+ .map(UserEntitlement::getUser)+ .collect(Collectors.toSet());++ ai.getUserEntitlements().removeIf(it -> {+ if (!newUsers.contains(it.getUser())) {+ delete(it);+ return true;+ }+ return false;+ });++ var existingUsers = ai.getUserEntitlements().stream()+ .map(UserEntitlement::getUser)+ .collect(Collectors.toSet());+ entitlements.stream()+ .filter(it -> !existingUsers.contains(it.getUser()))+ .forEach(it -> {+ ai.getUserEntitlements().add(it);+ dao.persist(it);+ });+ }++ @Transactional+ @Override+ public void create(UserEntitlement entitlement) {+ Preconditions.checkState(entitlement.isNew());+ dao.persist(entitlement);+ }++}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.javaindex b763285ad2..b14aa55b5a 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,5 +1,7 @@package io.onedev.server.service.impl;+import static io.onedev.server.model.User.Type.SERVICE;+import java.util.Collection;import java.util.List;@@ -18,13 +20,11 @@ import org.hibernate.query.Query;import com.google.common.base.Preconditions;import com.hazelcast.core.HazelcastInstance;-import io.onedev.server.SubscriptionService;import io.onedev.server.cluster.ClusterService;import io.onedev.server.event.Listen;import io.onedev.server.event.entity.EntityPersisted;import io.onedev.server.event.entity.EntityRemoved;import io.onedev.server.event.system.SystemStarting;-import io.onedev.server.exception.NoSubscriptionException;import io.onedev.server.model.AbstractEntity;import io.onedev.server.model.EmailAddress;import io.onedev.server.model.Project;@@ -68,9 +68,6 @@ public class DefaultUserService extends BaseEntityService<User> implements UserS@Injectprivate ClusterService clusterService;-- @Inject- private SubscriptionService subscriptionService;private volatile UserCache cache;@@ -115,8 +112,6 @@ public class DefaultUserService extends BaseEntityService<User> implements UserS@Overridepublic void create(User user) {Preconditions.checkState(user.isNew());- if (user.isServiceAccount() && !subscriptionService.isSubscriptionActive())- throw new NoSubscriptionException("Service account");user.setName(user.getName().toLowerCase());dao.persist(user);}@@ -385,7 +380,7 @@ public class DefaultUserService extends BaseEntityService<User> implements UserSuser.setPassword(null);user.setPasswordResetCode(null);- user.setServiceAccount(true);+ user.setType(SERVICE);dao.persist(user);}diff --git a/server-core/src/main/java/io/onedev/server/service/support/ChatResponding.java b/server-core/src/main/java/io/onedev/server/service/support/ChatResponding.javanew file mode 100644index 0000000000..1e5af41d2e--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/service/support/ChatResponding.java@@ -0,0 +1,12 @@+package io.onedev.server.service.support;++import org.jspecify.annotations.Nullable;++public interface ChatResponding {++ @Nullable+ String getContent();++ void cancel();++}\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/util/facade/UserCache.java b/server-core/src/main/java/io/onedev/server/util/facade/UserCache.javaindex 59feef7701..9beef6442d 100644--- a/server-core/src/main/java/io/onedev/server/util/facade/UserCache.java+++ b/server-core/src/main/java/io/onedev/server/util/facade/UserCache.java@@ -6,12 +6,14 @@ import java.util.Collection;import java.util.Comparator;import java.util.HashMap;import java.util.Map;+import java.util.Set;+import java.util.function.Function;import org.jspecify.annotations.Nullable;import io.onedev.server.OneDev;-import io.onedev.server.service.UserService;import io.onedev.server.model.User;+import io.onedev.server.service.UserService;import io.onedev.server.util.MapProxy;import io.onedev.server.util.Similarities;@@ -53,19 +55,23 @@ public class UserCache extends MapProxy<Long, UserFacade> {public UserCache clone() {return new UserCache(new HashMap<>(delegate));}-- public Collection<User> getUsers(boolean includeDisabled) {++ public Collection<User> getUsers(Function<UserFacade, Boolean> filter) {UserService userService = OneDev.getInstance(UserService.class);return entrySet().stream()- .filter(it -> includeDisabled || !it.getValue().isDisabled())+ .filter(it -> filter.apply(it.getValue())).map(it -> userService.load(it.getKey())).collect(toSet());}public Collection<User> getUsers() {- return getUsers(false);+ return getUsers(it->true);}+ public Comparator<User> comparingDisplayName() {+ return comparingDisplayName(Set.of());+ }+public Comparator<User> comparingDisplayName(Collection<User> topUsers) {return (o1, o2) -> {if (topUsers.contains(o1)) {diff --git a/server-core/src/main/java/io/onedev/server/util/facade/UserFacade.java b/server-core/src/main/java/io/onedev/server/util/facade/UserFacade.javaindex d1936bfc81..777f3c6930 100644--- a/server-core/src/main/java/io/onedev/server/util/facade/UserFacade.java+++ b/server-core/src/main/java/io/onedev/server/util/facade/UserFacade.java@@ -12,16 +12,20 @@ public class UserFacade extends EntityFacade {private final String fullName;- private final boolean serviceAccount;+ private final User.Type type;private final boolean disabled;++ private final boolean entitleToAll;- public UserFacade(Long id, String name, @Nullable String fullName, boolean serviceAccount, boolean disabled) {+ public UserFacade(Long id, String name, @Nullable String fullName, User.Type type,+ boolean disabled, boolean entitleToAll) {super(id);this.name = name;this.fullName = fullName;- this.serviceAccount = serviceAccount;+ this.type = type;this.disabled = disabled;+ this.entitleToAll = entitleToAll;}public String getName() {@@ -58,12 +62,16 @@ public class UserFacade extends EntityFacade {return null;}- public boolean isServiceAccount() {- return serviceAccount;+ public User.Type getType() {+ return type;}public boolean isDisabled() {return disabled;}++ public boolean isEntitleToAll() {+ return entitleToAll;+ }}diff --git a/server-core/src/main/java/io/onedev/server/web/SessionListener.java b/server-core/src/main/java/io/onedev/server/web/SessionListener.javanew file mode 100644index 0000000000..bd0c334bbd--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/SessionListener.java@@ -0,0 +1,9 @@+package io.onedev.server.web;++public interface SessionListener {++ void sessionCreated(String sessionId);++ void sessionDestroyed(String sessionId);++}\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/WebApplication.java b/server-core/src/main/java/io/onedev/server/web/WebApplication.javaindex b4d1ddf72b..6920bae24d 100644--- a/server-core/src/main/java/io/onedev/server/web/WebApplication.java+++ b/server-core/src/main/java/io/onedev/server/web/WebApplication.java@@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;import org.apache.wicket.Application;import org.apache.wicket.Component;import org.apache.wicket.DefaultExceptionMapper;+import org.apache.wicket.ISessionListener;import org.apache.wicket.Page;import org.apache.wicket.RuntimeConfigurationType;import org.apache.wicket.Session;@@ -82,8 +83,8 @@ import io.onedev.server.web.translation.TranslationResolver;import io.onedev.server.web.translation.TranslationStringResourceLoader;import io.onedev.server.web.translation.TranslationTagHandler;import io.onedev.server.web.util.AbsoluteUrlRenderer;-import io.onedev.server.web.websocket.WebSocketService;import io.onedev.server.web.websocket.WebSocketMessages;+import io.onedev.server.web.websocket.WebSocketService;@Singletonpublic class WebApplication extends org.apache.wicket.protocol.http.WebApplication {@@ -173,6 +174,17 @@ public class WebApplication extends org.apache.wicket.protocol.http.WebApplicati}});+ getSessionListeners().add(new ISessionListener() {++ @Override+ public void onCreated(Session session) {+ }++ @Override+ public void onUnbound(String sessionId) {+ }++ });getAjaxRequestTargetListeners().add(new AjaxRequestTarget.IListener() {@Overridediff --git a/server-core/src/main/java/io/onedev/server/web/WebSession.java b/server-core/src/main/java/io/onedev/server/web/WebSession.javaindex 63cbee6a9b..7487c68abd 100644--- a/server-core/src/main/java/io/onedev/server/web/WebSession.java+++ b/server-core/src/main/java/io/onedev/server/web/WebSession.java@@ -35,6 +35,12 @@ public class WebSession extends org.apache.wicket.protocol.http.WebSession {private Map<Class<?>, String> redirectUrlsAfterDelete = new ConcurrentHashMap<>();private Set<Long> expandedProjectIds = new ConcurrentHashSet<>();++ private boolean chatVisible;++ private Long activeChatId;++ private String chatInput;public WebSession(Request request) {super(request);@@ -118,6 +124,32 @@ public class WebSession extends org.apache.wicket.protocol.http.WebSession {this.zoneId = zoneId;}+ public boolean isChatVisible() {+ return chatVisible;+ }++ public void setChatVisible(boolean chatVisible) {+ this.chatVisible = chatVisible;+ }++ @Nullable+ public Long getActiveChatId() {+ return activeChatId;+ }++ public void setActiveChatId(Long activeChatId) {+ this.activeChatId = activeChatId;+ }++ @Nullable+ public String getChatInput() {+ return chatInput;+ }++ public void setChatInput(String chatInput) {+ this.chatInput = chatInput;+ }+public static WebSession from(HttpSession session) {String attributeName = "wicket:" + OneDev.getInstance(WicketServlet.class).getServletName() + ":session";return (WebSession) session.getAttribute(attributeName);diff --git a/server-core/src/main/java/io/onedev/server/web/asset/icon/ai-setting.svg b/server-core/src/main/java/io/onedev/server/web/asset/icon/ai-setting.svgnew file mode 100644index 0000000000..34814a89a2--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/asset/icon/ai-setting.svg@@ -0,0 +1 @@+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763890408372" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6809" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M619.776 543.936a39.552 39.552 0 0 1 21.696 21.888l144.96 362.752a34.88 34.88 0 1 1-64.832 25.92l-40.704-101.76H525.632l-41.856 102.08a34.88 34.88 0 0 1-44.8 19.328l-0.768-0.32a34.88 34.88 0 0 1-19.008-45.568l148.928-362.752a39.552 39.552 0 0 1 51.648-21.568z m229.76-3.2c19.2 0 34.88 15.616 34.816 34.88l-0.576 364.48a34.88 34.88 0 0 1-69.76-0.128l0.512-364.416c0-19.264 15.68-34.88 35.008-34.88zM378.496 55.424L459.2 121.6c21.12-3.968 38.272-6.016 52.096-6.144h1.152c13.76 0 31.36 1.92 53.12 5.824l66.368-63.36A39.552 39.552 0 0 1 678.4 51.584l0.768 0.448 114.56 66.496a39.552 39.552 0 0 1 19.392 38.784L800 269.952c9.984 13.76 17.344 25.088 22.528 34.432l0.512 0.96c4.928 9.216 9.984 20.736 15.104 34.752l113.088 53.248c12.288 5.76 20.16 18.048 20.16 31.616V492.8a34.88 34.88 0 0 1-69.824 0v-45.632l-106.048-49.472-13.504-6.4-4.8-14.08a269.632 269.632 0 0 0-15.68-38.72 338.88 338.88 0 0 0-25.664-37.952l-8.448-11.136 1.664-13.888 12.48-106.496-77.632-45.12-62.464 60.224-13.248 12.8-17.92-3.712c-26.432-5.376-46.016-8-57.856-8-11.648 0-30.336 2.56-55.168 7.936l-16.448 3.52-12.992-10.624-77.568-63.488-68.48 38.016 21.76 99.648 4.224 19.392-14.528 13.568c-17.792 16.64-30.016 29.952-36.288 39.168a185.728 185.728 0 0 0-19.2 41.152l-5.44 15.36-15.296 5.696-93.632 34.816v101.632l94.464 37.76 16.064 6.4 4.608 16.768c4.8 17.536 9.728 30.528 14.272 38.592 4.416 7.744 12.032 17.088 22.912 27.648l13.44 12.992-3.392 18.368-19.072 104.384 77.376 49.92c16 10.24 20.736 31.36 10.88 47.552l-0.448 0.64a34.88 34.88 0 0 1-48.256 10.432l-94.4-60.8a39.552 39.552 0 0 1-17.472-40.32l19.52-106.816-0.896-0.96a172.928 172.928 0 0 1-20.096-27.2L192 664.96c-5.696-10.048-10.88-22.4-15.616-37.056l-0.192-0.576-97.792-39.04a39.616 39.616 0 0 1-24.896-35.968V408.32c0-16.512 10.304-31.36 25.792-37.12l98.432-36.544c6.592-16.256 13.44-29.568 20.672-40.512l0.896-1.28c7.296-10.624 17.728-22.656 31.424-36.416l-21.952-103.04a39.552 39.552 0 0 1 18.688-42.56l0.768-0.384 106.048-58.88a39.552 39.552 0 0 1 44.288 3.904z m225.856 605.632l-50.048 121.792h98.688l-48.64-121.792z m-87.68-350.848c79.808 0 149.76 51.328 174.528 125.952a34.88 34.88 0 0 1-66.304 21.952 114.112 114.112 0 1 0-157.312 138.88 34.88 34.88 0 1 1-30.08 63.04 183.872 183.872 0 0 1 79.168-349.824z" p-id="6810"></path></svg>\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/asset/icon/ai.svg b/server-core/src/main/java/io/onedev/server/web/asset/icon/ai.svgindex 88fee13aeb..6a02077153 100644--- a/server-core/src/main/java/io/onedev/server/web/asset/icon/ai.svg+++ b/server-core/src/main/java/io/onedev/server/web/asset/icon/ai.svg@@ -1 +1 @@-<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1759963509092" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M1013.775951 516.722584a12.8 12.8 0 0 1-9.322496 9.322495l-198.487702 49.599298a320 320 0 0 0-232.836121 232.836121l-49.644553 198.532957a12.8 12.8 0 0 1-24.844904-0.045255l-49.599298-198.487702a320 320 0 0 0-232.83612-232.836121L17.626545 525.95457a12.8 12.8 0 0 1 0-24.799649l198.532957-49.644553a320 320 0 0 0 232.836121-232.836121L498.640175 20.2318a12.8 12.8 0 0 1 24.844904-0.045255l49.644553 198.532957a320 320 0 0 0 232.836121 232.836121l198.487702 49.599298a12.8 12.8 0 0 1 9.322496 15.567663zM713.374363 513.554745l-9.956064-4.525483a409.792 409.792 0 0 1-187.807561-187.807561l-4.525483-9.956064-4.615993 9.956064a409.792 409.792 0 0 1-187.807561 187.807561l-9.956064 4.525483 10.001319 4.661248a409.792 409.792 0 0 1 187.762306 187.762306l4.570738 9.910809 4.615993-9.865554a409.792 409.792 0 0 1 187.807561-187.807561l9.910809-4.661248z" p-id="11022"></path><path d="M887.453079 38.673217l5.656855 22.763181c11.087434 44.576011 45.888402 79.376979 90.509668 90.509668l22.763181 5.656855a12.8 12.8 0 0 1-0.045255 24.844904l-22.717926 5.702109a124.416 124.416 0 0 0-90.509668 90.509668l-5.702109 22.717926a12.8 12.8 0 0 1-24.79965 0l-5.702109-22.717926a124.416 124.416 0 0 0-90.509668-90.509668l-22.717926-5.702109a12.8 12.8 0 0 1-0.045255-24.844904l22.763181-5.656855c44.576011-11.177944 79.376979-45.978911 90.509668-90.509668l5.656855-22.763181a12.8 12.8 0 0 1 24.890158 0z" p-id="11023"></path></svg>\ No newline at end of file+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763871574824" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1900" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M618.666667 149.333333a42.666667 42.666667 0 0 0-42.666667-42.666666h-128a42.666667 42.666667 0 1 0 0 85.333333h21.333333v42.666667h-149.333333a170.666667 170.666667 0 0 0-170.666667 170.666666v320a170.666667 170.666667 0 0 0 170.666667 170.666667h384a170.666667 170.666667 0 0 0 170.666667-170.666667V405.333333a170.666667 170.666667 0 0 0-170.666667-170.666666h-149.333333V192h21.333333a42.666667 42.666667 0 0 0 42.666667-42.666667zM320 810.666667a85.333333 85.333333 0 0 1-85.333333-85.333334V405.333333a85.333333 85.333333 0 0 1 85.333333-85.333333h384a85.333333 85.333333 0 0 1 85.333333 85.333333v320a85.333333 85.333333 0 0 1-85.333333 85.333334H320zM64 448a42.666667 42.666667 0 0 0-42.666667 42.666667v149.333333a42.666667 42.666667 0 1 0 85.333334 0v-149.333333a42.666667 42.666667 0 0 0-42.666667-42.666667z m896 0a42.666667 42.666667 0 0 0-42.666667 42.666667v149.333333a42.666667 42.666667 0 1 0 85.333334 0v-149.333333a42.666667 42.666667 0 0 0-42.666667-42.666667z m-512 117.333333a53.333333 53.333333 0 1 0-106.666667 0 53.333333 53.333333 0 0 0 106.666667 0z m234.666667 0a53.333333 53.333333 0 1 0-106.666667 0 53.333333 53.333333 0 0 0 106.666667 0z" p-id="1901"></path></svg>\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/behavior/AgentQueryBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/AgentQueryBehavior.javaindex 2d5c3d49e4..1806f5979f 100644--- a/server-core/src/main/java/io/onedev/server/web/behavior/AgentQueryBehavior.java+++ b/server-core/src/main/java/io/onedev/server/web/behavior/AgentQueryBehavior.java@@ -186,14 +186,14 @@ public class AgentQueryBehavior extends ANTLRAssistBehavior {}}}- if (getSettingService().getAISetting().getLiteModelSetting() == null)+ if (getSettingService().getAiSetting().getLiteModelSetting() == null)hints.add(_T("<a href='/~administration/settings/lite-ai-model' target='_blank'>Set up AI</a> to query with natural language</a>"));return hints;}@Overrideprotected NaturalLanguageTranslator getNaturalLanguageTranslator() {- var liteModel = getSettingService().getAISetting().getLiteModel();+ var liteModel = getSettingService().getAiSetting().getLiteModel();if (liteModel != null) {return new NaturalLanguageTranslator(liteModel) {diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/BuildQueryBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/BuildQueryBehavior.javaindex d21a879fc2..a51077b330 100644--- a/server-core/src/main/java/io/onedev/server/web/behavior/BuildQueryBehavior.java+++ b/server-core/src/main/java/io/onedev/server/web/behavior/BuildQueryBehavior.java@@ -256,14 +256,14 @@ public class BuildQueryBehavior extends ANTLRAssistBehavior {}}}- if (getSettingService().getAISetting().getLiteModelSetting() == null)+ if (getSettingService().getAiSetting().getLiteModelSetting() == null)hints.add(_T("<a href='/~administration/settings/lite-ai-model' target='_blank'>Set up AI</a> to query with natural language"));return hints;}@Overrideprotected NaturalLanguageTranslator getNaturalLanguageTranslator() {- var liteModel = getSettingService().getAISetting().getLiteModel();+ var liteModel = getSettingService().getAiSetting().getLiteModel();if (liteModel != null) {return new NaturalLanguageTranslator(liteModel) {diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/CommitQueryBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/CommitQueryBehavior.javaindex 2a6e075c42..9ba83a569e 100644--- a/server-core/src/main/java/io/onedev/server/web/behavior/CommitQueryBehavior.java+++ b/server-core/src/main/java/io/onedev/server/web/behavior/CommitQueryBehavior.java@@ -159,7 +159,7 @@ public class CommitQueryBehavior extends ANTLRAssistBehavior {}}}- if (getSettingService().getAISetting().getLiteModelSetting() == null)+ if (getSettingService().getAiSetting().getLiteModelSetting() == null)hints.add(_T("<a href='/~administration/settings/lite-ai-model' target='_blank'>Set up AI</a> to query with natural language</a>"));return hints;}@@ -201,7 +201,7 @@ public class CommitQueryBehavior extends ANTLRAssistBehavior {@Overrideprotected NaturalLanguageTranslator getNaturalLanguageTranslator() {- var liteModel = getSettingService().getAISetting().getLiteModel();+ var liteModel = getSettingService().getAiSetting().getLiteModel();if (liteModel != null) {return new NaturalLanguageTranslator(liteModel) {diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/IssueQueryBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/IssueQueryBehavior.javaindex 0a17b3fc1b..92dd018a2a 100644--- a/server-core/src/main/java/io/onedev/server/web/behavior/IssueQueryBehavior.java+++ b/server-core/src/main/java/io/onedev/server/web/behavior/IssueQueryBehavior.java@@ -416,7 +416,7 @@ public class IssueQueryBehavior extends ANTLRAssistBehavior {}}}- if (getSettingService().getAISetting().getLiteModelSetting() == null)+ if (getSettingService().getAiSetting().getLiteModelSetting() == null)hints.add(_T("<a href='/~administration/settings/lite-ai-model' target='_blank'>Set up AI</a> to query with natural language</a>"));return hints;}@@ -429,7 +429,7 @@ public class IssueQueryBehavior extends ANTLRAssistBehavior {@Overrideprotected NaturalLanguageTranslator getNaturalLanguageTranslator() {- var liteModel = getSettingService().getAISetting().getLiteModel();+ var liteModel = getSettingService().getAiSetting().getLiteModel();if (liteModel != null) {return new NaturalLanguageTranslator(liteModel) {diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/PackQueryBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/PackQueryBehavior.javaindex 4936a55601..d6fc382f02 100644--- a/server-core/src/main/java/io/onedev/server/web/behavior/PackQueryBehavior.java+++ b/server-core/src/main/java/io/onedev/server/web/behavior/PackQueryBehavior.java@@ -226,14 +226,14 @@ public class PackQueryBehavior extends ANTLRAssistBehavior {}}}- if (getSettingService().getAISetting().getLiteModelSetting() == null)+ if (getSettingService().getAiSetting().getLiteModelSetting() == null)hints.add(_T("<a href='/~administration/settings/lite-ai-model' target='_blank'>Set up AI</a> to query with natural language</a>"));return hints;}@Overrideprotected NaturalLanguageTranslator getNaturalLanguageTranslator() {- var liteModel = getSettingService().getAISetting().getLiteModel();+ var liteModel = getSettingService().getAiSetting().getLiteModel();if (liteModel != null) {return new NaturalLanguageTranslator(liteModel) {diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/ProjectQueryBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/ProjectQueryBehavior.javaindex 210257712e..2a14ebe781 100644--- a/server-core/src/main/java/io/onedev/server/web/behavior/ProjectQueryBehavior.java+++ b/server-core/src/main/java/io/onedev/server/web/behavior/ProjectQueryBehavior.java@@ -225,14 +225,14 @@ public class ProjectQueryBehavior extends ANTLRAssistBehavior {}}}- if (getSettingService().getAISetting().getLiteModelSetting() == null)+ if (getSettingService().getAiSetting().getLiteModelSetting() == null)hints.add(_T("<a href='/~administration/settings/lite-ai-model' target='_blank'>Set up AI</a> to query with natural language</a>"));return hints;}@Overrideprotected NaturalLanguageTranslator getNaturalLanguageTranslator() {- var liteModel = getSettingService().getAISetting().getLiteModel();+ var liteModel = getSettingService().getAiSetting().getLiteModel();if (liteModel != null) {return new NaturalLanguageTranslator(liteModel) {diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/PullRequestQueryBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/PullRequestQueryBehavior.javaindex 21385c3e0c..e62241b014 100644--- a/server-core/src/main/java/io/onedev/server/web/behavior/PullRequestQueryBehavior.java+++ b/server-core/src/main/java/io/onedev/server/web/behavior/PullRequestQueryBehavior.java@@ -261,7 +261,7 @@ public class PullRequestQueryBehavior extends ANTLRAssistBehavior {}}}- if (getSettingService().getAISetting().getLiteModelSetting() == null)+ if (getSettingService().getAiSetting().getLiteModelSetting() == null)hints.add(_T("<a href='/~administration/settings/lite-ai-model' target='_blank'>Set up AI</a> to query with natural language</a>"));return hints;}@@ -274,7 +274,7 @@ public class PullRequestQueryBehavior extends ANTLRAssistBehavior {@Overrideprotected NaturalLanguageTranslator getNaturalLanguageTranslator() {- var liteModel = getSettingService().getAISetting().getLiteModel();+ var liteModel = getSettingService().getAiSetting().getLiteModel();if (liteModel != null) {return new NaturalLanguageTranslator(liteModel) {diff --git a/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.html b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.htmlnew file mode 100644index 0000000000..2684c5fd56--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.html@@ -0,0 +1,28 @@+<wicket:panel>+ <div class="ui-resizable-handle ui-resizable-w"></div>+ <div class="head d-flex align-items-center justify-content-between px-4 py-3 border-bottom">+ <h5 class="card-title mb-0"><wicket:t>Chat with</wicket:t> <a wicket:id="aiSelector" class="ml-2"><img wicket:id="avatar"></img> <span wicket:id="name"></span> <wicket:svg href="arrow" class="icon rotate-90"></wicket:svg></a></h5>+ <a wicket:id="close" t:data-tippy-content="Close" class="btn btn-xs btn-icon btn-light btn-hover-primary"><wicket:svg href="times" class="icon"/></a>+ </div>+ <div class="body d-flex flex-column flex-grow-1 p-4 position-relative" style="overflow: hidden;">+ <div wicket:id="chatSelectorContainer" class="chat-selector d-flex flex-shrink-0 mb-3">+ <input wicket:id="chatSelector" t:placeholder="New chat" type="hidden" class="form-control">+ <a wicket:id="newChat" t:data-tippy-content="New chat" class="btn btn-light btn-hover-primary btn-icon flex-shrink-0"><wicket:svg href="plus" class="icon icon-lg"></wicket:svg></a>+ <a wicket:id="deleteChat" t:data-tippy-content="Delete chat" class="btn btn-light btn-hover-danger btn-icon flex-shrink-0"><wicket:svg href="trash" class="icon icon-lg"></wicket:svg></a>+ </div>+ <ul class="messages list-unstyled mb-2 flex-grow-1 overflow-auto">+ <li wicket:id="messages" class="message">+ <div wicket:id="content"></div>+ </li>+ <li wicket:id="responding" class="responding">+ <div class="breathing-dot"></div>+ <div wicket:id="content" class="mt-2"></div>+ </li>+ </ul>+ <form wicket:id="send" class="send flex-shrink-0 position-relative">+ <textarea wicket:id="input" class="form-control" t:placeholder="Type your message here"></textarea>+ <a wicket:id="submit" class="submit position-absolute btn btn-primary btn-icon btn-sm" t:data-tippy-content="Send"><wicket:svg href="arrow2" class="icon rotate-270"></wicket:svg></a>+ <a wicket:id="stop" class="stop position-absolute btn btn-primary btn-icon btn-sm" t:data-tippy-content="Stop"><wicket:svg href="stop" class="icon"></wicket:svg></a>+ </form>+ </div>+</wicket:panel>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.javanew file mode 100644index 0000000000..bd90669e2d--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatPanel.java@@ -0,0 +1,524 @@+package io.onedev.server.web.component.ai.chat;++import static io.onedev.server.security.SecurityUtils.getUser;+import static io.onedev.server.web.translation.Translation._T;++import java.util.ArrayList;+import java.util.Collection;+import java.util.Collections;+import java.util.Date;+import java.util.List;+import java.util.stream.Collectors;++import javax.inject.Inject;+import javax.servlet.http.Cookie;++import org.apache.wicket.Component;+import org.apache.wicket.ajax.AjaxRequestTarget;+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.markup.head.IHeaderResponse;+import org.apache.wicket.markup.head.JavaScriptHeaderItem;+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;+import org.apache.wicket.markup.html.WebMarkupContainer;+import org.apache.wicket.markup.html.basic.Label;+import org.apache.wicket.markup.html.form.Form;+import org.apache.wicket.markup.html.form.TextArea;+import org.apache.wicket.markup.html.panel.Panel;+import org.apache.wicket.markup.repeater.RepeatingView;+import org.apache.wicket.model.AbstractReadOnlyModel;+import org.apache.wicket.model.IModel;+import org.apache.wicket.model.Model;+import org.apache.wicket.request.cycle.RequestCycle;+import org.apache.wicket.request.http.WebRequest;+import org.apache.wicket.request.http.WebResponse;+import org.json.JSONException;+import org.json.JSONWriter;+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.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.web.WebConstants;+import io.onedev.server.web.WebSession;+import io.onedev.server.web.behavior.ChangeObserver;+import io.onedev.server.web.behavior.OnTypingDoneBehavior;+import io.onedev.server.web.component.MultilineLabel;+import io.onedev.server.web.component.floating.FloatingPanel;+import io.onedev.server.web.component.markdown.MarkdownViewer;+import io.onedev.server.web.component.menu.MenuItem;+import io.onedev.server.web.component.menu.MenuLink;+import io.onedev.server.web.component.select2.ChoiceProvider;+import io.onedev.server.web.component.select2.ResponseFiller;+import io.onedev.server.web.component.select2.Select2Choice;+import io.onedev.server.web.component.user.UserAvatar;++public class ChatPanel extends Panel {++ private static final long serialVersionUID = 1L;++ private static final String COOKIE_ACTIVE_AI = "active-ai";++ @Inject+ private UserService userService;++ @Inject+ private ChatService chatService;++ @Inject+ private Dao dao;++ private Long activeAiId;++ private RepeatingView messagesView;++ private WebMarkupContainer respondingContainer;++ public ChatPanel(String componentId) {+ super(componentId);++ WebRequest request = (WebRequest) RequestCycle.get().getRequest();+ Cookie cookie = request.getCookie(COOKIE_ACTIVE_AI);+ if (cookie != null)+ activeAiId = Long.valueOf(cookie.getValue());+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ var aiSelector = new MenuLink("aiSelector") {++ @Override+ protected List<MenuItem> getMenuItems(FloatingPanel dropdown) {+ var activeAI = getActiveAI();+ var menuItems = new ArrayList<MenuItem>();+ for (var ai : getUser().getEntitledAis()) {+ menuItems.add(new MenuItem() {++ @Override+ public String getLabel() {+ return ai.getDisplayName();+ }++ @Override+ public WebMarkupContainer newLink(String id) {+ return new AjaxLink<Void>(id) {++ @Override+ public void onClick(AjaxRequestTarget target) {+ setActiveAI(ai);+ WebSession.get().setActiveChatId(null);+ target.add(ChatPanel.this);+ }++ };+ }++ public boolean isSelected() {+ return ai.equals(activeAI);+ }++ });+ }+ return menuItems;+ }++ @Override+ protected void onBeforeRender() {+ addOrReplace(new UserAvatar("avatar", getActiveAI()));+ addOrReplace(new Label("name", getActiveAI().getDisplayName()));+ super.onBeforeRender();+ }+ };+ add(aiSelector);++ add(new AjaxLink<Void>("close") {++ @Override+ public void onClick(AjaxRequestTarget target) {+ hide(target);+ }++ });++ var chatSelectorContainer = new WebMarkupContainer("chatSelectorContainer");+ chatSelectorContainer.setOutputMarkupId(true);+ chatSelectorContainer.add(new Select2Choice<Chat>("chatSelector", new IModel<Chat>() {++ @Override+ public void detach() {+ }++ @Override+ public Chat getObject() {+ return getActiveChat();+ }++ @Override+ public void setObject(Chat object) {+ WebSession.get().setActiveChatId(object.getId());+ }++ }, new ChoiceProvider<Chat>() {++ @Override+ public void query(String term, int page, io.onedev.server.web.component.select2.Response<Chat> response) {+ var count = (page+1) * WebConstants.PAGE_SIZE + 1;+ var chats = chatService.query(getUser(), getActiveAI(), term, count);+ new ResponseFiller<>(response).fill(chats, page, WebConstants.PAGE_SIZE);+ }++ @Override+ public void toJson(Chat choice, JSONWriter writer) throws JSONException {+ writer.key("id").value(choice.getId()).key("text").value(choice.getTitle());+ }++ @Override+ public Collection<Chat> toChoices(Collection<String> ids) {+ return ids.stream().map(it->chatService.load(Long.valueOf(it))).collect(Collectors.toList());+ }++ }).add(new AjaxFormComponentUpdatingBehavior("change") {++ @Override+ protected void onUpdate(AjaxRequestTarget target) {+ target.add(ChatPanel.this);+ }++ }));+ chatSelectorContainer.add(new ChangeObserver() {++ @Override+ protected Collection<String> findObservables() {+ var chat = getActiveChat();+ if (chat != null)+ return Collections.singleton(Chat.getChangeObservable(chat.getId()));+ else+ return Collections.emptySet();+ }++ public void onObservableChanged(IPartialPageRequestHandler handler, Collection<String> changedObservables) {+ handler.add(chatSelectorContainer);+ }++ });+ chatSelectorContainer.add(new ChangeObserver() {++ @Override+ protected Collection<String> findObservables() {+ var chat = getActiveChat();+ if (chat != null)+ return Collections.singleton(Chat.getNewMessagesObservable(chat.getId()));+ else+ return Collections.emptySet();+ }++ @Override+ public void onObservableChanged(IPartialPageRequestHandler handler, Collection<String> changedObservables) {+ showNewMessages(handler);+ }+ });+++ chatSelectorContainer.add(new AjaxLink<Void>("newChat") {++ @Override+ public void onClick(AjaxRequestTarget target) {+ WebSession.get().setActiveChatId(null);+ target.add(ChatPanel.this);+ }++ });+ chatSelectorContainer.add(new AjaxLink<Void>("deleteChat") {++ @Override+ public void onClick(AjaxRequestTarget target) {+ getSession().success(_T("Chat deleted"));+ chatService.delete(getActiveChat());+ WebSession.get().setActiveChatId(null);+ target.add(ChatPanel.this);+ }++ @Override+ protected void onConfigure() {+ super.onConfigure();+ setVisible(getActiveChat() != null);+ }++ });+ add(chatSelectorContainer);++ respondingContainer = new WebMarkupContainer("responding") {++ @Override+ protected void onConfigure() {+ super.onConfigure();+ setVisible(getResponding() != null);+ }++ @Override+ public void renderHead(IHeaderResponse response) {+ super.renderHead(response);+ response.render(OnDomReadyHeaderItem.forScript(String.format("""+ setTimeout(() => {+ var $responding = $('#%s');+ if ($responding.is(":visible"))+ $responding[0].scrollIntoView({ block: "end" });+ }, 0);+ """, getMarkupId())));+ }++ };+ respondingContainer.add(new MarkdownViewer("content", new AbstractReadOnlyModel<String>() {++ @Override+ public String getObject() {+ var responding = getResponding();+ if (responding != null)+ return responding.getContent();+ else+ return null;+ }++ }, null));+ respondingContainer.add(new ChangeObserver() {++ @Override+ protected Collection<String> findObservables() {+ var chat = getActiveChat();+ if (chat != null)+ return Collections.singleton(Chat.getPartialResponseObservable(chat.getId()));+ else+ return Collections.emptySet();+ }++ });++ respondingContainer.setOutputMarkupPlaceholderTag(true);+ add(respondingContainer);++ var form = new Form<Void>("send");+ form.add(new TextArea<String>("input", new IModel<String>() {++ @Override+ public void detach() {+ }++ @Override+ public String getObject() {+ return WebSession.get().getChatInput();+ }++ @Override+ public void setObject(String object) {+ WebSession.get().setChatInput(object);+ }++ }).add(new OnTypingDoneBehavior() {++ @Override+ protected void onTypingDone(AjaxRequestTarget target) {+ }++ }));+ form.setOutputMarkupId(true);++ form.add(new AjaxButton("submit") {++ @Override+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {+ var input = WebSession.get().getChatInput().trim();+ var chat = getActiveChat();+ if (chat == null) {+ chat = new Chat();+ chat.setUser(getUser());+ chat.setAi(getActiveAI());+ chat.setTitle(_T("New chat"));+ chat.setDate(new Date());+ chatService.createOrUpdate(chat);+ WebSession.get().setActiveChatId(chat.getId());+ target.add(chatSelectorContainer);+ }+ var request = new ChatMessage();+ request.setChat(chat);+ request.setRequest(true);+ request.setContent(input);+ chat.getMessages().add(request);+ dao.persist(request);+ chatService.sendRequest(getSession().getId(), request);++ showNewMessages(target);+ target.add(respondingContainer);++ WebSession.get().setChatInput(null);+ target.appendJavaScript("""+ var $send = $(".chat>.body>.send");+ $send.find("textarea").val("");+ $send.find("a.submit").attr("disabled", "disabled");+ """);+ }++ });++ form.add(new AjaxLink<Void>("stop") {++ @Override+ public void onClick(AjaxRequestTarget target) {+ var responding = getResponding();+ if (responding != null)+ responding.cancel();+ }++ });++ add(form);++ add(AttributeAppender.append("class", "chat d-flex flex-column"));+ setOutputMarkupPlaceholderTag(true);+ }++ private User getActiveAI() {+ if (activeAiId != null) {+ var ai = userService.get(activeAiId);+ if (ai != null && getUser().getEntitledAis().contains(ai))+ return ai;+ }+ return getUser().getEntitledAis().get(0);+ }++ private void setActiveAI(User ai) {+ activeAiId = ai.getId();++ WebResponse response = (WebResponse) RequestCycle.get().getResponse();+ Cookie cookie = new Cookie(COOKIE_ACTIVE_AI, activeAiId.toString());+ cookie.setMaxAge(Integer.MAX_VALUE);+ cookie.setPath("/");+ response.addCookie(cookie);+ }++ @Nullable+ private Chat getActiveChat() {+ var activeChatId = WebSession.get().getActiveChatId();+ if (activeChatId != null) {+ var chat = chatService.get(activeChatId);+ if (chat != null && chat.getAi().equals(getActiveAI()))+ return chat;+ }+ return null;+ }++ @Nullable+ private ChatResponding getResponding() {+ var chat = getActiveChat();+ if (chat != null)+ return chatService.getResponding(getSession().getId(), chat);+ else+ return null;+ }++ private List<ChatMessage> getMessages() {+ var chat = getActiveChat();+ if (chat != null)+ return chat.getSortedMessages();+ else+ return Collections.emptyList();+ }++ @SuppressWarnings("deprecation")+ private void showNewMessages(IPartialPageRequestHandler handler) {+ long lastMessageId;+ if (messagesView.size() != 0)+ lastMessageId = (Long) messagesView.get(messagesView.size() - 1).getDefaultModelObject();+ else+ lastMessageId = 0;+ getMessages().stream().filter(it -> it.getId() > lastMessageId).forEach(it -> {+ var messageContainer = newMessageContainer(messagesView.newChildId(), it);+ messagesView.add(messageContainer);+ handler.prependJavaScript(String.format("""+ $('#%s').before($("<li class='message' id='%s'></li>"));+ """, respondingContainer.getMarkupId(), messageContainer.getMarkupId()));+ handler.add(messageContainer);+ });+ var lastMessage = messagesView.get(messagesView.size() - 1);+ handler.appendJavaScript(String.format("""+ $('#%s')[0].scrollIntoView({ block: "end" });+ """, lastMessage.getMarkupId()));+ }++ private Component newMessageContainer(String containerId, ChatMessage message) {+ var messageContainer = new WebMarkupContainer(containerId, Model.of(message.getId()));+ if (message.isError() || message.isRequest()) {+ messageContainer.add(new MultilineLabel("content", message.getContent()));+ } else {+ messageContainer.add(new MarkdownViewer("content", Model.of(message.getContent()), null));+ }++ if (message.isError())+ messageContainer.add(AttributeAppender.append("class", "error"));+ else if (message.isRequest())+ messageContainer.add(AttributeAppender.append("class", "request"));+ else+ messageContainer.add(AttributeAppender.append("class", "response"));++ messageContainer.setOutputMarkupId(true);++ return messageContainer;+ }++ @Override+ protected void onBeforeRender() {+ messagesView = new RepeatingView("messages");+ for (var message: getMessages()) {+ messagesView.add(newMessageContainer(messagesView.newChildId(), message));+ }+ addOrReplace(messagesView);++ WebRequest request = (WebRequest) RequestCycle.get().getRequest();+ Cookie cookie = request.getCookie("chat.width");+ if (cookie != null)+ add(AttributeAppender.replace("style", "width:" + cookie.getValue() + "px"));+ else+ add(AttributeAppender.replace("style", "width:400px"));+ super.onBeforeRender();+ }++ @Override+ protected void onConfigure() {+ super.onConfigure();+ setVisible(WebSession.get().isChatVisible());+ }++ @Override+ public void renderHead(IHeaderResponse response) {+ super.renderHead(response);+ response.render(JavaScriptHeaderItem.forReference(new ChatResourceReference()));+ response.render(OnDomReadyHeaderItem.forScript("onedev.server.chat.onDomReady();"));+ }++ @Override+ public boolean isVisible() {+ return WebSession.get().isChatVisible();+ }++ public void show(AjaxRequestTarget target) {+ if (!isVisible()) {+ WebSession.get().setChatVisible(true);+ WebSession.get().setActiveChatId(null);+ target.add(this);+ }+ }++ public void hide(AjaxRequestTarget target) {+ WebSession.get().setChatVisible(false);+ target.add(this);+ }++}\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatResourceReference.java b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatResourceReference.javanew file mode 100644index 0000000000..0f71ae7fd1--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/ChatResourceReference.java@@ -0,0 +1,29 @@+package io.onedev.server.web.component.ai.chat;++import java.util.List;++import org.apache.wicket.markup.head.CssHeaderItem;+import org.apache.wicket.markup.head.HeaderItem;+import org.apache.wicket.markup.head.JavaScriptHeaderItem;++import io.onedev.server.web.asset.jqueryui.JQueryUIResourceReference;+import io.onedev.server.web.page.base.BaseDependentCssResourceReference;+import io.onedev.server.web.page.base.BaseDependentResourceReference;++public class ChatResourceReference extends BaseDependentResourceReference {++ private static final long serialVersionUID = 1L;++ public ChatResourceReference() {+ super(ChatResourceReference.class, "chat.js");+ }++ @Override+ public List<HeaderItem> getDependencies() {+ List<HeaderItem> dependencies = super.getDependencies();+ dependencies.add(JavaScriptHeaderItem.forReference(new JQueryUIResourceReference()));+ dependencies.add(CssHeaderItem.forReference(new BaseDependentCssResourceReference(getScope(), "chat.css")));+ return dependencies;+ }++}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.cssnew file mode 100644index 0000000000..6e6a6c5a21--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.css@@ -0,0 +1,133 @@+.chat {+ position: fixed;+ top: calc(var(--topbar-height) + 1rem);+ bottom: 0;+ right: 0;+ z-index: 1000;+ border-radius: 0.42rem 0 0 0;+ background: white;+ box-shadow: 0 0 12px rgba(0,0,0,0.2), 0 -2px 8px rgba(0,0,0,0.1);+}+.chat>.head {+ border-radius: 0.42rem 0 0 0;+}+.dark-mode .chat {+ background-color: var(--dark-mode-dark);+ box-shadow: 0 0 20px rgb(0 0 0 / 50%), 0 -2px 15px rgb(0 0 0 / 30%);+}++.chat .ui-resizable-handle {+ position: absolute;+ left: 0;+ top: 0.42rem;+ bottom: 0;+ width: 3px;+ cursor: col-resize;+ z-index: 10;+ background: var(--light) url(/~icon/grip3.svg) no-repeat scroll center center;+ background-size: 18px 18px;+}++.dark-mode .chat .ui-resizable-handle {+ background: var(--dark-mode-light-dark) url(/~icon/dark-grip3.svg) no-repeat scroll center center;+ background-size: 18px 18px;+}++.chat>.body>.chat-selector {+ overflow: hidden;+ min-width: 0;+ gap: 0.5rem;+}+.chat>.body>.chat-selector>:first-child {+ flex: 1;+ min-width: 0;+ overflow: hidden;+}+.chat>.body>.send textarea {+ max-height: 160px;+}+.chat>.body>.send a {+ border-radius: 50px;+ width: 27px;+ height: 27px;+ right: 6px;+ bottom: 6px;+}+.chat>.body>.send a.disabled {+ opacity: 0.5;+ cursor: not-allowed;+ pointer-events: none;+}++.chat>.body>.messages>li {+ margin-bottom: 1rem;+}+.chat>.body>.messages>li:last-child {+ margin-bottom: 0;+}++.chat>.body>.messages>.request {+ display: flex;+ justify-content: flex-end;+}+.chat>.body>.messages>.response+.responding {+ display: none;+}+.chat>.body>.messages>.response, .chat>.body>.messages>.error {+ display: flex;+ justify-content: flex-start;+}+.chat>.body>.messages>.response>div, .chat>.body>.messages>.error>div {+ margin-right: 3rem;+}+.chat>.body>.messages>.request>div {+ background: var(--light);+ padding: 0.7rem;+ border-radius: 0.42rem;+ margin-left: 3rem;+}+.dark-mode .chat>.body>.messages>.request>div {+ background: var(--dark-mode-light-dark);+}++.chat>.body>.messages>.error>div {+ background: var(--light-danger);+ padding: 0.7rem;+ border-radius: 0.42rem;+}+.dark-mode .chat>.body>.messages>.error>div {+ background: #3a2434;+ color: var(--danger);+}++.chat>.body>.messages>.responding .breathing-dot {+ width: 16px;+ height: 16px;+ border-radius: 50%;+ background-color: var(--gray-dark);+ animation: breathing 1.5s ease-in-out infinite;+}++.dark-mode .chat>.body>.messages>.responding .breathing-dot {+ background-color: var(--dark-mode-gray);+}++@keyframes breathing {+ 0%, 100% {+ transform: scale(0.6);+ }+ 50% {+ transform: scale(1);+ }+}++.chat>.body:has(.messages>.responding:not(.response + .responding))>.send .submit {+ display: none;+}+.chat>.body:not(:has(.messages>.responding:not(.response + .responding)))>.send .stop {+ display: none;+}+.chat>.body>.send .stop svg {+ width: 12px !important;+ height: 12px !important;+}\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.js b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.jsnew file mode 100644index 0000000000..07609ee01e--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/ai/chat/chat.js@@ -0,0 +1,41 @@+onedev.server.chat = {+ onDomReady: function() {+ var $chat = $(".chat");+ var $resizeHandle = $chat.children(".ui-resizable-handle");+ $chat.resizable({+ autoHide: false,+ handles: {"w": $resizeHandle},+ minWidth: 300,+ stop: function(e, ui) {+ Cookies.set("chat.width", ui.size.width, {expires: Infinity});+ }+ });++ var $textarea = $chat.find(">.body>.send textarea");+ var $submit = $chat.find(">.body>.send a.submit");++ function updateSubmit() {+ var $responding = $chat.find(">.body>.messages>.responding");+ var isEmpty = $textarea.val().trim() === "";+ $submit.toggleClass("disabled", isEmpty);+ if (isEmpty && !$responding.is(":visible")) {+ $submit.attr("disabled", "disabled");+ } else {+ $submit.removeAttr("disabled");+ }+ }++ updateSubmit();++ $textarea.on("input", updateSubmit);++ $textarea.keydown(function(e) {+ if (e.keyCode == 13 && !e.shiftKey) {+ e.preventDefault();+ if ($textarea.val().trim() !== "" && !$submit.hasClass("disabled")) {+ $submit.click();+ }+ }+ });+ }+}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.javaindex 4ebf8870a8..30583d100a 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@@ -1373,6 +1373,19 @@ public abstract class RevisionDiffPanel extends Panel {private WebMarkupContainer newNavigationContainer() {WebMarkupContainer navigationContainer = new WebMarkupContainer("navigation") {+ @Override+ protected void onBeforeRender() {+ WebRequest request = (WebRequest) RequestCycle.get().getRequest();+ Cookie cookie = request.getCookie(COOKIE_NAVIGATION_WIDTH);+ // cookie will not be sent for websocket request+ if (cookie != null)+ add(AttributeAppender.replace("style", "width:" + cookie.getValue() + "px"));+ else+ add(AttributeAppender.replace("style", "width:360px"));++ super.onBeforeRender();+ }+@Overridepublic void renderHead(IHeaderResponse response) {super.renderHead(response);@@ -1380,15 +1393,6 @@ public abstract class RevisionDiffPanel extends Panel {}};-- float navigationWidth = 360;- WebRequest request = (WebRequest) RequestCycle.get().getRequest();- Cookie cookie = request.getCookie(COOKIE_NAVIGATION_WIDTH);- // cookie will not be sent for websocket request- if (cookie != null)- navigationWidth = Float.parseFloat(cookie.getValue());-- navigationContainer.add(AttributeAppender.append("style", "width:" + navigationWidth + "px"));var changes = new TreeMap<String, BlobChange>();var treeState = new HashSet<String>();@@ -1551,6 +1555,19 @@ public abstract class RevisionDiffPanel extends Panel {private WebMarkupContainer newCommentContainer() {WebMarkupContainer commentContainer = new WebMarkupContainer("comment", Model.of((Mark)null)) {+ @Override+ protected void onBeforeRender() {+ WebRequest request = (WebRequest) RequestCycle.get().getRequest();+ Cookie cookie = request.getCookie(COOKIE_COMMENT_WIDTH);+ // cookie will not be sent for websocket request+ if (cookie != null)+ add(AttributeAppender.replace("style", "width:" + cookie.getValue() + "px"));+ else+ add(AttributeAppender.replace("style", "width:360px"));++ super.onBeforeRender();+ }+@Overridepublic void renderHead(IHeaderResponse response) {super.renderHead(response);@@ -1560,15 +1577,6 @@ public abstract class RevisionDiffPanel extends Panel {};commentContainer.setOutputMarkupPlaceholderTag(true);- float commentWidth = 360;- WebRequest request = (WebRequest) RequestCycle.get().getRequest();- Cookie cookie = request.getCookie(COOKIE_COMMENT_WIDTH);- // cookie will not be sent for websocket request- if (cookie != null)- commentWidth = Float.parseFloat(cookie.getValue());-- commentContainer.add(AttributeAppender.append("style", "width:" + commentWidth + "px"));-WebMarkupContainer head = new WebMarkupContainer("head");head.setOutputMarkupId(true);commentContainer.add(head);diff --git a/server-core/src/main/java/io/onedev/server/web/component/entity/watches/EntityWatchesPanel.java b/server-core/src/main/java/io/onedev/server/web/component/entity/watches/EntityWatchesPanel.javaindex 36c0b21a91..4417ed6f1c 100644--- a/server-core/src/main/java/io/onedev/server/web/component/entity/watches/EntityWatchesPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/entity/watches/EntityWatchesPanel.java@@ -1,5 +1,6 @@package io.onedev.server.web.component.entity.watches;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import java.util.ArrayList;@@ -109,7 +110,7 @@ public abstract class EntityWatchesPanel extends Panel {@Overrideprotected void onConfigure() {super.onConfigure();- setVisible(SecurityUtils.getAuthUser() != null && !SecurityUtils.getAuthUser().isServiceAccount());+ setVisible(SecurityUtils.getAuthUser() != null && SecurityUtils.getAuthUser().getType() == ORDINARY);}@Overridediff --git a/server-core/src/main/java/io/onedev/server/web/component/issue/list/BatchEditPanel.java b/server-core/src/main/java/io/onedev/server/web/component/issue/list/BatchEditPanel.javaindex 1568d1ce5a..dbefe8a9d9 100644--- a/server-core/src/main/java/io/onedev/server/web/component/issue/list/BatchEditPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/issue/list/BatchEditPanel.java@@ -1,5 +1,6 @@package io.onedev.server.web.component.issue.list;+import static io.onedev.server.model.User.Type.SERVICE;import static io.onedev.server.web.component.issue.list.BuiltInFieldsBean.NAME_CONFIDENTIAL;import static io.onedev.server.web.component.issue.list.BuiltInFieldsBean.NAME_ITERATION;import static io.onedev.server.web.component.issue.list.BuiltInFieldsBean.NAME_STATE;@@ -20,7 +21,6 @@ import java.util.Map;import java.util.Set;import java.util.stream.Collectors;-import org.jspecify.annotations.Nullable;import javax.validation.ValidationException;import org.apache.wicket.AttributeModifier;@@ -39,14 +39,13 @@ import org.apache.wicket.markup.html.list.ListView;import org.apache.wicket.markup.html.panel.Panel;import org.apache.wicket.model.IModel;import org.apache.wicket.model.PropertyModel;+import org.jspecify.annotations.Nullable;import com.google.common.collect.Lists;import io.onedev.server.OneDev;import io.onedev.server.buildspecmodel.inputspec.InputContext;import io.onedev.server.buildspecmodel.inputspec.InputSpec;-import io.onedev.server.service.IssueChangeService;-import io.onedev.server.service.SettingService;import io.onedev.server.model.Issue;import io.onedev.server.model.Iteration;import io.onedev.server.model.Project;@@ -55,6 +54,8 @@ import io.onedev.server.model.support.issue.field.FieldUtils;import io.onedev.server.model.support.issue.field.spec.FieldSpec;import io.onedev.server.search.entity.issue.IssueQuery;import io.onedev.server.security.SecurityUtils;+import io.onedev.server.service.IssueChangeService;+import io.onedev.server.service.SettingService;import io.onedev.server.web.ajaxlistener.DisableGlobalAjaxIndicatorListener;import io.onedev.server.web.behavior.RunTaskBehavior;import io.onedev.server.web.component.comment.CommentInput;@@ -267,7 +268,7 @@ abstract class BatchEditPanel extends Panel implements InputContext {});form.add(new CheckBox("sendNotifications", new PropertyModel<>(this, "sendNotifications"))- .setVisible(!SecurityUtils.getUser().isServiceAccount()));+ .setVisible(SecurityUtils.getUser().getType() != SERVICE));form.add(new AjaxButton("save") {diff --git a/server-core/src/main/java/io/onedev/server/web/component/issue/list/IssueListPanel.java b/server-core/src/main/java/io/onedev/server/web/component/issue/list/IssueListPanel.javaindex d6b868402d..2f48264cf3 100644--- a/server-core/src/main/java/io/onedev/server/web/component/issue/list/IssueListPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/issue/list/IssueListPanel.java@@ -1,6 +1,7 @@package io.onedev.server.web.component.issue.list;import static com.google.common.collect.Lists.newArrayList;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.search.entity.EntitySort.Direction.ASCENDING;import static io.onedev.server.search.entity.issue.IssueQuery.merge;import static io.onedev.server.web.translation.Translation._T;@@ -20,8 +21,6 @@ import java.util.List;import java.util.Map;import java.util.Set;-import org.jspecify.annotations.Nullable;-import org.apache.commons.collections4.CollectionUtils;import org.apache.commons.collections4.Predicate;import org.apache.commons.csv.CSVFormat;@@ -70,6 +69,7 @@ import org.apache.wicket.request.cycle.RequestCycle;import org.apache.wicket.request.mapper.parameter.PageParameters;import org.apache.wicket.request.resource.AbstractResource;import org.dhatim.fastexcel.Workbook;+import org.jspecify.annotations.Nullable;import com.google.common.collect.Sets;@@ -78,12 +78,6 @@ import io.onedev.commons.utils.ExplicitException;import io.onedev.server.OneDev;import io.onedev.server.buildspecmodel.inputspec.Input;import io.onedev.server.data.migration.VersionedXmlDoc;-import io.onedev.server.service.AuditService;-import io.onedev.server.service.IssueLinkService;-import io.onedev.server.service.IssueService;-import io.onedev.server.service.IssueWatchService;-import io.onedev.server.service.ProjectService;-import io.onedev.server.service.SettingService;import io.onedev.server.imports.IssueImporter;import io.onedev.server.imports.IssueImporterContribution;import io.onedev.server.model.Issue;@@ -105,6 +99,12 @@ 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.security.permission.AccessProject;+import io.onedev.server.service.AuditService;+import io.onedev.server.service.IssueLinkService;+import io.onedev.server.service.IssueService;+import io.onedev.server.service.IssueWatchService;+import io.onedev.server.service.ProjectService;+import io.onedev.server.service.SettingService;import io.onedev.server.timetracking.TimeTrackingService;import io.onedev.server.util.DateUtils;import io.onedev.server.util.LinkDescriptor;@@ -1575,7 +1575,7 @@ public abstract class IssueListPanel extends Panel {});}- if (!SecurityUtils.getAuthUser().isServiceAccount()) {+ if (SecurityUtils.getAuthUser().getType() == ORDINARY) {menuItems.add(new MenuItem() {@Overridediff --git a/server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java b/server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.javaindex 3071c24850..ae8bee987e 100644--- a/server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java+++ b/server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java@@ -1,27 +1,11 @@package io.onedev.server.web.component.markdown;-import io.onedev.commons.loader.AppLoader;-import io.onedev.commons.utils.StringUtils;-import io.onedev.server.OneDev;-import io.onedev.server.service.*;-import io.onedev.server.entityreference.BuildReference;-import io.onedev.server.entityreference.EntityReference;-import io.onedev.server.entityreference.IssueReference;-import io.onedev.server.entityreference.PullRequestReference;-import io.onedev.server.markdown.MarkdownService;-import io.onedev.server.model.Project;-import io.onedev.server.model.User;-import io.onedev.server.security.SecurityUtils;-import io.onedev.server.util.ColorUtils;-import io.onedev.server.util.DateUtils;-import io.onedev.server.web.asset.emoji.Emojis;-import io.onedev.server.web.asset.lozad.LozadResourceReference;-import io.onedev.server.web.avatar.AvatarService;-import io.onedev.server.web.behavior.AbstractPostAjaxBehavior;-import io.onedev.server.web.component.build.status.BuildStatusIcon;-import io.onedev.server.web.component.svg.SpriteImage;-import io.onedev.server.web.page.project.ProjectPage;-import io.onedev.server.web.page.project.blob.render.BlobRenderContext;+import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;++import java.util.List;++import javax.inject.Inject;+import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.feedback.FencedFeedbackPanel;import org.apache.wicket.markup.ComponentTag;@@ -38,13 +22,35 @@ import org.apache.wicket.request.cycle.RequestCycle;import org.eclipse.jgit.lib.ObjectId;import org.eclipse.jgit.revwalk.RevCommit;import org.hibernate.StaleStateException;+import org.jspecify.annotations.Nullable;import org.unbescape.html.HtmlEscape;import org.unbescape.javascript.JavaScriptEscape;-import org.jspecify.annotations.Nullable;-import java.util.List;--import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;+import io.onedev.commons.utils.StringUtils;+import io.onedev.server.entityreference.BuildReference;+import io.onedev.server.entityreference.EntityReference;+import io.onedev.server.entityreference.IssueReference;+import io.onedev.server.entityreference.PullRequestReference;+import io.onedev.server.markdown.MarkdownService;+import io.onedev.server.model.Project;+import io.onedev.server.model.User;+import io.onedev.server.security.SecurityUtils;+import io.onedev.server.service.BuildService;+import io.onedev.server.service.IssueService;+import io.onedev.server.service.ProjectService;+import io.onedev.server.service.PullRequestService;+import io.onedev.server.service.SettingService;+import io.onedev.server.service.UserService;+import io.onedev.server.util.ColorUtils;+import io.onedev.server.util.DateUtils;+import io.onedev.server.web.asset.emoji.Emojis;+import io.onedev.server.web.asset.lozad.LozadResourceReference;+import io.onedev.server.web.avatar.AvatarService;+import io.onedev.server.web.behavior.AbstractPostAjaxBehavior;+import io.onedev.server.web.component.build.status.BuildStatusIcon;+import io.onedev.server.web.component.svg.SpriteImage;+import io.onedev.server.web.page.project.ProjectPage;+import io.onedev.server.web.page.project.blob.render.BlobRenderContext;public class MarkdownViewer extends GenericPanel<String> {@@ -67,6 +73,30 @@ public class MarkdownViewer extends GenericPanel<String> {private AbstractPostAjaxBehavior referenceBehavior;private AbstractPostAjaxBehavior suggestionBehavior;++ @Inject+ private MarkdownService markdownService;++ @Inject+ private IssueService issueService;++ @Inject+ private PullRequestService pullRequestService;++ @Inject+ private SettingService settingService;++ @Inject+ private BuildService buildService;++ @Inject+ private AvatarService avatarService;++ @Inject+ private UserService userService;++ @Inject+ private ProjectService projectService;private final IModel<String> renderedModel = new LoadableDetachableModel<String>() {@@ -74,8 +104,7 @@ public class MarkdownViewer extends GenericPanel<String> {protected String load() {String markdown = getModelObject();if (markdown != null) {- MarkdownService manager = AppLoader.getInstance(MarkdownService.class);- return manager.process(manager.render(markdown), getProject(),+ return markdownService.process(markdownService.render(markdown), getProject(),getRenderContext(), getSuggestionSupport(), false);} else {return null;@@ -183,10 +212,10 @@ public class MarkdownViewer extends GenericPanel<String> {switch (referenceType) {case "issue":EntityReference reference = IssueReference.of(referenceId, null);- var issue = OneDev.getInstance(IssueService.class).find(reference.getProject(), reference.getNumber());+ var issue = issueService.find(reference.getProject(), reference.getNumber());// check permission here as issue project may not be the same as current projectif (issue != null && SecurityUtils.canAccessIssue(issue)) {- String color = OneDev.getInstance(SettingService.class).getIssueSetting().getStateSpec(issue.getState()).getColor();+ String color = settingService.getIssueSetting().getStateSpec(issue.getState()).getColor();String script = String.format("onedev.server.markdown.renderIssueTooltip('%s', '%s', '%s', '%s');",Emojis.getInstance().apply(JavaScriptEscape.escapeJavaScript(issue.getTitle())),JavaScriptEscape.escapeJavaScript(issue.getState()),@@ -198,7 +227,7 @@ public class MarkdownViewer extends GenericPanel<String> {break;case "pull request":reference = PullRequestReference.of(referenceId, null);- var request = OneDev.getInstance(PullRequestService.class).find(reference.getProject(), reference.getNumber());+ var request = pullRequestService.find(reference.getProject(), reference.getNumber());// check permission here as target project may not be the same as current projectif (request != null && SecurityUtils.canReadCode(request.getTargetProject())) {String status = request.getStatus().toString();@@ -224,7 +253,7 @@ public class MarkdownViewer extends GenericPanel<String> {break;case "build":reference = BuildReference.of(referenceId, null);- var build = OneDev.getInstance(BuildService.class).find(reference.getProject(), reference.getNumber());+ var build = buildService.find(reference.getProject(), reference.getNumber());// check permission here as build project may not be the same as current projectif (build != null && SecurityUtils.canAccessBuild(build)) {String iconHref = SpriteImage.getVersionedHref(BuildStatusIcon.getIconHref(build.getStatus()));@@ -241,9 +270,9 @@ public class MarkdownViewer extends GenericPanel<String> {}break;case "user":- User user = OneDev.getInstance(UserService.class).findByName(referenceId);+ User user = userService.findByName(referenceId);if (user != null) {- String avatarUrl = OneDev.getInstance(AvatarService.class).getUserAvatarUrl(user.getId());+ String avatarUrl = avatarService.getUserAvatarUrl(user.getId());String script = String.format("onedev.server.markdown.renderUserTooltip('%s', '%s')",JavaScriptEscape.escapeJavaScript(avatarUrl),JavaScriptEscape.escapeJavaScript(user.getDisplayName()));@@ -254,8 +283,7 @@ public class MarkdownViewer extends GenericPanel<String> {Project commitProject = getProject();String commitHash;if (referenceId.contains(":")) {- commitProject = OneDev.getInstance(ProjectService.class)- .findByPath(StringUtils.substringBefore(referenceId, ":"));+ commitProject = projectService.findByPath(StringUtils.substringBefore(referenceId, ":"));commitHash = StringUtils.substringAfter(referenceId, ":");} else {commitHash = referenceId;diff --git a/server-core/src/main/java/io/onedev/server/web/component/pullrequest/list/PullRequestListPanel.java b/server-core/src/main/java/io/onedev/server/web/component/pullrequest/list/PullRequestListPanel.javaindex f4716d2a66..b10785a65e 100644--- a/server-core/src/main/java/io/onedev/server/web/component/pullrequest/list/PullRequestListPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/pullrequest/list/PullRequestListPanel.java@@ -1,6 +1,7 @@package io.onedev.server.web.component.pullrequest.list;import static io.onedev.server.entityreference.ReferenceUtils.transformReferences;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.search.entity.pullrequest.PullRequestQuery.merge;import static io.onedev.server.web.translation.Translation._T;import static java.util.stream.Collectors.toList;@@ -13,8 +14,6 @@ import java.util.LinkedHashMap;import java.util.List;import java.util.Map;-import org.jspecify.annotations.Nullable;-import org.apache.commons.lang3.StringUtils;import org.apache.wicket.Component;import org.apache.wicket.Session;@@ -52,17 +51,13 @@ import org.apache.wicket.model.IModel;import org.apache.wicket.model.LoadableDetachableModel;import org.apache.wicket.model.Model;import org.apache.wicket.request.cycle.RequestCycle;+import org.jspecify.annotations.Nullable;import com.google.common.collect.Sets;import io.onedev.commons.utils.ExplicitException;import io.onedev.server.OneDev;import io.onedev.server.data.migration.VersionedXmlDoc;-import io.onedev.server.service.AuditService;-import io.onedev.server.service.ProjectService;-import io.onedev.server.service.PullRequestService;-import io.onedev.server.service.PullRequestReviewService;-import io.onedev.server.service.PullRequestWatchService;import io.onedev.server.entityreference.LinkTransformer;import io.onedev.server.model.Project;import io.onedev.server.model.PullRequest;@@ -78,6 +73,11 @@ import io.onedev.server.search.entity.pullrequest.FuzzyCriteria;import io.onedev.server.search.entity.pullrequest.PullRequestQuery;import io.onedev.server.security.SecurityUtils;import io.onedev.server.security.permission.ReadCode;+import io.onedev.server.service.AuditService;+import io.onedev.server.service.ProjectService;+import io.onedev.server.service.PullRequestReviewService;+import io.onedev.server.service.PullRequestService;+import io.onedev.server.service.PullRequestWatchService;import io.onedev.server.util.DateUtils;import io.onedev.server.util.watch.WatchStatus;import io.onedev.server.web.WebConstants;@@ -271,7 +271,7 @@ public abstract class PullRequestListPanel extends Panel {protected List<MenuItem> getMenuItems(FloatingPanel dropdown) {List<MenuItem> menuItems = new ArrayList<>();- if (!SecurityUtils.getAuthUser().isServiceAccount()) {+ if (SecurityUtils.getAuthUser().getType() == ORDINARY) {menuItems.add(new MenuItem() {@Override@@ -474,7 +474,7 @@ public abstract class PullRequestListPanel extends Panel {});}- if (!SecurityUtils.getAuthUser().isServiceAccount()) {+ if (SecurityUtils.getAuthUser().getType() == ORDINARY) {menuItems.add(new MenuItem() {@Overridediff --git a/server-core/src/main/java/io/onedev/server/web/component/savedquery/SavedQueriesPanel.java b/server-core/src/main/java/io/onedev/server/web/component/savedquery/SavedQueriesPanel.javaindex 6dcf8e2d72..ea24f3af4f 100644--- a/server-core/src/main/java/io/onedev/server/web/component/savedquery/SavedQueriesPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/savedquery/SavedQueriesPanel.java@@ -1,11 +1,12 @@package io.onedev.server.web.component.savedquery;+import static io.onedev.server.model.User.Type.ORDINARY;+import java.util.ArrayList;import java.util.HashSet;import java.util.List;import java.util.Set;-import org.jspecify.annotations.Nullable;import javax.servlet.http.Cookie;import org.apache.wicket.Component;@@ -31,6 +32,7 @@ import org.apache.wicket.model.Model;import org.apache.wicket.request.cycle.RequestCycle;import org.apache.wicket.request.http.WebRequest;import org.apache.wicket.request.http.WebResponse;+import org.jspecify.annotations.Nullable;import io.onedev.server.model.Project;import io.onedev.server.model.support.NamedQuery;@@ -310,7 +312,7 @@ public abstract class SavedQueriesPanel<T extends NamedQuery> extends Panel {@Overrideprotected void onConfigure() {super.onConfigure();- setVisible(!SecurityUtils.getAuthUser().isServiceAccount() && getQueryPersonalization().getQueryWatchSupport() != null);+ setVisible(SecurityUtils.getAuthUser().getType() == ORDINARY && getQueryPersonalization().getQueryWatchSupport() != null);}});@@ -336,7 +338,7 @@ public abstract class SavedQueriesPanel<T extends NamedQuery> extends Panel {@Overrideprotected void onConfigure() {super.onConfigure();- setVisible(!SecurityUtils.getAuthUser().isServiceAccount() && getQueryPersonalization().getQuerySubscriptionSupport() != null);+ setVisible(SecurityUtils.getAuthUser().getType() == ORDINARY && getQueryPersonalization().getQuerySubscriptionSupport() != null);}});@@ -392,7 +394,7 @@ public abstract class SavedQueriesPanel<T extends NamedQuery> extends Panel {protected void onConfigure() {super.onConfigure();setVisible(SecurityUtils.getAuthUser() != null- && !SecurityUtils.getAuthUser().isServiceAccount()+ && SecurityUtils.getAuthUser().getType() == ORDINARY&& getQueryPersonalization() != null&& getQueryPersonalization().getQueryWatchSupport() != null);}@@ -422,7 +424,7 @@ public abstract class SavedQueriesPanel<T extends NamedQuery> extends Panel {protected void onConfigure() {super.onConfigure();setVisible(SecurityUtils.getAuthUser() != null- && !SecurityUtils.getAuthUser().isServiceAccount()+ && SecurityUtils.getAuthUser().getType() == ORDINARY&& getQueryPersonalization() != null&& getQueryPersonalization().getQuerySubscriptionSupport() != null);}diff --git a/server-core/src/main/java/io/onedev/server/web/component/symboltooltip/SymbolTooltipPanel.java b/server-core/src/main/java/io/onedev/server/web/component/symboltooltip/SymbolTooltipPanel.javaindex 7d733dcf60..8e693d43ea 100644--- a/server-core/src/main/java/io/onedev/server/web/component/symboltooltip/SymbolTooltipPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/symboltooltip/SymbolTooltipPanel.java@@ -156,7 +156,7 @@ public abstract class SymbolTooltipPanel extends Panel {@Overrideprotected void onConfigure() {super.onConfigure();- setVisible(settingService.getAISetting().getLiteModelSetting() == null && symbolHits.size() > 1);+ setVisible(settingService.getAiSetting().getLiteModelSetting() == null && symbolHits.size() > 1);}});@@ -311,7 +311,7 @@ public abstract class SymbolTooltipPanel extends Panel {target.add(content);CharSequence callback;- if (settingService.getAISetting().getLiteModelSetting() != null && symbolHits.size() > 1)+ if (settingService.getAiSetting().getLiteModelSetting() != null && symbolHits.size() > 1)callback = getCallbackFunction(explicit("action"));elsecallback = "undefined";@@ -326,7 +326,7 @@ public abstract class SymbolTooltipPanel extends Panel {}target.appendJavaScript(script);} else {- var liteModel = settingService.getAISetting().getLiteModel();+ var liteModel = settingService.getAiSetting().getLiteModel();int index;try {ObjectMapper mapperCopy = objectMapper.copy();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.javanew file mode 100644index 0000000000..e4587ea8ef--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementEditBean.java@@ -0,0 +1,82 @@+package io.onedev.server.web.component.user.aisetting;++import static io.onedev.server.model.User.Type.ORDINARY;++import java.io.Serializable;+import java.util.List;+import java.util.stream.Collectors;++import io.onedev.server.OneDev;+import io.onedev.server.annotation.DependsOn;+import io.onedev.server.annotation.Editable;+import io.onedev.server.annotation.GroupChoice;+import io.onedev.server.annotation.ProjectChoice;+import io.onedev.server.annotation.UserChoice;+import io.onedev.server.model.User;+import io.onedev.server.service.UserService;++@Editable+public class EntitlementEditBean implements Serializable{++ private static final long serialVersionUID = 1L;++ private boolean entitleToAll;++ private List<String> entitledProjects;++ private List<String> entitledGroups;++ private List<String> entitledUsers;++ @Editable(order=100, name="Entitle to All Users")+ public boolean isEntitleToAll() {+ return entitleToAll;+ }++ public void setEntitleToAll(boolean entitleToAll) {+ this.entitleToAll = entitleToAll;+ }++ @Editable(order=200)+ @ProjectChoice+ @DependsOn(property="entitleToAll", value="false")+ public List<String> getEntitledProjects() {+ return entitledProjects;+ }++ public void setEntitledProjects(List<String> entitledProjects) {+ this.entitledProjects = entitledProjects;+ }++ @Editable(order=300)+ @GroupChoice+ @DependsOn(property="entitleToAll", value="false")+ public List<String> getEntitledGroups() {+ return entitledGroups;+ }++ public void setEntitledGroups(List<String> entitledGroups) {+ this.entitledGroups = entitledGroups;+ }++ @Editable(order=300)+ @UserChoice("getUsers")+ @DependsOn(property="entitleToAll", value="false")+ public List<String> getEntitledUsers() {+ return entitledUsers;+ }++ 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());+ }++}\ No newline at end of filediff --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.htmlnew file mode 100644index 0000000000..7262c8525b--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.html@@ -0,0 +1,9 @@+<wicket:panel>+ <div class="alert alert-light">+ <wicket:t>Specifies who can access this AI service</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>+</wicket:panel>\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.java b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.javanew file mode 100644index 0000000000..5b57b4fd99--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/EntitlementSettingPanel.java@@ -0,0 +1,132 @@+package io.onedev.server.web.component.user.aisetting;++import static io.onedev.server.web.translation.Translation._T;++import java.util.stream.Collectors;++import javax.inject.Inject;++import org.apache.wicket.markup.html.form.Form;+import org.apache.wicket.markup.html.panel.GenericPanel;+import org.apache.wicket.model.IModel;++import io.onedev.server.data.migration.VersionedXmlDoc;+import io.onedev.server.model.GroupEntitlement;+import io.onedev.server.model.ProjectEntitlement;+import io.onedev.server.model.User;+import io.onedev.server.model.UserEntitlement;+import io.onedev.server.persistence.TransactionService;+import io.onedev.server.service.AuditService;+import io.onedev.server.service.GroupEntitlementService;+import io.onedev.server.service.GroupService;+import io.onedev.server.service.ProjectEntitlementService;+import io.onedev.server.service.ProjectService;+import io.onedev.server.service.UserEntitlementService;+import io.onedev.server.service.UserService;+import io.onedev.server.web.editable.BeanContext;++public class EntitlementSettingPanel extends GenericPanel<User> {++ @Inject+ private UserService userService;++ @Inject+ private AuditService auditService;++ @Inject+ private TransactionService transactionService;++ @Inject+ private ProjectEntitlementService projectEntitlementService;++ @Inject+ private GroupEntitlementService groupEntitlementService;++ @Inject+ private UserEntitlementService userEntitlementService;++ @Inject+ private ProjectService projectService;++ @Inject+ private GroupService groupService;++ public EntitlementSettingPanel(String id, IModel<User> model) {+ super(id, model);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ var bean = new EntitlementEditBean();+ bean.setEntitleToAll(getUser().getAiSetting().isEntitleToAll());+ bean.setEntitledProjects(getUser().getProjectEntitlements().stream()+ .map(it->it.getProject().getPath())+ .sorted()+ .collect(Collectors.toList()));+ bean.setEntitledGroups(getUser().getGroupEntitlements().stream()+ .map(it->it.getGroup().getName())+ .sorted()+ .collect(Collectors.toList()));+ bean.setEntitledUsers(getUser().getUserEntitlements().stream()+ .map(it->it.getUser().getName())+ .sorted()+ .collect(Collectors.toList()));++ var oldAuditContent = VersionedXmlDoc.fromBean(bean).toXML();++ Form<?> form = new Form<Void>("form") {++ @Override+ protected void onSubmit() {+ super.onSubmit();++ transactionService.run(() -> {+ var newAuditContent = VersionedXmlDoc.fromBean(bean).toXML();+ getUser().getAiSetting().setEntitleToAll(bean.isEntitleToAll());++ var projectEntitlements = bean.getEntitledProjects().stream().map(it->{+ var entitlement = new ProjectEntitlement();+ entitlement.setProject(projectService.findByPath(it));+ entitlement.setAi(getUser());+ return entitlement;+ }).collect(Collectors.toList());++ var groupEntitlements = bean.getEntitledGroups().stream().map(it->{+ var entitlement = new GroupEntitlement();+ entitlement.setGroup(groupService.find(it));+ entitlement.setAi(getUser());+ return entitlement;+ }).collect(Collectors.toList());++ var userEntitlements = bean.getEntitledUsers().stream().map(it->{+ var entitlement = new UserEntitlement();+ entitlement.setUser(userService.findByName(it));+ entitlement.setAI(getUser());+ return entitlement;+ }).collect(Collectors.toList());++ userService.update(getUser(), null);+ projectEntitlementService.syncEntitlements(getUser(), projectEntitlements);+ groupEntitlementService.syncEntitlements(getUser(), groupEntitlements);+ userEntitlementService.syncEntitlements(getUser(), userEntitlements);++ auditService.audit(null, "changed AI entitlement settings", oldAuditContent, newAuditContent);+ });++ getSession().success(_T("AI entitlement settings have been saved"));+ setResponsePage(getPage().getClass(), getPage().getPageParameters());+ }++ };+ form.add(BeanContext.edit("editor", bean));++ add(form);+ }++ private User getUser() {+ return getModelObject();+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/ModelSettingPanel.html b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/ModelSettingPanel.htmlnew file mode 100644index 0000000000..38a21c51ea--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/ModelSettingPanel.html@@ -0,0 +1,6 @@+<wicket:panel>+ <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>+</wicket:panel>\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/ModelSettingPanel.java b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/ModelSettingPanel.javanew file mode 100644index 0000000000..29c91a0bba--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/component/user/aisetting/ModelSettingPanel.java@@ -0,0 +1,60 @@+package io.onedev.server.web.component.user.aisetting;++import static io.onedev.server.web.translation.Translation._T;++import javax.inject.Inject;++import org.apache.wicket.markup.html.form.Form;+import org.apache.wicket.markup.html.panel.GenericPanel;+import org.apache.wicket.model.IModel;++import io.onedev.server.data.migration.VersionedXmlDoc;+import io.onedev.server.model.User;+import io.onedev.server.model.support.AiModelSetting;+import io.onedev.server.service.AuditService;+import io.onedev.server.service.UserService;+import io.onedev.server.web.editable.BeanContext;++public class ModelSettingPanel extends GenericPanel<User> {++ @Inject+ private UserService userService;++ @Inject+ private AuditService auditService;++ public ModelSettingPanel(String id, IModel<User> model) {+ super(id, model);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ AiModelSetting setting = getUser().getAiSetting().getModelSetting();+ var oldAuditContent = VersionedXmlDoc.fromBean(setting).toXML();++ Form<?> form = new Form<Void>("form") {++ @Override+ protected void onSubmit() {+ super.onSubmit();+ var newAuditContent = VersionedXmlDoc.fromBean(setting).toXML();+ getUser().getAiSetting().setModelSetting(setting);+ userService.update(getUser(), null);+ auditService.audit(null, "changed AI model settings", oldAuditContent, newAuditContent);+ getSession().success(_T("AI model settings have been saved"));+ setResponsePage(getPage().getClass(), getPage().getPageParameters());+ }++ };+ form.add(BeanContext.edit("editor", setting));++ add(form);+ }++ private User getUser() {+ return getModelObject();+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/component/user/basicsetting/BasicSettingPanel.java b/server-core/src/main/java/io/onedev/server/web/component/user/basicsetting/BasicSettingPanel.javaindex 5347c2e168..12b47b574b 100644--- a/server-core/src/main/java/io/onedev/server/web/component/user/basicsetting/BasicSettingPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/user/basicsetting/BasicSettingPanel.java@@ -1,10 +1,13 @@package io.onedev.server.web.component.user.basicsetting;import static io.onedev.server.model.User.PROP_NOTIFY_OWN_EVENTS;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import java.io.Serializable;+import javax.inject.Inject;+import org.apache.wicket.Session;import org.apache.wicket.feedback.FencedFeedbackPanel;import org.apache.wicket.markup.html.form.Form;@@ -13,11 +16,10 @@ import org.apache.wicket.model.IModel;import com.google.common.collect.Sets;-import io.onedev.server.OneDev;import io.onedev.server.data.migration.VersionedXmlDoc;+import io.onedev.server.model.User;import io.onedev.server.service.AuditService;import io.onedev.server.service.UserService;-import io.onedev.server.model.User;import io.onedev.server.util.Path;import io.onedev.server.util.PathNode;import io.onedev.server.web.editable.BeanContext;@@ -26,6 +28,12 @@ import io.onedev.server.web.page.user.UserPage;public class BasicSettingPanel extends GenericPanel<User> {+ @Inject+ private UserService userService;++ @Inject+ private AuditService auditService;+private BeanEditor editor;private String oldName;@@ -42,8 +50,8 @@ public class BasicSettingPanel extends GenericPanel<User> {protected void onInitialize() {super.onInitialize();- var excludeProperties = Sets.newHashSet("password", "serviceAccount");- if (getUser().isServiceAccount() || getUser().isDisabled())+ var excludeProperties = Sets.newHashSet("password", "type", "aiModelSetting");+ if (getUser().getType() != ORDINARY || getUser().isDisabled())excludeProperties.add(PROP_NOTIFY_OWN_EVENTS);editor = BeanContext.editModel("editor", new IModel<Serializable>() {@@ -75,7 +83,7 @@ public class BasicSettingPanel extends GenericPanel<User> {User user = getUser();- User userWithSameName = getUserService().findByName(user.getName());+ User userWithSameName = userService.findByName(user.getName());if (userWithSameName != null && !userWithSameName.equals(user)) {editor.error(new Path(new PathNode.Named(User.PROP_NAME)),_T("Login name already used by another account"));@@ -83,9 +91,9 @@ public class BasicSettingPanel extends GenericPanel<User> {if (editor.isValid()) {var newAuditContent = VersionedXmlDoc.fromBean(editor.getPropertyValues()).toXML();- getUserService().update(user, oldName);+ userService.update(user, oldName);if (getPage() instanceof UserPage)- getAuditService().audit(null, "changed basic settings of account \"" + user.getName() + "\"", oldAuditContent, newAuditContent);+ auditService.audit(null, "changed basic settings of account \"" + user.getName() + "\"", oldAuditContent, newAuditContent);Session.get().success(_T("Basic settings updated"));setResponsePage(getPage().getClass(), getPage().getPageParameters());}@@ -98,13 +106,5 @@ public class BasicSettingPanel extends GenericPanel<User> {add(form);}-- private UserService getUserService() {- return OneDev.getInstance(UserService.class);- }-- private AuditService getAuditService() {- return OneDev.getInstance(AuditService.class);- }}diff --git a/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.html b/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.htmlindex a55f82a622..d354486ff8 100644--- a/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.html+++ b/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.html@@ -55,12 +55,18 @@<wicket:fragment wicket:id="serviceAccountFrag"><div class="alert alert-light p-2 font-size-sm"><wicket:t>This is a service account for task automation purpose</wicket:t></div></wicket:fragment>+ <wicket:fragment wicket:id="aiAccountFrag">+ <div class="alert alert-light p-2 font-size-sm"><wicket:t>This is an AI account</wicket:t></div>+ </wicket:fragment><wicket:fragment wicket:id="disabledFrag"><div class="alert alert-light-warning p-2 font-size-sm"><wicket:t>This account is disabled</wicket:t></div></wicket:fragment><wicket:fragment wicket:id="disabledServiceAccountFrag"><div class="alert alert-light-warning p-2 font-size-sm"><wicket:t>This is a disabled service account</wicket:t></div></wicket:fragment>+ <wicket:fragment wicket:id="disabledAIAccountFrag">+ <div class="alert alert-light-warning p-2 font-size-sm"><wicket:t>This is a disabled AI account</wicket:t></div>+ </wicket:fragment><wicket:fragment wicket:id="dateFrag"><h6 class="mt-4 mb-3 d-flex align-items-center"><wicket:svg href="calendar" class="icon mr-2"/> <span wicket:id="date"></span>diff --git a/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.java b/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.javaindex 25b46b597c..44b5303574 100644--- a/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.java+++ b/server-core/src/main/java/io/onedev/server/web/component/user/profile/UserProfilePanel.java@@ -1,5 +1,7 @@package io.onedev.server.web.component.user.profile;+import static io.onedev.server.model.User.Type.AI;+import static io.onedev.server.model.User.Type.SERVICE;import static io.onedev.server.web.translation.Translation._T;import java.text.MessageFormat;@@ -219,13 +221,17 @@ public abstract class UserProfilePanel extends GenericPanel<User> {}WebMarkupContainer noteContainer;- if (user.isDisabled() && WicketUtils.isSubscriptionActive()) {- if (user.isServiceAccount())+ if (user.isDisabled()) {+ if (user.getType() == SERVICE)noteContainer = new Fragment("note", "disabledServiceAccountFrag", this);+ else if (user.getType() == AI)+ noteContainer = new Fragment("note", "disabledAIAccountFrag", this);elsenoteContainer = new Fragment("note", "disabledFrag", this);- } else if (user.isServiceAccount() && WicketUtils.isSubscriptionActive()) {+ } else if (user.getType() == SERVICE) {noteContainer = new Fragment("note", "serviceAccountFrag", this);+ } else if (user.getType() == AI) {+ noteContainer = new Fragment("note", "aiAccountFrag", this);} else if (user.getPassword() != null) {noteContainer = new Fragment("note", "authViaInternalDatabaseFrag", this);var actions = new WebMarkupContainer("actions");diff --git a/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserMultiChoiceEditor.html b/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserMultiChoiceEditor.htmlindex f1c90cbe9e..3817227265 100644--- a/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserMultiChoiceEditor.html+++ b/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserMultiChoiceEditor.html@@ -1,3 +1,3 @@<wicket:panel>- <input wicket:id="input" type="hidden"></input>+ <input wicket:id="input" type="hidden"></wicket:panel>\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserSingleChoiceEditor.html b/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserSingleChoiceEditor.htmlindex f1c90cbe9e..3817227265 100644--- a/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserSingleChoiceEditor.html+++ b/server-core/src/main/java/io/onedev/server/web/editable/userchoice/UserSingleChoiceEditor.html@@ -1,3 +1,3 @@<wicket:panel>- <input wicket:id="input" type="hidden"></input>+ <input wicket:id="input" type="hidden"></wicket:panel>\ No newline at end of filediff --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.javaindex 1ef51f86c5..c4530305a9 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@@ -77,6 +77,8 @@ import io.onedev.server.web.page.help.ResourceDetailPage;import io.onedev.server.web.page.help.ResourceListPage;import io.onedev.server.web.page.issues.IssueListPage;import io.onedev.server.web.page.my.accesstoken.MyAccessTokensPage;+import io.onedev.server.web.page.my.aisetting.MyEntitlementSettingPage;+import io.onedev.server.web.page.my.aisetting.MyModelSettingPage;import io.onedev.server.web.page.my.avatar.MyAvatarPage;import io.onedev.server.web.page.my.basicsetting.MyBasicSettingPage;import io.onedev.server.web.page.my.emailaddresses.MyEmailAddressesPage;@@ -163,6 +165,8 @@ import io.onedev.server.web.page.security.SsoProcessPage;import io.onedev.server.web.page.serverinit.ServerInitPage;import io.onedev.server.web.page.test.TestPage;import io.onedev.server.web.page.user.accesstoken.UserAccessTokensPage;+import io.onedev.server.web.page.user.aisetting.UserEntitlementSettingPage;+import io.onedev.server.web.page.user.aisetting.UserModelSettingPage;import io.onedev.server.web.page.user.avatar.UserAvatarPage;import io.onedev.server.web.page.user.basicsetting.UserBasicSettingPage;import io.onedev.server.web.page.user.emailaddresses.UserEmailAddressesPage;@@ -227,6 +231,8 @@ public class BaseUrlMapper extends CompoundRequestMapper {add(new BasePageMapper("~my/email-addresses", MyEmailAddressesPage.class));add(new BasePageMapper("~my/avatar", MyAvatarPage.class));add(new BasePageMapper("~my/password", MyPasswordPage.class));+ add(new BasePageMapper("~my/ai-model-setting", MyModelSettingPage.class));+ add(new BasePageMapper("~my/ai-entitlement-setting", MyEntitlementSettingPage.class));add(new BasePageMapper("~my/ssh-keys", MySshKeysPage.class));add(new BasePageMapper("~my/gpg-keys", MyGpgKeysPage.class));add(new BasePageMapper("~my/access-tokens", MyAccessTokensPage.class));@@ -286,6 +292,8 @@ public class BaseUrlMapper extends CompoundRequestMapper {io.onedev.server.web.page.user.authorization.UserAuthorizationsPage.class));add(new BasePageMapper("~users/${user}/avatar", UserAvatarPage.class));add(new BasePageMapper("~users/${user}/password", UserPasswordPage.class));+ add(new BasePageMapper("~users/${user}/ai-model-setting", UserModelSettingPage.class));+ add(new BasePageMapper("~users/${user}/ai-entitlement-setting", UserEntitlementSettingPage.class));add(new BasePageMapper("~users/${user}/ssh-keys", UserSshKeysPage.class));add(new BasePageMapper("~users/${user}/gpg-keys", UserGpgKeysPage.class));add(new BasePageMapper("~users/${user}/access-tokens", UserAccessTokensPage.class));diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/administration.css b/server-core/src/main/java/io/onedev/server/web/page/admin/administration.cssindex 0e4746a06f..4d78419612 100644--- a/server-core/src/main/java/io/onedev/server/web/page/admin/administration.css+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/administration.css@@ -53,4 +53,13 @@}.branding-setting .dark-mode>.logo-preview>div {background-color: var(--dark-mode-dark) !important;-}\ No newline at end of file+}++.property-aiModelSetting>.value {+ margin-top: 1rem;+ padding: 0 0 0 1rem;+ border-left: 3px solid var(--light-gray);+}+.dark-mode .property-aiModelSetting>.value {+ border-color: var(--dark-mode-light-dark);+}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.javaindex 679fce7fc0..b05e4e64d6 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@@ -10,7 +10,7 @@ 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.model.support.administration.AiSetting;import io.onedev.server.service.SettingService;import io.onedev.server.web.editable.PropertyContext;import io.onedev.server.web.page.admin.AdministrationPage;@@ -28,7 +28,7 @@ public class LiteModelPage extends AdministrationPage {protected void onInitialize() {super.onInitialize();- AISetting aiSetting = settingService.getAISetting();+ AiSetting aiSetting = settingService.getAiSetting();var oldAuditContent = VersionedXmlDoc.fromBean(aiSetting).toXML();Form<?> form = new Form<Void>("form") {@@ -37,7 +37,7 @@ public class LiteModelPage extends AdministrationPage {protected void onSubmit() {super.onSubmit();var newAuditContent = VersionedXmlDoc.fromBean(aiSetting).toXML();- settingService.saveAISetting(aiSetting);+ settingService.saveAiSetting(aiSetting);auditService.audit(null, "changed AI settings", oldAuditContent, newAuditContent);getSession().success(_T("Lite AI model settings have been saved"));@@ -45,7 +45,7 @@ public class LiteModelPage extends AdministrationPage {}};- form.add(PropertyContext.edit("editor", aiSetting, AISetting.PROP_LITE_MODEL_SETTING));+ form.add(PropertyContext.edit("editor", aiSetting, AiSetting.PROP_LITE_MODEL_SETTING));add(form);}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.javaindex 05dcb4a257..bcbd6a0c22 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,5 +1,6 @@package io.onedev.server.web.page.admin.usermanagement;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import org.apache.shiro.authc.credential.PasswordService;@@ -18,15 +19,16 @@ 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.service.EmailAddressService;-import io.onedev.server.service.MembershipService;-import io.onedev.server.service.SettingService;-import io.onedev.server.service.UserService;import io.onedev.server.model.EmailAddress;import io.onedev.server.model.Group;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.EmailAddressService;+import io.onedev.server.service.MembershipService;+import io.onedev.server.service.SettingService;+import io.onedev.server.service.UserService;import io.onedev.server.util.Path;import io.onedev.server.util.PathNode;import io.onedev.server.web.editable.BeanContext;@@ -63,7 +65,7 @@ public class NewUserPage extends AdministrationPage {_T("User name already used by another account"));}- if (!bean.isServiceAccount() && getEmailAddressService().findByValue(bean.getEmailAddress()) != null) {+ if (bean.getType() == ORDINARY && getEmailAddressService().findByValue(bean.getEmailAddress()) != null) {editor.error(new Path(new PathNode.Named(NewUserBean.PROP_EMAIL_ADDRESS)),_T("Email address already used by another user"));}@@ -71,9 +73,12 @@ public class NewUserPage extends AdministrationPage {User user = new User();user.setName(bean.getName());user.setFullName(bean.getFullName());- user.setServiceAccount(bean.isServiceAccount());+ user.setType(bean.getType());+ var aiSetting = new AiSetting();+ aiSetting.setModelSetting(bean.getAiModelSetting());+ user.setAiSetting(aiSetting);var defaultLoginGroup = getSettingService().getSecuritySetting().getDefaultGroup();- if (user.isServiceAccount()) {+ if (user.getType() != ORDINARY) {getTransactionService().run(new Runnable() {@Overridepublic void run() {diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.html b/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.htmlindex b30ceb06f7..49c98d6685 100644--- a/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.html+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.html@@ -24,7 +24,8 @@<a wicket:id="link"><img wicket:id="avatar"><span wicket:id="name" class="name"></span>- <span wicket:id="service" class="badge badge-info badge-sm ml-1"><wicket:t>service</wicket:t></span>+ <span wicket:id="service" class="badge badge-info badge-sm ml-1">service</span>+ <span wicket:id="ai" class="badge badge-info badge-sm ml-1">AI</span><span wicket:id="disabled" class="badge badge-warning badge-sm ml-1"><wicket:t>disabled</wicket:t></span></a></wicket:fragment>diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.java b/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.javaindex 7f7dccb227..c7cab018c2 100644--- a/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/usermanagement/UserListPage.java@@ -1,5 +1,8 @@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.model.User.Type.SERVICE;import static io.onedev.server.web.translation.Translation._T;import java.io.Serializable;@@ -89,7 +92,7 @@ public class UserListPage extends AdministrationPage {var emailAddresses = new HashMap<Long, Collection<String>>();for (var emailAddress: emailAddressCache.values())emailAddresses.computeIfAbsent(emailAddress.getOwnerId(), key -> new HashSet<>()).add(emailAddress.getValue());- List<User> users = new ArrayList<>(userCache.getUsers(state.includeDisabled));+ List<User> users = new ArrayList<>(userCache.getUsers(it->state.includeDisabled?true:!it.isDisabled()));users.sort(userCache.comparingDisplayName(Sets.newHashSet()));users = new Similarities<>(users) {@@ -852,7 +855,8 @@ public class UserListPage extends AdministrationPage {};link.add(new UserAvatar("avatar", user));link.add(new Label("name", user.getName()));- link.add(new WebMarkupContainer("service").setVisible(user.isServiceAccount() && WicketUtils.isSubscriptionActive()));+ link.add(new WebMarkupContainer("service").setVisible(user.getType() == SERVICE));+ link.add(new WebMarkupContainer("ai").setVisible(user.getType() == AI));link.add(new WebMarkupContainer("disabled").setVisible(user.isDisabled() && WicketUtils.isSubscriptionActive()));fragment.add(link);cellItem.add(fragment);@@ -879,7 +883,7 @@ public class UserListPage extends AdministrationPage {@Overridepublic void populateItem(Item<ICellPopulator<User>> cellItem, String componentId,IModel<User> rowModel) {- if (rowModel.getObject().isServiceAccount()) {+ if (rowModel.getObject().getType() != ORDINARY) {cellItem.add(new Label(componentId, "<i>N/A</i>").setEscapeModelStrings(false));} else {EmailAddress emailAddress = rowModel.getObject().getPrimaryEmailAddress();@@ -906,7 +910,7 @@ public class UserListPage extends AdministrationPage {@Overridepublic void populateItem(Item<ICellPopulator<User>> cellItem, String componentId, IModel<User> rowModel) {- if (rowModel.getObject().isServiceAccount() || rowModel.getObject().isDisabled()) {+ if (rowModel.getObject().getType() != ORDINARY || rowModel.getObject().isDisabled()) {cellItem.add(new Label(componentId, "<i>" + _T("N/A") + "</i>").setEscapeModelStrings(false));} else {cellItem.add(new Label(componentId, _T(rowModel.getObject().getAuthSource())));diff --git a/server-core/src/main/java/io/onedev/server/web/page/base/base.js b/server-core/src/main/java/io/onedev/server/web/page/base/base.jsindex 4feecd4c38..2c6bcb5f50 100644--- a/server-core/src/main/java/io/onedev/server/web/page/base/base.js+++ b/server-core/src/main/java/io/onedev/server/web/page/base/base.js@@ -216,7 +216,7 @@ onedev.server = {onedev.server.focus.$components = null;},- doFocus: function($containers) {+ doFocus: function($containers) {/** Do focus with a timeout as otherwise it will not work in a panel replaced* via Wicket@@ -249,19 +249,24 @@ onedev.server = {$containers.find(focusibleSelector).addBack(focusibleSelector).filter(":visible").each(function() {var $this = $(this);if ($this.closest(".no-autofocus").length == 0) {+ var focused = false;if ($this.hasClass("CodeMirror") && $this[0].CodeMirror.options.readOnly == false) {$this[0].CodeMirror.focus();+ focused = true;} else if ($this.attr("readonly") != "readonly" && $this.attr("disabled") != "disabled") {if ($this.closest(".select2-container").length != 0) {if ($this.closest(".inplace-property-edit").length != 0) {$this.focus();+ focused = true;$this.closest(".select2-container").next("input").select2("open");}} else {$this.focus();+ focused = true;}}- return false;+ if (focused)+ return false;}});}diff --git a/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.html b/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.htmlindex 8837972211..4288cd9d79 100644--- a/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.html+++ b/server-core/src/main/java/io/onedev/server/web/page/layout/LayoutPage.html@@ -47,6 +47,7 @@<div class="topbar-right text-nowrap"><a wicket:id="alerts" t:data-tippy-content="Alerts" class="text-warning topbar-link"><wicket:svg href="exclamation-circle-o" class="icon fade-in-out"></wicket:svg></a><a wicket:id="newVersionStatus" t:data-tippy-content="New version available. Red for security/critical update, yellow for bug fix, blue for feature update. Click to show changes. Disable in system setting" class="new-version-status topbar-link"><img wicket:id="icon"/></a>+ <a wicket:id="showChat" t:data-tippy-content="Chat with AI" class="topbar-link"><wicket:svg href="ai" class="icon"/></a><a wicket:id="darkMode" t:data-tippy-content="Toggle dark mode" class="topbar-link"><svg wicket:id="icon" class="icon"/></a><a wicket:id="showCommandPalette" class="topbar-link command-palette"></a><a wicket:id="languageSelector" t:data-tippy-content="Language" class="topbar-link language-selector"><wicket:svg href="globe" class="icon"></wicket:svg></a>@@ -87,6 +88,10 @@<wicket:svg href="password" class="icon mr-2"></wicket:svg><wicket:t>Password</wicket:t></a>+ <a wicket:id="myAISetting" class="dropdown-item">+ <wicket:svg href="ai-setting" class="icon mr-2"></wicket:svg>+ <wicket:t>AI Settings</wicket:t>+ </a><a wicket:id="mySshKeys" class="dropdown-item"><wicket:svg href="key" class="icon mr-2"></wicket:svg><wicket:t>SSH Keys</wicket:t>@@ -117,6 +122,7 @@</div><div class="main autofit d-flex flex-column resize-aware"><wicket:child></wicket:child>+ <div wicket:id="chat"></div></div><wicket:fragment wicket:id="menuHeaderFrag">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.javaindex 4ce1611e8a..5c372cb53e 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@@ -1,6 +1,8 @@package io.onedev.server.web.page.layout;import static io.onedev.server.model.Alert.PROP_DATE;+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 static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;@@ -76,6 +78,7 @@ import io.onedev.server.util.DateUtils;import io.onedev.server.web.WebConstants;import io.onedev.server.web.behavior.AbstractPostAjaxBehavior;import io.onedev.server.web.behavior.ChangeObserver;+import io.onedev.server.web.component.ai.chat.ChatPanel;import io.onedev.server.web.component.brandlogo.BrandLogoPanel;import io.onedev.server.web.component.commandpalette.CommandPalettePanel;import io.onedev.server.web.component.datatable.DefaultDataTable;@@ -151,6 +154,7 @@ import io.onedev.server.web.page.base.BasePage;import io.onedev.server.web.page.help.IncompatibilitiesPage;import io.onedev.server.web.page.my.MyPage;import io.onedev.server.web.page.my.accesstoken.MyAccessTokensPage;+import io.onedev.server.web.page.my.aisetting.MyModelSettingPage;import io.onedev.server.web.page.my.avatar.MyAvatarPage;import io.onedev.server.web.page.my.basicsetting.MyBasicSettingPage;import io.onedev.server.web.page.my.emailaddresses.MyEmailAddressesPage;@@ -807,6 +811,24 @@ public abstract class LayoutPage extends BasePage {});+ var chat = new ChatPanel("chat");+ add(chat);++ topbar.add(new AjaxLink<Void>("showChat") {++ @Override+ public void onClick(AjaxRequestTarget target) {+ chat.show(target);+ }++ @Override+ protected void onConfigure() {+ super.onConfigure();+ setVisible(getLoginUser() != null && !getLoginUser().getEntitledAis().isEmpty());+ }++ });+topbar.add(new MenuLink("languageSelector") {private void switchLanguage(Locale locale) {@@ -1061,7 +1083,7 @@ public abstract class LayoutPage extends BasePage {if (loginUser != null) {userInfo.add(new UserAvatar("avatar", loginUser));userInfo.add(new Label("name", loginUser.getDisplayName()));- if (loginUser.isServiceAccount() || loginUser.isDisabled()) {+ if (loginUser.getType() != ORDINARY || loginUser.isDisabled()) {userInfo.add(new WebMarkupContainer("hasUnverifiedLink").setVisible(false));userInfo.add(new WebMarkupContainer("noPrimaryAddressLink").setVisible(false));} else if (loginUser.getEmailAddresses().isEmpty()) {@@ -1088,7 +1110,7 @@ public abstract class LayoutPage extends BasePage {if (getPage() instanceof MyBasicSettingPage)item.add(AttributeAppender.append("class", "active"));- if (getLoginUser() != null && !getLoginUser().isServiceAccount()) {+ if (getLoginUser() != null && getLoginUser().getType() == ORDINARY) {userInfo.add(item = new ViewStateAwarePageLink<Void>("myEmailSetting", MyEmailAddressesPage.class));if (getPage() instanceof MyEmailAddressesPage)item.add(AttributeAppender.append("class", "active"));@@ -1100,7 +1122,7 @@ public abstract class LayoutPage extends BasePage {if (getPage() instanceof MyAvatarPage)item.add(AttributeAppender.append("class", "active"));- if (loginUser != null && loginUser.getPassword() != null && !loginUser.isServiceAccount() && !loginUser.isDisabled()) {+ if (loginUser != null && loginUser.getPassword() != null && loginUser.getType() == ORDINARY && !loginUser.isDisabled()) {userInfo.add(item = new ViewStateAwarePageLink<Void>("myPassword", MyPasswordPage.class));if (getPage() instanceof MyPasswordPage)item.add(AttributeAppender.append("class", "active"));@@ -1108,6 +1130,14 @@ public abstract class LayoutPage extends BasePage {userInfo.add(new WebMarkupContainer("myPassword").setVisible(false));}+ if (loginUser != null && loginUser.getType() == AI && !loginUser.isDisabled()) {+ userInfo.add(item = new ViewStateAwarePageLink<Void>("myAISetting", MyModelSettingPage.class));+ if (getPage() instanceof MyModelSettingPage)+ item.add(AttributeAppender.append("class", "active"));+ } else {+ userInfo.add(new WebMarkupContainer("myAISetting").setVisible(false));+ }+if (OneDev.getInstance(ServerConfig.class).getSshPort() != 0 && loginUser != null && !loginUser.isDisabled()) {userInfo.add(item = new ViewStateAwarePageLink<Void>("mySshKeys", MySshKeysPage.class));if (getPage() instanceof MySshKeysPage)@@ -1132,7 +1162,7 @@ public abstract class LayoutPage extends BasePage {userInfo.add(new WebMarkupContainer("myAccessTokens").setVisible(false));}- if (getLoginUser() != null && !getLoginUser().isServiceAccount() && !getLoginUser().isDisabled()) {+ if (getLoginUser() != null && getLoginUser().getType() == ORDINARY && !getLoginUser().isDisabled()) {userInfo.add(item = new ViewStateAwarePageLink<Void>("myTwoFactorAuthentication", MyTwoFactorAuthenticationPage.class) {@Overrideprotected void onConfigure() {@@ -1146,7 +1176,7 @@ public abstract class LayoutPage extends BasePage {userInfo.add(new WebMarkupContainer("myTwoFactorAuthentication").setVisible(false));}- if (loginUser != null && !loginUser.isDisabled() && !loginUser.isServiceAccount()) {+ if (loginUser != null && !loginUser.isDisabled() && loginUser.getType() == ORDINARY) {userInfo.add(item = new ViewStateAwarePageLink<Void>("mySsoAccounts", MySsoAccountsPage.class));if (getPage() instanceof MySsoAccountsPage)item.add(AttributeAppender.append("class", "active"));@@ -1154,7 +1184,7 @@ public abstract class LayoutPage extends BasePage {userInfo.add(new WebMarkupContainer("mySsoAccounts").setVisible(false));}- if (getLoginUser() != null && !getLoginUser().isServiceAccount() && !getLoginUser().isDisabled()) {+ if (getLoginUser() != null && getLoginUser().getType() == ORDINARY && !getLoginUser().isDisabled()) {userInfo.add(item = new ViewStateAwarePageLink<Void>("myQueryWatches", MyQueryWatchesPage.class));if (getPage() instanceof MyQueryWatchesPage)item.add(AttributeAppender.append("class", "active"));@@ -1218,6 +1248,7 @@ public abstract class LayoutPage extends BasePage {getUpdateCheckService().cacheNewVersionStatus(newVersionStatus);}});+}private SubscriptionService getSubscriptionService() {diff --git a/server-core/src/main/java/io/onedev/server/web/page/layout/layout.css b/server-core/src/main/java/io/onedev/server/web/page/layout/layout.cssindex f0f742e84b..d62cd03e25 100644--- a/server-core/src/main/java/io/onedev/server/web/page/layout/layout.css+++ b/server-core/src/main/java/io/onedev/server/web/page/layout/layout.css@@ -306,6 +306,8 @@.topbar-right .new-version-status>img {margin-top: -3px;}++.topbar-right a.topbar-link.active,.topbar-right a.topbar-link:hover,.topbar-right .active>a.topbar-link,.topbar-right .show>a.topbar-link {diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyAISettingPage.html b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyAISettingPage.htmlnew file mode 100644index 0000000000..49ebcbb87d--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyAISettingPage.html@@ -0,0 +1,4 @@+<wicket:extend>+ <ul wicket:id="aiSettingTabs" class="tabs nav nav-bold nav-tabs nav-tabs-line text-weight-bold mb-4"></ul>+ <wicket:child></wicket:child>+</wicket:extend>\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyAISettingPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyAISettingPage.javanew file mode 100644index 0000000000..3a6c4e8472--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyAISettingPage.java@@ -0,0 +1,43 @@+package io.onedev.server.web.page.my.aisetting;++import static io.onedev.server.model.User.Type.AI;+import static io.onedev.server.web.translation.Translation._T;++import java.util.ArrayList;+import java.util.List;++import org.apache.wicket.Component;+import org.apache.wicket.markup.html.basic.Label;+import org.apache.wicket.model.Model;+import org.apache.wicket.request.mapper.parameter.PageParameters;++import io.onedev.server.web.component.tabbable.PageTab;+import io.onedev.server.web.component.tabbable.Tabbable;+import io.onedev.server.web.page.my.MyPage;++public abstract class MyAiSettingPage extends MyPage {++ public MyAiSettingPage(PageParameters params) {+ super(params);+ if (getUser().isDisabled() || getUser().getType() != AI)+ throw new IllegalStateException();+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ List<PageTab> tabs = new ArrayList<>();++ tabs.add(new PageTab(Model.of(_T("Model")), null, MyModelSettingPage.class, new PageParameters()));+ tabs.add(new PageTab(Model.of(_T("Entitlement")), null, MyEntitlementSettingPage.class, new PageParameters()));++ add(new Tabbable("aiSettingTabs", tabs));+ }++ @Override+ protected Component newTopbarTitle(String componentId) {+ return new Label(componentId, _T("My AI Settings"));+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyEntitlementSettingPage.html b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyEntitlementSettingPage.htmlnew file mode 100644index 0000000000..3c7d14f84d--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyEntitlementSettingPage.html@@ -0,0 +1,3 @@+<wicket:extend>+ <div wicket:id="content"></div>+</wicket:extend>diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyEntitlementSettingPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyEntitlementSettingPage.javanew file mode 100644index 0000000000..b06ad2a9f9--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyEntitlementSettingPage.java@@ -0,0 +1,29 @@+package io.onedev.server.web.page.my.aisetting;++import org.apache.wicket.model.AbstractReadOnlyModel;+import org.apache.wicket.request.mapper.parameter.PageParameters;++import io.onedev.server.model.User;+import io.onedev.server.web.component.user.aisetting.EntitlementSettingPanel;++public class MyEntitlementSettingPage extends MyAiSettingPage {++ public MyEntitlementSettingPage(PageParameters params) {+ super(params);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ add(new EntitlementSettingPanel("content", new AbstractReadOnlyModel<User>() {++ @Override+ public User getObject() {+ return getUser();+ }++ }));+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyModelSettingPage.html b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyModelSettingPage.htmlnew file mode 100644index 0000000000..3c7d14f84d--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyModelSettingPage.html@@ -0,0 +1,3 @@+<wicket:extend>+ <div wicket:id="content"></div>+</wicket:extend>diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyModelSettingPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyModelSettingPage.javanew file mode 100644index 0000000000..568dcd9988--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/my/aisetting/MyModelSettingPage.java@@ -0,0 +1,29 @@+package io.onedev.server.web.page.my.aisetting;++import org.apache.wicket.model.AbstractReadOnlyModel;+import org.apache.wicket.request.mapper.parameter.PageParameters;++import io.onedev.server.model.User;+import io.onedev.server.web.component.user.aisetting.ModelSettingPanel;++public class MyModelSettingPage extends MyAiSettingPage {++ public MyModelSettingPage(PageParameters params) {+ super(params);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ add(new ModelSettingPanel("content", new AbstractReadOnlyModel<User>() {++ @Override+ public User getObject() {+ return getUser();+ }++ }));+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/emailaddresses/MyEmailAddressesPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/emailaddresses/MyEmailAddressesPage.javaindex a61b3e7f96..d6a3017125 100644--- a/server-core/src/main/java/io/onedev/server/web/page/my/emailaddresses/MyEmailAddressesPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/my/emailaddresses/MyEmailAddressesPage.java@@ -1,5 +1,6 @@package io.onedev.server.web.page.my.emailaddresses;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import org.apache.wicket.Component;@@ -15,7 +16,7 @@ public class MyEmailAddressesPage extends MyPage {public MyEmailAddressesPage(PageParameters params) {super(params);- if (getUser().isServiceAccount())+ if (getUser().getType() != ORDINARY)throw new IllegalStateException();}diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/password/MyPasswordPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/password/MyPasswordPage.javaindex 36b163ba15..b9ee238b3a 100644--- a/server-core/src/main/java/io/onedev/server/web/page/my/password/MyPasswordPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/my/password/MyPasswordPage.java@@ -5,6 +5,7 @@ import io.onedev.server.model.User;import io.onedev.server.web.component.user.passwordedit.PasswordEditPanel;import io.onedev.server.web.page.my.MyPage;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import org.apache.wicket.Component;@@ -16,7 +17,7 @@ public class MyPasswordPage extends MyPage {public MyPasswordPage(PageParameters params) {super(params);- if (getUser().isServiceAccount() || getUser().isDisabled())+ if (getUser().getType() != ORDINARY || getUser().isDisabled())throw new IllegalStateException();if (getUser().getPassword() == null)throw new ExplicitException(_T("Unable to change password as you are authenticating via external system"));@@ -28,12 +29,12 @@ public class MyPasswordPage extends MyPage {add(new PasswordEditPanel("content", new AbstractReadOnlyModel<User>() {- @Override- public User getObject() {- return getUser();- }-- }));+ @Override+ public User getObject() {+ return getUser();+ }++ }));}@Overridediff --git a/server-core/src/main/java/io/onedev/server/web/page/my/querywatch/MyQueryWatchesPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/querywatch/MyQueryWatchesPage.javaindex 37b244fbfb..8bbed24c05 100644--- a/server-core/src/main/java/io/onedev/server/web/page/my/querywatch/MyQueryWatchesPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/my/querywatch/MyQueryWatchesPage.java@@ -1,5 +1,6 @@package io.onedev.server.web.page.my.querywatch;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import org.apache.wicket.Component;@@ -20,7 +21,7 @@ public class MyQueryWatchesPage extends MyPage {public MyQueryWatchesPage(PageParameters params) {super(params);- if (getUser().isServiceAccount() || getUser().isDisabled())+ if (getUser().getType() != ORDINARY || getUser().isDisabled())throw new IllegalStateException();tabName = params.get(PARAM_TAB).toString(QueryWatchesPanel.TAB_ISSUE);}diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/ssoaccounts/MySsoAccountsPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/ssoaccounts/MySsoAccountsPage.javaindex fdb58b310c..16a8c773a4 100644--- a/server-core/src/main/java/io/onedev/server/web/page/my/ssoaccounts/MySsoAccountsPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/my/ssoaccounts/MySsoAccountsPage.java@@ -1,5 +1,6 @@package io.onedev.server.web.page.my.ssoaccounts;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import org.apache.wicket.Component;@@ -15,7 +16,7 @@ public class MySsoAccountsPage extends MyPage {public MySsoAccountsPage(PageParameters params) {super(params);- if (getUser().isDisabled() || getUser().isServiceAccount())+ if (getUser().isDisabled() || getUser().getType() != ORDINARY)throw new IllegalStateException();}diff --git a/server-core/src/main/java/io/onedev/server/web/page/my/twofactorauthentication/MyTwoFactorAuthenticationPage.java b/server-core/src/main/java/io/onedev/server/web/page/my/twofactorauthentication/MyTwoFactorAuthenticationPage.javaindex c06fa983b6..8c9aadd85a 100644--- a/server-core/src/main/java/io/onedev/server/web/page/my/twofactorauthentication/MyTwoFactorAuthenticationPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/my/twofactorauthentication/MyTwoFactorAuthenticationPage.java@@ -5,6 +5,7 @@ import io.onedev.server.model.User;import io.onedev.server.web.component.user.twofactorauthentication.TwoFactorAuthenticationStatusPanel;import io.onedev.server.web.page.my.MyPage;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import org.apache.wicket.Component;@@ -15,7 +16,7 @@ public class MyTwoFactorAuthenticationPage extends MyPage {public MyTwoFactorAuthenticationPage(PageParameters params) {super(params);- if (getUser().isServiceAccount() || getUser().isDisabled())+ if (getUser().getType() != ORDINARY || getUser().isDisabled())throw new IllegalStateException();else if (!getUser().isEnforce2FA())throw new ExplicitException(_T("Two-factor authentication not enabled"));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.javaindex eff93273f7..f10f6a1ea3 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@@ -290,6 +290,18 @@ public class SourceViewPanel extends BlobViewPanel implements Positionable, SearcommentContainer = new WebMarkupContainer("comment", Model.of((PlanarRange)null)) {+ @Override+ protected void onBeforeRender() {+ WebRequest request = (WebRequest) RequestCycle.get().getRequest();+ Cookie cookie = request.getCookie(COOKIE_COMMENT_WIDTH);+ if (cookie != null)+ add(AttributeAppender.replace("style", "width:" + cookie.getValue() + "px"));+ else+ add(AttributeAppender.replace("style", "width:360px"));++ super.onBeforeRender();+ }+@Overridepublic void renderHead(IHeaderResponse response) {super.renderHead(response);@@ -297,17 +309,7 @@ public class SourceViewPanel extends BlobViewPanel implements Positionable, Sear}};-- float commentWidth;- WebRequest request = (WebRequest) RequestCycle.get().getRequest();- Cookie cookie = request.getCookie(COOKIE_COMMENT_WIDTH);- if (cookie != null)- commentWidth = Float.parseFloat(cookie.getValue());- else- commentWidth = 360;-- commentContainer.add(AttributeAppender.append("style", "width:" + commentWidth + "px"));-+if (context.getOpenComment() != null) {for (List<CodeCommentInfo> listOfCommentInfos: annotationInfoModel.getObject().getComments().values()) {for (CodeCommentInfo commentInfo: listOfCommentInfos) {@@ -753,6 +755,18 @@ public class SourceViewPanel extends BlobViewPanel implements Positionable, SearoutlineContainer = new WebMarkupContainer("outline") {+ @Override+ protected void onBeforeRender() {+ WebRequest request = (WebRequest) RequestCycle.get().getRequest();+ var cookie = request.getCookie(COOKIE_OUTLINE_WIDTH);+ if (cookie != null)+ add(AttributeAppender.replace("style", "width:" + cookie.getValue() + "px"));+ else+ add(AttributeAppender.replace("style", "width:300px"));++ super.onBeforeRender();+ }+@Overridepublic void renderHead(IHeaderResponse response) {super.renderHead(response);@@ -760,16 +774,7 @@ public class SourceViewPanel extends BlobViewPanel implements Positionable, Sear}};-- float outlineWidth;- cookie = request.getCookie(COOKIE_OUTLINE_WIDTH);- if (cookie != null)- outlineWidth = Float.parseFloat(cookie.getValue());- else- outlineWidth = 300;-- outlineContainer.add(AttributeAppender.append("style", "width:" + outlineWidth + "px"));-+IModel<HashSet<Symbol>> state = new Model<HashSet<Symbol>>(new HashSet<>(getChildSymbols(symbols, null)));NestedTree<Symbol> tree = new NestedTree<Symbol>("content", newSymbolTreeProvider(symbols), state) {diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/issues/boards/AbstractColumnPanel.java b/server-core/src/main/java/io/onedev/server/web/page/project/issues/boards/AbstractColumnPanel.javaindex c2acc42afe..2c14b479f9 100644--- a/server-core/src/main/java/io/onedev/server/web/page/project/issues/boards/AbstractColumnPanel.java+++ b/server-core/src/main/java/io/onedev/server/web/page/project/issues/boards/AbstractColumnPanel.java@@ -1,8 +1,8 @@package io.onedev.server.web.page.project.issues.boards;-import java.util.HashSet;+import static io.onedev.server.model.User.Type.SERVICE;-import org.jspecify.annotations.Nullable;+import java.util.HashSet;import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;@@ -14,19 +14,20 @@ import org.apache.wicket.markup.repeater.RepeatingView;import org.apache.wicket.model.IModel;import org.apache.wicket.model.LoadableDetachableModel;import org.apache.wicket.util.visit.IVisitor;+import org.jspecify.annotations.Nullable;import io.onedev.commons.utils.ExplicitException;import io.onedev.server.OneDev;-import io.onedev.server.service.IssueChangeService;-import io.onedev.server.service.IssueService;-import io.onedev.server.service.IterationService;-import io.onedev.server.service.SettingService;import io.onedev.server.model.Issue;import io.onedev.server.model.Iteration;import io.onedev.server.model.Project;import io.onedev.server.model.support.administration.GlobalIssueSetting;import io.onedev.server.search.entity.issue.IssueQuery;import io.onedev.server.security.SecurityUtils;+import io.onedev.server.service.IssueChangeService;+import io.onedev.server.service.IssueService;+import io.onedev.server.service.IterationService;+import io.onedev.server.service.SettingService;import io.onedev.server.util.EditContext;import io.onedev.server.util.ProjectScope;import io.onedev.server.web.component.beaneditmodal.BeanEditModalPanel;@@ -123,7 +124,7 @@ abstract class AbstractColumnPanel extends Panel implements EditContext {if (getIterationSelection().getIteration() != null)bean.setCurrentIteration(getIterationSelection().getIteration().getName());var excludeProperties = new HashSet<String>();- if (SecurityUtils.getUser().isServiceAccount())+ if (SecurityUtils.getUser().getType() == SERVICE)excludeProperties.add(AddToIterationBean.PROP_SEND_NOTIFICATIONS);new BeanEditModalPanel<>(target, bean, excludeProperties, true, null) {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.javaindex 6e47421343..c22f1c764e 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@@ -288,7 +288,7 @@ public class NewPullRequestPage extends ProjectPage implements RevisionAnnotatioupdate.setTargetHeadCommitHash(request.getTarget().getObjectName());var title = request.generateTitleFromCommits();- if (title == null && settingService.getAISetting().getLiteModelSetting() == null)+ if (title == null && settingService.getAiSetting().getLiteModelSetting() == null)title = request.generateTitleFromBranch();request.setTitle(title);request.setDescription(request.generateDescriptionFromCommits());@@ -686,7 +686,7 @@ public class NewPullRequestPage extends ProjectPage implements RevisionAnnotatioString description;try {if (suggestTitle || suggestDescription) {- var chatModel = settingService.getAISetting().getLiteModel();+ var chatModel = settingService.getAiSetting().getLiteModel();var sourceBranchSemantic = getPullRequest().getSourceBranchSemantic();String titleSuggestInstruction;if (sourceBranchSemantic.isWorkInProgress()) {@@ -789,7 +789,7 @@ public class NewPullRequestPage extends ProjectPage implements RevisionAnnotatiosuper.renderHead(response);CharSequence callback;- if (settingService.getAISetting().getLiteModelSetting() != null)+ if (settingService.getAiSetting().getLiteModelSetting() != null)callback = behavior.getCallbackFunction(explicit("suggestTitle"), explicit("suggestDescription"));elsecallback = "undefined";diff --git a/server-core/src/main/java/io/onedev/server/web/page/security/CreateUserFromInvitationPage.java b/server-core/src/main/java/io/onedev/server/web/page/security/CreateUserFromInvitationPage.javaindex 48cf17a5c2..c8f3fbf673 100644--- a/server-core/src/main/java/io/onedev/server/web/page/security/CreateUserFromInvitationPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/security/CreateUserFromInvitationPage.java@@ -1,5 +1,7 @@package io.onedev.server.web.page.security;+import static io.onedev.server.model.User.PROP_NOTIFY_OWN_EVENTS;+import static io.onedev.server.model.User.PROP_TYPE;import static io.onedev.server.web.translation.Translation._T;import org.apache.shiro.authc.credential.PasswordService;@@ -63,7 +65,7 @@ public class CreateUserFromInvitationPage extends SimplePage {super.onInitialize();User newUser = new User();- BeanEditor editor = BeanContext.edit("editor", newUser, Sets.newHashSet(User.PROP_SERVICE_ACCOUNT, User.PROP_NOTIFY_OWN_EVENTS), true);+ BeanEditor editor = BeanContext.edit("editor", newUser, Sets.newHashSet(PROP_TYPE, PROP_NOTIFY_OWN_EVENTS), true);Form<?> form = new Form<Void>("form") {diff --git a/server-core/src/main/java/io/onedev/server/web/page/security/LinkUserBean.java b/server-core/src/main/java/io/onedev/server/web/page/security/LinkUserBean.javaindex 86fd198069..d86b8bedd6 100644--- a/server-core/src/main/java/io/onedev/server/web/page/security/LinkUserBean.java+++ b/server-core/src/main/java/io/onedev/server/web/page/security/LinkUserBean.java@@ -1,5 +1,7 @@package io.onedev.server.web.page.security;+import static io.onedev.server.model.User.Type.ORDINARY;+import java.io.Serializable;import java.util.Comparator;import java.util.List;@@ -46,7 +48,7 @@ public class LinkUserBean implements Serializable {@SuppressWarnings("unused")private static List<User> getLinkableUsers() {return OneDev.getInstance(UserService.class).query().stream()- .filter(it -> !it.isServiceAccount() && !it.isDisabled())+ .filter(it -> it.getType() == ORDINARY && !it.isDisabled()).sorted(Comparator.comparing(User::getDisplayName)).collect(Collectors.toList());}diff --git a/server-core/src/main/java/io/onedev/server/web/page/security/PasswordResetPage.java b/server-core/src/main/java/io/onedev/server/web/page/security/PasswordResetPage.javaindex c4ff11c082..1adf45d87e 100644--- a/server-core/src/main/java/io/onedev/server/web/page/security/PasswordResetPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/security/PasswordResetPage.java@@ -31,6 +31,7 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;import org.jspecify.annotations.Nullable;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import java.util.Arrays;@@ -95,8 +96,10 @@ public class PasswordResetPage extends SimplePage {user = getUserService().findByVerifiedEmailAddress(loginNameOrEmail);if (user == null) {throw new ExplicitException(_T("No user found with login name or email: ") + loginNameOrEmail);- } else if (user.isServiceAccount() || user.isDisabled()) {- throw new ExplicitException(_T("Can not reset password for service account or disabled user"));+ } else if (user.isDisabled()) {+ throw new ExplicitException(_T("Can not reset password for disabled account"));+ } else if (user.getType() != ORDINARY) {+ throw new ExplicitException(_T("Can not reset password for service or AI account"));} else if (user.getPassword() == null) {throw new ExplicitException(_T("Can not reset password for user authenticating via external system"));} else {diff --git a/server-core/src/main/java/io/onedev/server/web/page/security/SignUpPage.java b/server-core/src/main/java/io/onedev/server/web/page/security/SignUpPage.javaindex 40a644d747..964c6f8146 100644--- a/server-core/src/main/java/io/onedev/server/web/page/security/SignUpPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/security/SignUpPage.java@@ -1,7 +1,7 @@package io.onedev.server.web.page.security;import static io.onedev.server.model.User.PROP_NOTIFY_OWN_EVENTS;-import static io.onedev.server.model.User.PROP_SERVICE_ACCOUNT;+import static io.onedev.server.model.User.PROP_TYPE;import static io.onedev.server.web.page.security.SignUpBean.PROP_EMAIL_ADDRESS;import org.apache.commons.lang3.StringUtils;@@ -57,7 +57,7 @@ public class SignUpPage extends SimplePage {super.onInitialize();SignUpBean bean = new SignUpBean();- BeanEditor editor = BeanContext.edit("editor", bean, Sets.newHashSet(PROP_SERVICE_ACCOUNT, PROP_NOTIFY_OWN_EVENTS), true);+ BeanEditor editor = BeanContext.edit("editor", bean, Sets.newHashSet(PROP_TYPE, PROP_NOTIFY_OWN_EVENTS), true);Form<?> form = new Form<Void>("form") {diff --git a/server-core/src/main/java/io/onedev/server/web/page/security/SsoProcessPage.java b/server-core/src/main/java/io/onedev/server/web/page/security/SsoProcessPage.javaindex dee6d71f76..613afe1237 100644--- a/server-core/src/main/java/io/onedev/server/web/page/security/SsoProcessPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/security/SsoProcessPage.java@@ -1,5 +1,6 @@package io.onedev.server.web.page.security;+import static io.onedev.server.model.User.Type.ORDINARY;import static io.onedev.server.web.translation.Translation._T;import java.text.MessageFormat;@@ -111,7 +112,7 @@ public class SsoProcessPage extends SimplePage {var ssoAccount = getSsoAccountService().find(getProvider(), authenticated.getSubject());if (ssoAccount != null) {var user = ssoAccount.getUser();- if (user.isServiceAccount() || user.isDisabled()) {+ if (user.getType() != ORDINARY || user.isDisabled()) {getSsoAccountService().delete(ssoAccount);} else {if (authenticated.getEmail() != null) {@@ -142,7 +143,7 @@ public class SsoProcessPage extends SimplePage {if (emailAddress != null) {var user = emailAddress.getOwner();if (emailAddress.isVerified()) {- if (user.isServiceAccount()) {+ if (user.getType() != ORDINARY) {getEmailAddressService().delete(emailAddress);} else if (user.isDisabled()) {throw new AuthenticationException(MessageFormat.format(_T("Email address \"{0}\" used by disabled account \"{1}\""), authenticated.getEmail(), user.getName()));@@ -246,7 +247,7 @@ public class SsoProcessPage extends SimplePage {bean.setName(authenticated.getUserName());bean.setFullName(authenticated.getFullName());var excludedProperties = new HashSet<String>();- excludedProperties.add(User.PROP_SERVICE_ACCOUNT);+ excludedProperties.add(User.PROP_TYPE);excludedProperties.add(User.PROP_NOTIFY_OWN_EVENTS);excludedProperties.add(User.PROP_PASSWORD);if (authenticated.getEmail() != null)diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/UserPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/UserPage.javaindex fba910101d..fd27bf9dee 100644--- a/server-core/src/main/java/io/onedev/server/web/page/user/UserPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/user/UserPage.java@@ -1,5 +1,7 @@package io.onedev.server.web.page.user;+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 java.util.ArrayList;@@ -22,14 +24,15 @@ import com.google.common.base.Preconditions;import io.onedev.server.OneDev;import io.onedev.server.ServerConfig;-import io.onedev.server.service.UserService;import io.onedev.server.model.User;import io.onedev.server.security.SecurityUtils;+import io.onedev.server.service.UserService;import io.onedev.server.web.component.tabbable.PageTab;import io.onedev.server.web.component.tabbable.Tabbable;import io.onedev.server.web.page.admin.usermanagement.UserListPage;import io.onedev.server.web.page.layout.LayoutPage;import io.onedev.server.web.page.user.accesstoken.UserAccessTokensPage;+import io.onedev.server.web.page.user.aisetting.UserModelSettingPage;import io.onedev.server.web.page.user.authorization.UserAuthorizationsPage;import io.onedev.server.web.page.user.avatar.UserAvatarPage;import io.onedev.server.web.page.user.basicsetting.UserBasicSettingPage;@@ -84,21 +87,23 @@ public abstract class UserPage extends LayoutPage implements UserAware {var params = paramsOf(getUser());tabs.add(new PageTab(Model.of(_T("Profile")), Model.of("profile"), UserProfilePage.class, params));tabs.add(new PageTab(Model.of(_T("Basic Settings")), Model.of("info"), UserBasicSettingPage.class, params));- if (!getUser().isServiceAccount())+ if (getUser().getType() == ORDINARY)tabs.add(new PageTab(Model.of(_T("Email Addresses")), Model.of("mail"), UserEmailAddressesPage.class, params));tabs.add(new PageTab(Model.of(_T("Edit Avatar")), Model.of("avatar"), UserAvatarPage.class, params));if (!getUser().isDisabled()) {- if (!getUser().isServiceAccount())- tabs.add(new PageTab(Model.of(_T("Password")), Model.of("password"), UserPasswordPage.class, params));+ if (getUser().getType() == ORDINARY)+ tabs.add(new PageTab(Model.of(_T("Password")), Model.of("password"), UserPasswordPage.class, params));+ if (getUser().getType() == AI)+ tabs.add(new PageTab(Model.of(_T("AI Settings")), Model.of("ai-setting"), UserModelSettingPage.class, params));tabs.add(new PageTab(Model.of(_T("Belonging Groups")), Model.of("group"), UserMembershipsPage.class, params));tabs.add(new PageTab(Model.of(_T("Authorized Projects")), Model.of("project"), UserAuthorizationsPage.class, params));if (OneDev.getInstance(ServerConfig.class).getSshPort() != 0)tabs.add(new PageTab(Model.of(_T("SSH Keys")), Model.of("key"), UserSshKeysPage.class, params));tabs.add(new PageTab(Model.of(_T("GPG Keys")), Model.of("key"), UserGpgKeysPage.class, params));tabs.add(new PageTab(Model.of(_T("Access Tokens")), Model.of("token"), UserAccessTokensPage.class, params));- if (!getUser().isServiceAccount() && getUser().isEnforce2FA())+ if (getUser().getType() == ORDINARY && getUser().isEnforce2FA())tabs.add(new PageTab(Model.of(_T("Two-factor Authentication")), Model.of("shield"), UserTwoFactorAuthenticationPage.class, params));- if (!getUser().isServiceAccount()) {+ if (getUser().getType() == ORDINARY) {tabs.add(new PageTab(Model.of(_T("SSO Accounts")), Model.of("user"), UserSsoAccountsPage.class, params));tabs.add(new PageTab(Model.of(_T("Query Watches")), Model.of("bell"), UserQueryWatchesPage.class, params));}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserAISettingPage.html b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserAISettingPage.htmlnew file mode 100644index 0000000000..49ebcbb87d--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserAISettingPage.html@@ -0,0 +1,4 @@+<wicket:extend>+ <ul wicket:id="aiSettingTabs" class="tabs nav nav-bold nav-tabs nav-tabs-line text-weight-bold mb-4"></ul>+ <wicket:child></wicket:child>+</wicket:extend>\ No newline at end of filediff --git a/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserAISettingPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserAISettingPage.javanew file mode 100644index 0000000000..a765605faa--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserAISettingPage.java@@ -0,0 +1,37 @@+package io.onedev.server.web.page.user.aisetting;++import static io.onedev.server.model.User.Type.AI;+import static io.onedev.server.web.translation.Translation._T;++import java.util.ArrayList;+import java.util.List;++import org.apache.wicket.model.Model;+import org.apache.wicket.request.mapper.parameter.PageParameters;++import io.onedev.server.web.component.tabbable.PageTab;+import io.onedev.server.web.component.tabbable.Tabbable;+import io.onedev.server.web.page.user.UserPage;++public abstract class UserAiSettingPage extends UserPage {++ public UserAiSettingPage(PageParameters params) {+ super(params);+ if (getUser().isDisabled() || getUser().getType() != AI)+ throw new IllegalStateException();+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ List<PageTab> tabs = new ArrayList<>();++ var params = paramsOf(getUser());+ tabs.add(new PageTab(Model.of(_T("Model")), null, UserModelSettingPage.class, params));+ tabs.add(new PageTab(Model.of(_T("Entitlement")), null, UserEntitlementSettingPage.class, params));++ add(new Tabbable("aiSettingTabs", tabs));+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserEntitlementSettingPage.html b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserEntitlementSettingPage.htmlnew file mode 100644index 0000000000..67ce4bc1c9--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserEntitlementSettingPage.html@@ -0,0 +1,5 @@+<wicket:extend>+ <div class="entitlement-setting">+ <div wicket:id="entitlementSetting"></div>+ </div>+</wicket:extend>diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserEntitlementSettingPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserEntitlementSettingPage.javanew file mode 100644index 0000000000..6c3e6e32c4--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserEntitlementSettingPage.java@@ -0,0 +1,29 @@+package io.onedev.server.web.page.user.aisetting;++import org.apache.wicket.model.LoadableDetachableModel;+import org.apache.wicket.request.mapper.parameter.PageParameters;++import io.onedev.server.model.User;+import io.onedev.server.web.component.user.aisetting.EntitlementSettingPanel;++public class UserEntitlementSettingPage extends UserAiSettingPage {++ public UserEntitlementSettingPage(PageParameters params) {+ super(params);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ add(new EntitlementSettingPanel("entitlementSetting", new LoadableDetachableModel<User>() {++ @Override+ protected User load() {+ return getUser();+ }++ }));+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserModelSettingPage.html b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserModelSettingPage.htmlnew file mode 100644index 0000000000..42032f59b6--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserModelSettingPage.html@@ -0,0 +1,5 @@+<wicket:extend>+ <div class="model-setting">+ <div wicket:id="modelSetting"></div>+ </div>+</wicket:extend>diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserModelSettingPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserModelSettingPage.javanew file mode 100644index 0000000000..e482be3df0--- /dev/null+++ b/server-core/src/main/java/io/onedev/server/web/page/user/aisetting/UserModelSettingPage.java@@ -0,0 +1,29 @@+package io.onedev.server.web.page.user.aisetting;++import org.apache.wicket.model.LoadableDetachableModel;+import org.apache.wicket.request.mapper.parameter.PageParameters;++import io.onedev.server.model.User;+import io.onedev.server.web.component.user.aisetting.ModelSettingPanel;++public class UserModelSettingPage extends UserAiSettingPage {++ public UserModelSettingPage(PageParameters params) {+ super(params);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ add(new ModelSettingPanel("modelSetting", new LoadableDetachableModel<User>() {++ @Override+ protected User load() {+ return getUser();+ }++ }));+ }++}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/emailaddresses/UserEmailAddressesPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/emailaddresses/UserEmailAddressesPage.javaindex ba77f65287..64bf6fe838 100644--- a/server-core/src/main/java/io/onedev/server/web/page/user/emailaddresses/UserEmailAddressesPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/user/emailaddresses/UserEmailAddressesPage.java@@ -1,5 +1,7 @@package io.onedev.server.web.page.user.emailaddresses;+import static io.onedev.server.model.User.Type.ORDINARY;+import org.apache.wicket.model.AbstractReadOnlyModel;import org.apache.wicket.request.mapper.parameter.PageParameters;@@ -11,7 +13,7 @@ public class UserEmailAddressesPage extends UserPage {public UserEmailAddressesPage(PageParameters params) {super(params);- if (getUser().isServiceAccount())+ if (getUser().getType() != ORDINARY)throw new IllegalStateException();}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/password/UserPasswordPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/password/UserPasswordPage.javaindex 6a82f2af15..ee83ed8daf 100644--- a/server-core/src/main/java/io/onedev/server/web/page/user/password/UserPasswordPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/user/password/UserPasswordPage.java@@ -1,5 +1,7 @@package io.onedev.server.web.page.user.password;+import static io.onedev.server.model.User.Type.ORDINARY;+import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.request.mapper.parameter.PageParameters;@@ -10,7 +12,7 @@ public class UserPasswordPage extends UserPage {public UserPasswordPage(PageParameters params) {super(params);- if (getUser().isServiceAccount() || getUser().isDisabled())+ if (getUser().getType() != ORDINARY || getUser().isDisabled())throw new IllegalStateException();}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/querywatch/UserQueryWatchesPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/querywatch/UserQueryWatchesPage.javaindex 1774d1fc6a..c7b8077c77 100644--- a/server-core/src/main/java/io/onedev/server/web/page/user/querywatch/UserQueryWatchesPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/user/querywatch/UserQueryWatchesPage.java@@ -1,5 +1,7 @@package io.onedev.server.web.page.user.querywatch;+import static io.onedev.server.model.User.Type.ORDINARY;+import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.request.mapper.parameter.PageParameters;@@ -14,7 +16,7 @@ public class UserQueryWatchesPage extends UserPage {public UserQueryWatchesPage(PageParameters params) {super(params);- if (getUser().isServiceAccount() || getUser().isDisabled())+ if (getUser().getType() != ORDINARY || getUser().isDisabled())throw new IllegalStateException();tabName = params.get(PARAM_TAB).toString(QueryWatchesPanel.TAB_ISSUE);}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/ssoaccounts/UserSsoAccountsPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/ssoaccounts/UserSsoAccountsPage.javaindex ad37fe68db..1df3bafb61 100644--- a/server-core/src/main/java/io/onedev/server/web/page/user/ssoaccounts/UserSsoAccountsPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/user/ssoaccounts/UserSsoAccountsPage.java@@ -1,5 +1,7 @@package io.onedev.server.web.page.user.ssoaccounts;+import static io.onedev.server.model.User.Type.ORDINARY;+import org.apache.wicket.model.LoadableDetachableModel;import org.apache.wicket.request.mapper.parameter.PageParameters;@@ -11,7 +13,7 @@ public class UserSsoAccountsPage extends UserPage {public UserSsoAccountsPage(PageParameters params) {super(params);- if (getUser().isDisabled() || getUser().isServiceAccount())+ if (getUser().isDisabled() || getUser().getType() != ORDINARY)throw new IllegalStateException();}diff --git a/server-core/src/main/java/io/onedev/server/web/page/user/twofactorauthentication/UserTwoFactorAuthenticationPage.java b/server-core/src/main/java/io/onedev/server/web/page/user/twofactorauthentication/UserTwoFactorAuthenticationPage.javaindex 5c21bd1969..75f95a0aa0 100644--- a/server-core/src/main/java/io/onedev/server/web/page/user/twofactorauthentication/UserTwoFactorAuthenticationPage.java+++ b/server-core/src/main/java/io/onedev/server/web/page/user/twofactorauthentication/UserTwoFactorAuthenticationPage.java@@ -5,13 +5,15 @@ import io.onedev.server.model.User;import io.onedev.server.web.component.user.twofactorauthentication.TwoFactorAuthenticationStatusPanel;import io.onedev.server.web.page.user.UserPage;+import static io.onedev.server.model.User.Type.ORDINARY;+import org.apache.wicket.request.mapper.parameter.PageParameters;public class UserTwoFactorAuthenticationPage extends UserPage {public UserTwoFactorAuthenticationPage(PageParameters params) {super(params);- if (getUser().isServiceAccount() || getUser().isDisabled())+ if (getUser().getType() != ORDINARY || getUser().isDisabled())throw new IllegalStateException();}diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation.javaindex 74ef47b572..99113d3c0c 100644--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation.java+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation.java@@ -192,6 +192,7 @@ public class Translation extends TranslationResourceBundle {m.put("severity:HIGH", "High");m.put("severity:MEDIUM", "Medium");m.put("severity:LOW", "Low");+ m.put("Ai", "AI");}@Overridediff --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.javaindex c6d806d559..0223b23b74 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@@ -126,9 +126,10 @@ public class Translation_de extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "Ein {0}, der als Körper der Benutzer-Einladungs-E-Mail verwendet wird");m.put("A {0} used as body of various issue notification emails", "Ein {0}, der als Körper verschiedener Problem-Benachrichtigungs-E-Mails verwendet wird");m.put("A {0} used as body of various pull request notification emails", "Ein {0}, der als Körper verschiedener Pull-Request-Benachrichtigungs-E-Mails verwendet wird");- m.put("AI Model Setting", "KI-Modell-Einstellung");- m.put("AI Setting", "KI-Einstellung");+ m.put("AI Model Settings", "AI-Modell-Einstellungen");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("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>");@@ -248,6 +249,8 @@ public class Translation_de extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "Aggregiert von '<span wicket:id=\"spentTimeAggregationLink\"></span>':");m.put("Aggregation Link", "Aggregations-Link");m.put("Ai", "KI");+ m.put("Ai Model Setting", "AI-Modell-Einstellung");+ m.put("Ai Setting", "AI-Einstellung");m.put("Alert", "Alarm");m.put("Alert Setting", "Alarm-Einstellung");m.put("Alert Settings", "Alarm-Einstellungen");@@ -561,7 +564,8 @@ public class Translation_de extends TranslationResourceBundle {m.put("Can not find issue board: ", "Kann Issue-Board nicht finden:");m.put("Can not move project \"{0}\" to be under itself or its descendants", "Projekt \"{0}\" kann nicht unter sich selbst oder seinen Nachkommen verschoben werden");m.put("Can not perform this operation now", "Diese Operation kann jetzt nicht durchgeführt werden");- m.put("Can not reset password for service account or disabled user", "Passwort kann nicht für Dienstkonto oder deaktivierten Benutzer zurückgesetzt werden");+ m.put("Can not reset password for disabled account", "Passwort kann für deaktiviertes Konto nicht zurückgesetzt werden");+ m.put("Can not reset password for service or AI account", "Passwort kann für Service- oder AI-Konto nicht zurückgesetzt werden");m.put("Can not reset password for user authenticating via external system", "Passwort kann nicht für Benutzer zurückgesetzt werden, der sich über ein externes System authentifiziert");m.put("Can not save malformed query", "Fehlerhafte Abfrage kann nicht gespeichert werden");m.put("Can not use current or descendant project as parent", "Aktuelles oder Nachkommenprojekt kann nicht als übergeordnetes Projekt verwendet werden");@@ -593,6 +597,9 @@ 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 deleted", "Chat gelöscht");+ m.put("Chat with", "Chat mit");+ m.put("Chat with AI", "Chat mit AI");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",@@ -946,6 +953,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("Delete Selected Users", "Ausgewählte Benutzer löschen");m.put("Delete Source Branch", "Quellbranch löschen");m.put("Delete Source Branch After Merge", "Quellbranch nach dem Merge löschen");+ m.put("Delete chat", "Chat löschen");m.put("Delete dashboard", "Dashboard löschen");m.put("Delete from branch {0}", "Von Branch {0} löschen");m.put("Delete this", "Dies löschen");@@ -1191,6 +1199,11 @@ public class Translation_de extends TranslationResourceBundle {m.put("Enter description here", "Geben Sie hier eine Beschreibung ein");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("Entitled Groups", "Berechtigte Gruppen");+ m.put("Entitled Projects", "Berechtigte Projekte");+ m.put("Entitled Users", "Berechtigte Benutzer");+ m.put("Entitlement", "Berechtigung");+ m.put("Entitlement Edit Bean", "Berechtigungs-Edit-Bean");m.put("Entries", "Einträge");m.put("Entry", "Eintrag");m.put("Enumeration", "Aufzählung");@@ -1997,6 +2010,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("Minimum length of the password", "Minimale Länge des Passworts");m.put("Missing Commit", "Fehlender Commit");m.put("Missing Commits", "Fehlende Commits");+ m.put("Model", "Modell");m.put("Month", "Monat");m.put("Months", "Monate");m.put("Months to Display", "Anzuzeigende Monate");@@ -2018,6 +2032,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("Multiple Lines", "Mehrere Zeilen");m.put("Multiple On the Other Side", "Mehrere auf der anderen Seite");m.put("Must not be empty", "Darf nicht leer sein");+ m.put("My AI Settings", "Meine AI-Einstellungen");m.put("My Access Tokens", "Meine Zugriffstoken");m.put("My Basic Settings", "Meine Grundeinstellungen");m.put("My Email Addresses", "Meine E-Mail-Adressen");@@ -2074,6 +2089,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("New State", "Neuer Status");m.put("New User Bean", "Neue Benutzer-Bean");m.put("New Value", "Neuer Wert");+ m.put("New chat", "Neuer Chat");m.put("New issue board created", "Neues Issue-Board erstellt");m.put("New project created", "Neues Projekt erstellt");m.put("New user created", "Neuer Benutzer erstellt");@@ -2539,6 +2555,9 @@ public class Translation_de extends TranslationResourceBundle {m.put("Order Subscription", "Abonnement bestellen");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("Osv License Scanner", "Osv-Lizenzscanner");m.put("Osv Vulnerability Scanner", "Osv-Schwachstellenscanner");m.put("Other", "Andere");@@ -3171,6 +3190,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","Benutzer auswählen, die bei Ereignissen wie Datenbank-Auto-Backup-Fehler, nicht erreichbarer Cluster-Knoten usw. eine Alarm-E-Mail erhalten sollen");m.put("Select workspace to import from", "Arbeitsbereich auswählen, aus dem importiert werden soll");+ m.put("Send", "Senden");m.put("Send Notifications", "Benachrichtigungen senden");m.put("Send Pull Request", "Pull-Request senden");m.put("Send notification", "Benachrichtigung senden");@@ -3192,7 +3212,6 @@ public class Translation_de extends TranslationResourceBundle {m.put("Server is Starting...", "Server wird gestartet...");m.put("Server url", "Server-URL");m.put("Service", "Dienst");- m.put("Service Account", "Dienstkonto");m.put("Service Desk", "Service Desk");m.put("Service Desk Email Address", "Service-Desk-E-Mail-Adresse");m.put("Service Desk Issue Open Failed", "Service-Desk-Problem konnte nicht geöffnet werden");@@ -3204,9 +3223,9 @@ public class Translation_de extends TranslationResourceBundle {m.put("Service Desk Settings", "Service-Desk-Einstellungen");m.put("Service Locator", "Service-Locator");m.put("Service Locators", "Service-Locators");- m.put("Service account not allowed to login", "Dienstkonto darf sich nicht anmelden");m.put("Service desk setting", "Service-Desk-Einstellung");m.put("Service desk settings have been saved", "Service-Desk-Einstellungen wurden gespeichert");+ m.put("Service or AI account not allowed to login", "Service- oder AI-Konto darf sich nicht anmelden");m.put("Services", "Dienste");m.put("Session Timeout", "Sitzungs-Timeout");m.put("Set", "Festlegen");@@ -3355,6 +3374,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "Gibt das Passwort des oben genannten Manager-DN an");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("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",@@ -3737,6 +3757,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("Steps", "Schritte");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","Schritte werden seriell auf demselben Knoten ausgeführt und teilen sich denselben <a href='https://docs.onedev.io/concepts#job-workspace'>Job-Arbeitsbereich</a>");+ m.put("Stop", "Stopp");m.put("Stop work", "Arbeit beenden");m.put("Stopwatch Overdue", "Stoppuhr überfällig");m.put("Storage Settings", "Speichereinstellungen");@@ -3919,10 +3940,12 @@ public class Translation_de extends TranslationResourceBundle {"Das Abonnement dieser Installation ist abgelaufen und läuft jetzt als Community-Edition");m.put("This is a Git LFS object, but the storage file is missing", "Dies ist ein Git-LFS-Objekt, aber die Speicherdatei fehlt");m.put("This is a built-in role and can not be deleted", "Dies ist eine integrierte Rolle und kann nicht gelöscht werden");+ m.put("This is a disabled AI account", "Dies ist ein deaktiviertes AI-Konto");m.put("This is a disabled service account", "Dies ist ein deaktiviertes Servicekonto");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","Dies ist ein Layer-Cache. Um den Cache zu verwenden, fügen Sie die folgende Option zu Ihrem Docker-Buildx-Befehl hinzu");m.put("This is a service account for task automation purpose", "Dies ist ein Servicekonto für Automatisierungsaufgaben");+ m.put("This is an AI account", "Dies ist ein AI-Konto");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","Dies ist eine Enterprise-Funktion. <a href='https://onedev.io/pricing' target='_blank'>30 Tage kostenlos testen</a>");m.put("This key has already been used by another project", "Dieser Schlüssel wurde bereits von einem anderen Projekt verwendet");@@ -4113,6 +4136,7 @@ public class Translation_de extends TranslationResourceBundle {m.put("Type password here", "Geben Sie hier das Passwort ein.");m.put("Type to filter", "Geben Sie ein, um zu filtern.");m.put("Type to filter...", "Geben Sie ein, um zu filtern...");+ m.put("Type your message here", "Geben Sie hier Ihre Nachricht ein");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "Kann derzeit nicht gelöscht/deaktiviert werden");m.put("Unable to apply change as otherwise you will not be able to manage this project", "Änderung konnte nicht angewendet werden, da Sie sonst dieses Projekt nicht verwalten können.");@@ -4339,10 +4363,6 @@ public class Translation_de extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","Ob das Image immer gezogen werden soll, wenn ein Container ausgeführt oder Images erstellt werden. Diese Option sollte aktiviert werden, um zu vermeiden, dass Images durch bösartige Jobs auf demselben Node ersetzt werden");m.put("Whether or not to be able to access time tracking info of issues", "Ob auf Zeitverfolgungsinformationen von Problemen zugegriffen werden kann oder nicht");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "Ob als Service-Konto für Aufgabenautomatisierungszwecke erstellt werden soll oder nicht. Service-Konten haben kein Passwort und keine E-Mail-Adressen und generieren keine Benachrichtigungen für ihre Aktivitäten");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "Ob als Service-Konto für Aufgabenautomatisierungszwecke erstellt werden soll oder nicht. Service-Konten haben kein Passwort und keine E-Mail-Adressen und generieren keine Benachrichtigungen für ihre Aktivitäten. <b class='text-warning'>HINWEIS:</b> Service-Konto ist eine Enterprise-Funktion. <a href='https://onedev.io/pricing' target='_blank'>30 Tage kostenlos testen</a>");m.put("Whether or not to enable code management for the project", "Ob die Codeverwaltung für das Projekt aktiviert werden soll oder nicht");m.put("Whether or not to enable issue management for the project", "Ob die Problemverwaltung für das Projekt aktiviert werden soll oder nicht");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4661,6 +4681,7 @@ 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("Entitle to All Users", "Allen Benutzern zuweisen");}@Overridediff --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.javaindex 34edeaa70f..70842a3d66 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@@ -126,9 +126,10 @@ public class Translation_es extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "Un {0} usado como cuerpo del correo de invitación de usuario");m.put("A {0} used as body of various issue notification emails", "Un {0} usado como cuerpo de varios correos de notificación de problemas");m.put("A {0} used as body of various pull request notification emails", "Un {0} usado como cuerpo de varios correos de notificación de solicitudes de extracción");- m.put("AI Model Setting", "Configuración del Modelo de IA");- m.put("AI Setting", "Configuración de IA");+ m.put("AI Model Settings", "Configuración del Modelo de IA");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("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>");@@ -248,6 +249,8 @@ public class Translation_es extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "Agregado desde '<span wicket:id=\"spentTimeAggregationLink\"></span>':");m.put("Aggregation Link", "Enlace de agregación");m.put("Ai", "IA");+ m.put("Ai Model Setting", "Configuración del Modelo de IA");+ m.put("Ai Setting", "Configuración de IA");m.put("Alert", "Alerta");m.put("Alert Setting", "Configuración de alerta");m.put("Alert Settings", "Configuraciones de alerta");@@ -561,7 +564,8 @@ public class Translation_es extends TranslationResourceBundle {m.put("Can not find issue board: ", "No se puede encontrar el tablero de problemas:");m.put("Can not move project \"{0}\" to be under itself or its descendants", "No se puede mover el proyecto \"{0}\" para que esté bajo sí mismo o sus descendientes");m.put("Can not perform this operation now", "No se puede realizar esta operación ahora");- m.put("Can not reset password for service account or disabled user", "No se puede restablecer la contraseña para la cuenta de servicio o usuario deshabilitado");+ m.put("Can not reset password for disabled account", "No se puede restablecer la contraseña para una cuenta deshabilitada");+ m.put("Can not reset password for service or AI account", "No se puede restablecer la contraseña para una cuenta de servicio o de IA");m.put("Can not reset password for user authenticating via external system", "No se puede restablecer la contraseña para el usuario que se autentica a través de un sistema externo");m.put("Can not save malformed query", "No se puede guardar una consulta mal formada");m.put("Can not use current or descendant project as parent", "No se puede usar el proyecto actual o descendiente como padre");@@ -593,6 +597,9 @@ 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 deleted", "Chat eliminado");+ m.put("Chat with", "Chat con");+ m.put("Chat with AI", "Chat con IA");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",@@ -946,6 +953,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("Delete Selected Users", "Eliminar usuarios seleccionados");m.put("Delete Source Branch", "Eliminar rama fuente");m.put("Delete Source Branch After Merge", "Eliminar rama fuente después de la fusión");+ m.put("Delete chat", "Eliminar chat");m.put("Delete dashboard", "Eliminar tablero");m.put("Delete from branch {0}", "Eliminar desde la rama {0}");m.put("Delete this", "Eliminar esto");@@ -1191,6 +1199,11 @@ public class Translation_es extends TranslationResourceBundle {m.put("Enter description here", "Ingrese la descripción aquí");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("Entitled Groups", "Grupos Autorizados");+ m.put("Entitled Projects", "Proyectos Autorizados");+ m.put("Entitled Users", "Usuarios Autorizados");+ m.put("Entitlement", "Autorización");+ m.put("Entitlement Edit Bean", "Editar Bean de Autorización");m.put("Entries", "Entradas");m.put("Entry", "Entrada");m.put("Enumeration", "Enumeración");@@ -1997,6 +2010,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("Minimum length of the password", "Longitud mínima de la contraseña");m.put("Missing Commit", "Commit faltante");m.put("Missing Commits", "Commits faltantes");+ m.put("Model", "Modelo");m.put("Month", "Mes");m.put("Months", "Meses");m.put("Months to Display", "Meses para mostrar");@@ -2018,6 +2032,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("Multiple Lines", "Líneas múltiples");m.put("Multiple On the Other Side", "Múltiples en el otro lado");m.put("Must not be empty", "No debe estar vacío");+ m.put("My AI Settings", "Mis Configuraciones de IA");m.put("My Access Tokens", "Mis tokens de acceso");m.put("My Basic Settings", "Mis configuraciones básicas");m.put("My Email Addresses", "Mis direcciones de correo electrónico");@@ -2074,6 +2089,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("New State", "Nuevo estado");m.put("New User Bean", "Nuevo Bean de usuario");m.put("New Value", "Nuevo valor");+ m.put("New chat", "Nuevo chat");m.put("New issue board created", "Nuevo tablero de incidencias creado");m.put("New project created", "Nuevo proyecto creado");m.put("New user created", "Nuevo usuario creado");@@ -2539,6 +2555,9 @@ public class Translation_es extends TranslationResourceBundle {m.put("Order Subscription", "Ordenar Suscripción");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("Osv License Scanner", "Escáner de Licencias Osv");m.put("Osv Vulnerability Scanner", "Escáner de Vulnerabilidades Osv");m.put("Other", "Otro");@@ -3171,6 +3190,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","Seleccionar usuarios para enviar correos de alerta ante eventos como fallos de auto-respaldo de base de datos, nodo de clúster inalcanzable, etc.");m.put("Select workspace to import from", "Seleccionar espacio de trabajo para importar.");+ m.put("Send", "Enviar");m.put("Send Notifications", "Enviar notificaciones.");m.put("Send Pull Request", "Enviar solicitud de extracción.");m.put("Send notification", "Enviar notificación.");@@ -3192,7 +3212,6 @@ public class Translation_es extends TranslationResourceBundle {m.put("Server is Starting...", "El servidor está iniciando...");m.put("Server url", "URL del servidor.");m.put("Service", "Servicio.");- m.put("Service Account", "Cuenta de servicio.");m.put("Service Desk", "Mesa de servicio.");m.put("Service Desk Email Address", "Dirección de correo electrónico de la mesa de servicio.");m.put("Service Desk Issue Open Failed", "Error al abrir problema en la mesa de servicio.");@@ -3204,9 +3223,9 @@ public class Translation_es extends TranslationResourceBundle {m.put("Service Desk Settings", "Configuraciones de la mesa de servicio.");m.put("Service Locator", "Localizador de servicio.");m.put("Service Locators", "Localizadores de servicio.");- m.put("Service account not allowed to login", "Cuenta de servicio no permitida para iniciar sesión");m.put("Service desk setting", "Configuración del servicio de mesa");m.put("Service desk settings have been saved", "Las configuraciones del servicio de mesa han sido guardadas");+ m.put("Service or AI account not allowed to login", "No se permite el inicio de sesión para cuentas de servicio o de IA");m.put("Services", "Servicios");m.put("Session Timeout", "Tiempo de Espera de Sesión");m.put("Set", "Establecer");@@ -3355,6 +3374,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "Especifica la contraseña del DN del administrador mencionado anteriormente");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("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",@@ -3737,6 +3757,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("Steps", "Pasos");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","Los pasos se ejecutarán en serie en el mismo nodo, compartiendo el mismo <a href='https://docs.onedev.io/concepts#job-workspace'>espacio de trabajo del trabajo</a>");+ m.put("Stop", "Detener");m.put("Stop work", "Detener trabajo");m.put("Stopwatch Overdue", "Cronómetro Vencido");m.put("Storage Settings", "Configuración de almacenamiento");@@ -3919,10 +3940,12 @@ public class Translation_es extends TranslationResourceBundle {"La suscripción de esta instalación ha expirado y ahora se ejecuta como la edición comunitaria");m.put("This is a Git LFS object, but the storage file is missing", "Este es un objeto Git LFS, pero falta el archivo de almacenamiento");m.put("This is a built-in role and can not be deleted", "Este es un rol integrado y no se puede eliminar");+ m.put("This is a disabled AI account", "Esta es una cuenta de IA deshabilitada");m.put("This is a disabled service account", "Esta es una cuenta de servicio deshabilitada");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","Este es un caché de capas. Para usar el caché, agregue la siguiente opción a su comando docker buildx");m.put("This is a service account for task automation purpose", "Esta es una cuenta de servicio para propósitos de automatización de tareas");+ m.put("This is an AI account", "Esta es una cuenta de IA");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","Esta es una característica enterprise. <a href='https://onedev.io/pricing' target='_blank'>Pruebe gratis</a> por 30 días");m.put("This key has already been used by another project", "Esta clave ya ha sido utilizada por otro proyecto");@@ -4113,6 +4136,7 @@ public class Translation_es extends TranslationResourceBundle {m.put("Type password here", "Escriba la contraseña aquí");m.put("Type to filter", "Escriba para filtrar");m.put("Type to filter...", "Escriba para filtrar...");+ m.put("Type your message here", "Escribe tu mensaje aquí");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "No se puede eliminar/deshabilitar en este momento");m.put("Unable to apply change as otherwise you will not be able to manage this project", "No se puede aplicar el cambio ya que de otro modo no podrá gestionar este proyecto");@@ -4339,10 +4363,6 @@ public class Translation_es extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","Si siempre se debe extraer la imagen al ejecutar el contenedor o construir imágenes o no. Esta opción debe estar habilitada para evitar que las imágenes sean reemplazadas por trabajos maliciosos que se ejecuten en el mismo nodo");m.put("Whether or not to be able to access time tracking info of issues", "Si se puede acceder o no a la información de seguimiento de tiempo de los problemas");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "Si se crea como una cuenta de servicio para propósitos de automatización de tareas o no. La cuenta de servicio no tiene contraseña ni direcciones de correo electrónico, y no generará notificaciones por sus actividades");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "Si se crea como una cuenta de servicio para propósitos de automatización de tareas o no. La cuenta de servicio no tiene contraseña ni direcciones de correo electrónico, y no generará notificaciones por sus actividades. <b class='text-warning'>NOTA:</b> La cuenta de servicio es una característica empresarial. <a href='https://onedev.io/pricing' target='_blank'>Prueba gratis</a> por 30 días");m.put("Whether or not to enable code management for the project", "Si se habilita o no la gestión de código para el proyecto");m.put("Whether or not to enable issue management for the project", "Si se habilita o no la gestión de problemas para el proyecto");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4661,6 +4681,7 @@ 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("Entitle to All Users", "Conceder a Todos los Usuarios");}@Overridediff --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.javaindex 7cbd13071e..199ae2d57c 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@@ -126,9 +126,10 @@ public class Translation_fr extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "Un {0} utilisé comme corps de l'email d'invitation utilisateur");m.put("A {0} used as body of various issue notification emails", "Un {0} utilisé comme corps des divers emails de notification de problème");m.put("A {0} used as body of various pull request notification emails", "Un {0} utilisé comme corps des divers emails de notification de demande de tirage");- m.put("AI Model Setting", "Paramètre du modèle d'IA");- m.put("AI Setting", "Paramètre de l'IA");+ m.put("AI Model Settings", "Paramètres du modèle AI");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("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>");@@ -248,6 +249,8 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "Agrégé depuis '<span wicket:id=\"spentTimeAggregationLink\"></span>' :");m.put("Aggregation Link", "Lien d'agrégation");m.put("Ai", "IA");+ m.put("Ai Model Setting", "Paramètre du modèle AI");+ m.put("Ai Setting", "Paramètre AI");m.put("Alert", "Alerte");m.put("Alert Setting", "Paramètre d'alerte");m.put("Alert Settings", "Paramètres d'alerte");@@ -561,7 +564,8 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Can not find issue board: ", "Impossible de trouver le tableau des problèmes :");m.put("Can not move project \"{0}\" to be under itself or its descendants", "Impossible de déplacer le projet \"{0}\" pour qu'il soit sous lui-même ou ses descendants");m.put("Can not perform this operation now", "Impossible d'effectuer cette opération maintenant");- m.put("Can not reset password for service account or disabled user", "Impossible de réinitialiser le mot de passe pour un compte de service ou un utilisateur désactivé");+ m.put("Can not reset password for disabled account", "Impossible de réinitialiser le mot de passe pour un compte désactivé");+ m.put("Can not reset password for service or AI account", "Impossible de réinitialiser le mot de passe pour un compte de service ou AI");m.put("Can not reset password for user authenticating via external system", "Impossible de réinitialiser le mot de passe pour un utilisateur s'authentifiant via un système externe");m.put("Can not save malformed query", "Impossible d'enregistrer une requête malformée");m.put("Can not use current or descendant project as parent", "Impossible d'utiliser le projet actuel ou descendant comme parent");@@ -593,6 +597,9 @@ 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 deleted", "Chat supprimé");+ m.put("Chat with", "Chat avec");+ m.put("Chat with AI", "Chat avec AI");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",@@ -946,6 +953,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Delete Selected Users", "Supprimer les utilisateurs sélectionnés");m.put("Delete Source Branch", "Supprimer la branche source");m.put("Delete Source Branch After Merge", "Supprimer la branche source après fusion");+ m.put("Delete chat", "Supprimer le chat");m.put("Delete dashboard", "Supprimer le tableau de bord");m.put("Delete from branch {0}", "Supprimer de la branche {0}");m.put("Delete this", "Supprimer ceci");@@ -1191,6 +1199,11 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Enter description here", "Entrez la description ici");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("Entitled Groups", "Groupes autorisés");+ m.put("Entitled Projects", "Projets autorisés");+ m.put("Entitled Users", "Utilisateurs autorisés");+ m.put("Entitlement", "Autorisation");+ m.put("Entitlement Edit Bean", "Modifier l'autorisation Bean");m.put("Entries", "Entrées");m.put("Entry", "Entrée");m.put("Enumeration", "Énumération");@@ -1997,6 +2010,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Minimum length of the password", "Longueur minimale du mot de passe");m.put("Missing Commit", "Commit manquant");m.put("Missing Commits", "Commits manquants");+ m.put("Model", "Modèle");m.put("Month", "Mois");m.put("Months", "Mois");m.put("Months to Display", "Mois à afficher");@@ -2018,6 +2032,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Multiple Lines", "Lignes multiples");m.put("Multiple On the Other Side", "Multiples de l'autre côté");m.put("Must not be empty", "Ne doit pas être vide");+ m.put("My AI Settings", "Mes paramètres AI");m.put("My Access Tokens", "Mes jetons d'accès");m.put("My Basic Settings", "Mes paramètres de base");m.put("My Email Addresses", "Mes adresses e-mail");@@ -2074,6 +2089,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("New State", "Nouvel état");m.put("New User Bean", "Bean d'utilisateur nouveau");m.put("New Value", "Nouvelle valeur");+ m.put("New chat", "Nouveau chat");m.put("New issue board created", "Nouveau tableau d'issues créé");m.put("New project created", "Nouveau projet créé");m.put("New user created", "Nouvel utilisateur créé");@@ -2539,6 +2555,9 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Order Subscription", "Commander l'abonnement");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("Osv License Scanner", "Scanner de licence Osv");m.put("Osv Vulnerability Scanner", "Scanner de vulnérabilité Osv");m.put("Other", "Autre");@@ -3171,6 +3190,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","Sélectionner les utilisateurs pour envoyer un email d'alerte lors d'événements tels qu'un échec de sauvegarde automatique de la base de données, un nœud de cluster inaccessible, etc.");m.put("Select workspace to import from", "Sélectionner un espace de travail à importer");+ m.put("Send", "Envoyer");m.put("Send Notifications", "Envoyer des notifications");m.put("Send Pull Request", "Envoyer une pull request");m.put("Send notification", "Envoyer une notification");@@ -3192,7 +3212,6 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Server is Starting...", "Le serveur démarre...");m.put("Server url", "URL du serveur");m.put("Service", "Service");- m.put("Service Account", "Compte de service");m.put("Service Desk", "Service Desk");m.put("Service Desk Email Address", "Adresse email du Service Desk");m.put("Service Desk Issue Open Failed", "Échec de l'ouverture d'un problème dans le Service Desk");@@ -3204,9 +3223,9 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Service Desk Settings", "Paramètres du Service Desk");m.put("Service Locator", "Localisateur de service");m.put("Service Locators", "Localisateurs de service");- m.put("Service account not allowed to login", "Compte de service non autorisé à se connecter");m.put("Service desk setting", "Paramètre du service desk");m.put("Service desk settings have been saved", "Les paramètres du service desk ont été enregistrés");+ m.put("Service or AI account not allowed to login", "Compte de service ou AI non autorisé à se connecter");m.put("Services", "Services");m.put("Session Timeout", "Expiration de session");m.put("Set", "Définir");@@ -3355,6 +3374,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "Spécifie le mot de passe du DN du gestionnaire ci-dessus");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("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",@@ -3737,6 +3757,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Steps", "Étapes");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","Les étapes seront exécutées séquentiellement sur le même nœud, partageant le même <a href='https://docs.onedev.io/concepts#job-workspace'>espace de travail du travail</a>");+ m.put("Stop", "Arrêter");m.put("Stop work", "Arrêter le travail");m.put("Stopwatch Overdue", "Chronomètre en retard");m.put("Storage Settings", "Paramètres de stockage");@@ -3919,10 +3940,12 @@ public class Translation_fr extends TranslationResourceBundle {"L'abonnement de cette installation a expiré et fonctionne maintenant en édition communautaire");m.put("This is a Git LFS object, but the storage file is missing", "Ceci est un objet Git LFS, mais le fichier de stockage est manquant");m.put("This is a built-in role and can not be deleted", "Ceci est un rôle intégré et ne peut pas être supprimé");+ m.put("This is a disabled AI account", "Ceci est un compte AI désactivé");m.put("This is a disabled service account", "Ceci est un compte de service désactivé");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","Ceci est un cache de couche. Pour utiliser le cache, ajoutez l'option ci-dessous à votre commande docker buildx");m.put("This is a service account for task automation purpose", "Ceci est un compte de service destiné à l'automatisation des tâches");+ m.put("This is an AI account", "Ceci est un compte AI");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","Ceci est une fonctionnalité Enterprise. <a href='https://onedev.io/pricing' target='_blank'>Essayez gratuitement</a> pendant 30 jours");m.put("This key has already been used by another project", "Cette clé a déjà été utilisée par un autre projet");@@ -4113,6 +4136,7 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Type password here", "Tapez le mot de passe ici");m.put("Type to filter", "Tapez pour filtrer");m.put("Type to filter...", "Tapez pour filtrer...");+ m.put("Type your message here", "Tapez votre message ici");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "Impossible de supprimer/désactiver pour le moment");m.put("Unable to apply change as otherwise you will not be able to manage this project", "Impossible d'appliquer le changement car vous ne pourrez pas gérer ce projet autrement");@@ -4339,10 +4363,6 @@ public class Translation_fr extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","Si l'image doit toujours être tirée lors de l'exécution du conteneur ou de la construction des images ou non. Cette option doit être activée pour éviter que les images ne soient remplacées par des jobs malveillants exécutés sur le même nœud");m.put("Whether or not to be able to access time tracking info of issues", "Si les informations de suivi du temps des issues peuvent être accessibles ou non");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "Si le compte doit être créé comme un compte de service à des fins d'automatisation des tâches ou non. Le compte de service n'a pas de mot de passe ni d'adresses email, et ne générera pas de notifications pour ses activités");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "Si le compte doit être créé comme un compte de service à des fins d'automatisation des tâches ou non. Le compte de service n'a pas de mot de passe ni d'adresses email, et ne générera pas de notifications pour ses activités. <b class='text-warning'>REMARQUE :</b> Le compte de service est une fonctionnalité d'entreprise. <a href='https://onedev.io/pricing' target='_blank'>Essayez gratuitement</a> pendant 30 jours");m.put("Whether or not to enable code management for the project", "Si la gestion du code doit être activée pour le projet ou non");m.put("Whether or not to enable issue management for the project", "Si la gestion des issues doit être activée pour le projet ou non");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4661,6 +4681,7 @@ 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("Entitle to All Users", "Attribuer à tous les utilisateurs");}@Overridediff --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.javaindex 60e0ab1aa3..131bd35482 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@@ -126,9 +126,10 @@ public class Translation_it extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "Un {0} utilizzato come corpo dell'email di invito utente");m.put("A {0} used as body of various issue notification emails", "Un {0} utilizzato come corpo delle varie email di notifica delle issue");m.put("A {0} used as body of various pull request notification emails", "Un {0} utilizzato come corpo delle varie email di notifica delle pull request");- m.put("AI Model Setting", "Impostazione Modello AI");- m.put("AI Setting", "Impostazione AI");+ m.put("AI Model Settings", "Impostazioni del Modello AI");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("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>");@@ -248,6 +249,8 @@ public class Translation_it extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "Aggregato da '<span wicket:id=\"spentTimeAggregationLink\"></span>':");m.put("Aggregation Link", "Collegamento di aggregazione");m.put("Ai", "Ai");+ m.put("Ai Model Setting", "Impostazione del Modello AI");+ m.put("Ai Setting", "Impostazione AI");m.put("Alert", "Avviso");m.put("Alert Setting", "Impostazione avviso");m.put("Alert Settings", "Impostazioni avviso");@@ -561,7 +564,8 @@ public class Translation_it extends TranslationResourceBundle {m.put("Can not find issue board: ", "Impossibile trovare la bacheca dei problemi:");m.put("Can not move project \"{0}\" to be under itself or its descendants", "Non è possibile spostare il progetto \"{0}\" sotto se stesso o i suoi discendenti");m.put("Can not perform this operation now", "Non è possibile eseguire questa operazione ora");- m.put("Can not reset password for service account or disabled user", "Impossibile reimpostare la password per account di servizio o utente disabilitato");+ m.put("Can not reset password for disabled account", "Impossibile reimpostare la password per l'account disabilitato");+ m.put("Can not reset password for service or AI account", "Impossibile reimpostare la password per l'account di servizio o AI");m.put("Can not reset password for user authenticating via external system", "Impossibile reimpostare la password per utente che si autentica tramite sistema esterno");m.put("Can not save malformed query", "Non è possibile salvare una query malformata");m.put("Can not use current or descendant project as parent", "Non è possibile utilizzare il progetto corrente o un discendente come genitore");@@ -593,6 +597,9 @@ 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 deleted", "Chat eliminata");+ m.put("Chat with", "Chatta con");+ m.put("Chat with AI", "Chatta con AI");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",@@ -946,6 +953,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("Delete Selected Users", "Elimina gli utenti selezionati");m.put("Delete Source Branch", "Elimina il branch sorgente");m.put("Delete Source Branch After Merge", "Elimina il branch sorgente dopo il merge");+ m.put("Delete chat", "Elimina chat");m.put("Delete dashboard", "Elimina la dashboard");m.put("Delete from branch {0}", "Elimina dal branch {0}");m.put("Delete this", "Elimina questo");@@ -1191,6 +1199,11 @@ public class Translation_it extends TranslationResourceBundle {m.put("Enter description here", "Inserisci qui la descrizione");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("Entitled Groups", "Gruppi Autorizzati");+ m.put("Entitled Projects", "Progetti Autorizzati");+ m.put("Entitled Users", "Utenti Autorizzati");+ m.put("Entitlement", "Autorizzazione");+ m.put("Entitlement Edit Bean", "Modifica Bean di Autorizzazione");m.put("Entries", "Voci");m.put("Entry", "Voce");m.put("Enumeration", "Enumerazione");@@ -1997,6 +2010,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("Minimum length of the password", "Lunghezza minima della password");m.put("Missing Commit", "Commit mancante");m.put("Missing Commits", "Commit mancanti");+ m.put("Model", "Modello");m.put("Month", "Mese");m.put("Months", "Mesi");m.put("Months to Display", "Mesi da visualizzare");@@ -2018,6 +2032,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("Multiple Lines", "Linee multiple");m.put("Multiple On the Other Side", "Multiplo dall'altra parte");m.put("Must not be empty", "Non deve essere vuoto");+ m.put("My AI Settings", "Le Mie Impostazioni AI");m.put("My Access Tokens", "I miei token di accesso");m.put("My Basic Settings", "Le mie impostazioni di base");m.put("My Email Addresses", "I miei indirizzi email");@@ -2074,6 +2089,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("New State", "Nuovo stato");m.put("New User Bean", "Bean utente nuovo");m.put("New Value", "Nuovo valore");+ m.put("New chat", "Nuova chat");m.put("New issue board created", "Nuova bacheca di issue creata");m.put("New project created", "Nuovo progetto creato");m.put("New user created", "Nuovo utente creato");@@ -2539,6 +2555,9 @@ public class Translation_it extends TranslationResourceBundle {m.put("Order Subscription", "Ordina Abbonamento");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("Osv License Scanner", "Scanner di Licenze Osv");m.put("Osv Vulnerability Scanner", "Scanner di Vulnerabilità Osv");m.put("Other", "Altro");@@ -3171,6 +3190,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","Seleziona utenti a cui inviare email di avviso per eventi come il fallimento del backup automatico del database, nodo cluster non raggiungibile, ecc.");m.put("Select workspace to import from", "Seleziona workspace da cui importare.");+ m.put("Send", "Invia");m.put("Send Notifications", "Invia notifiche.");m.put("Send Pull Request", "Invia pull request.");m.put("Send notification", "Invia notifica.");@@ -3192,7 +3212,6 @@ public class Translation_it extends TranslationResourceBundle {m.put("Server is Starting...", "Il server si sta avviando...");m.put("Server url", "URL del server.");m.put("Service", "Servizio.");- m.put("Service Account", "Account di servizio.");m.put("Service Desk", "Service Desk.");m.put("Service Desk Email Address", "Indirizzo email del Service Desk.");m.put("Service Desk Issue Open Failed", "Apertura problema del Service Desk fallita.");@@ -3204,9 +3223,9 @@ public class Translation_it extends TranslationResourceBundle {m.put("Service Desk Settings", "Impostazioni del Service Desk.");m.put("Service Locator", "Service Locator.");m.put("Service Locators", "Service Locators.");- m.put("Service account not allowed to login", "Account di servizio non autorizzato ad accedere");m.put("Service desk setting", "Impostazione del service desk");m.put("Service desk settings have been saved", "Le impostazioni del service desk sono state salvate");+ m.put("Service or AI account not allowed to login", "Account di servizio o AI non consentito al login");m.put("Services", "Servizi");m.put("Session Timeout", "Timeout della sessione");m.put("Set", "Imposta");@@ -3355,6 +3374,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "Specifica la password del DN del manager sopra indicato");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("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",@@ -3737,6 +3757,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("Steps", "Passaggi");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","I passaggi verranno eseguiti in serie sullo stesso nodo, condividendo lo stesso <a href='https://docs.onedev.io/concepts#job-workspace'>workspace del job</a>");+ m.put("Stop", "Ferma");m.put("Stop work", "Ferma il lavoro");m.put("Stopwatch Overdue", "Cronometro Scaduto");m.put("Storage Settings", "Impostazioni di archiviazione");@@ -3919,10 +3940,12 @@ public class Translation_it extends TranslationResourceBundle {"L'abbonamento di questa installazione è scaduto ed è ora in esecuzione come edizione community");m.put("This is a Git LFS object, but the storage file is missing", "Questo è un oggetto Git LFS, ma il file di archiviazione è mancante");m.put("This is a built-in role and can not be deleted", "Questo è un ruolo integrato e non può essere eliminato");+ m.put("This is a disabled AI account", "Questo è un account AI disabilitato");m.put("This is a disabled service account", "Questo è un account di servizio disabilitato");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","Questo è un cache di livello. Per utilizzare il cache, aggiungi l'opzione seguente al tuo comando docker buildx");m.put("This is a service account for task automation purpose", "Questo è un account di servizio per scopi di automazione delle attività");+ m.put("This is an AI account", "Questo è un account AI");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","Questa è una funzionalità enterprise. <a href='https://onedev.io/pricing' target='_blank'>Prova gratis</a> per 30 giorni");m.put("This key has already been used by another project", "Questa chiave è già stata utilizzata da un altro progetto");@@ -4113,6 +4136,7 @@ public class Translation_it extends TranslationResourceBundle {m.put("Type password here", "Digita la password qui");m.put("Type to filter", "Digita per filtrare");m.put("Type to filter...", "Digita per filtrare...");+ m.put("Type your message here", "Digita il tuo messaggio qui");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "Impossibile Eliminare/Disabilitare Ora");m.put("Unable to apply change as otherwise you will not be able to manage this project", "Impossibile applicare la modifica poiché altrimenti non potrai gestire questo progetto");@@ -4339,10 +4363,6 @@ public class Translation_it extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","Se sempre estrarre l'immagine quando si esegue il container o si costruiscono immagini o meno. Questa opzione dovrebbe essere abilitata per evitare che le immagini vengano sostituite da lavori dannosi eseguiti sullo stesso nodo");m.put("Whether or not to be able to access time tracking info of issues", "Se essere in grado di accedere alle informazioni di tracciamento del tempo dei problemi o meno");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "Se creare come account di servizio per scopi di automazione delle attività o meno. L'account di servizio non ha password e indirizzi email, e non genererà notifiche per le sue attività");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "Se creare come account di servizio per scopi di automazione delle attività o meno. L'account di servizio non ha password e indirizzi email, e non genererà notifiche per le sue attività. <b class='text-warning'>NOTA:</b> L'account di servizio è una funzionalità aziendale. <a href='https://onedev.io/pricing' target='_blank'>Prova gratis</a> per 30 giorni");m.put("Whether or not to enable code management for the project", "Se abilitare la gestione del codice per il progetto o meno");m.put("Whether or not to enable issue management for the project", "Se abilitare la gestione dei problemi per il progetto o meno");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4661,6 +4681,7 @@ 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("Entitle to All Users", "Concedi a Tutti gli Utenti");}@Overridediff --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.javaindex 2b73e45a23..6349533edc 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@@ -126,9 +126,10 @@ public class Translation_ja extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "ユーザー招待メールの本文として使用される {0}");m.put("A {0} used as body of various issue notification emails", "さまざまな問題通知メールの本文として使用される {0}");m.put("A {0} used as body of various pull request notification emails", "さまざまなプルリクエスト通知メールの本文として使用される {0}");- m.put("AI Model Setting", "AIモデル設定");- m.put("AI Setting", "AI設定");+ m.put("AI Model Settings", "AIモデル設定");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("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");@@ -248,6 +249,8 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "'<span wicket:id=\"spentTimeAggregationLink\"></span>'から集計:");m.put("Aggregation Link", "集計リンク");m.put("Ai", "AI");+ m.put("Ai Model Setting", "AIモデル設定");+ m.put("Ai Setting", "AI設定");m.put("Alert", "アラート");m.put("Alert Setting", "アラート設定");m.put("Alert Settings", "アラート設定");@@ -561,7 +564,8 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Can not find issue board: ", "課題ボードが見つかりません:");m.put("Can not move project \"{0}\" to be under itself or its descendants", "プロジェクト\"{0}\"を自身またはその子孫の下に移動することはできません");m.put("Can not perform this operation now", "現在この操作を実行することはできません");- m.put("Can not reset password for service account or disabled user", "サービスアカウントまたは無効なユーザーのパスワードをリセットできません");+ m.put("Can not reset password for disabled account", "無効なアカウントのパスワードをリセットできません");+ m.put("Can not reset password for service or AI account", "サービスまたはAIアカウントのパスワードをリセットできません");m.put("Can not reset password for user authenticating via external system", "外部システムで認証するユーザーのパスワードをリセットできません");m.put("Can not save malformed query", "不正なクエリを保存することはできません");m.put("Can not use current or descendant project as parent", "現在のプロジェクトまたは子孫プロジェクトを親として使用することはできません");@@ -593,6 +597,9 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Changes since this comment", "このコメント以降の変更");m.put("Channel Notification", "チャンネル通知");m.put("Chart Metadata", "チャートメタデータ");+ m.put("Chat deleted", "チャットが削除されました");+ m.put("Chat with", "とのチャット");+ m.put("Chat with AI", "AIとのチャット");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",@@ -946,6 +953,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Delete Selected Users", "選択したユーザーを削除");m.put("Delete Source Branch", "ソースブランチを削除");m.put("Delete Source Branch After Merge", "マージ後にソースブランチを削除");+ m.put("Delete chat", "チャットを削除");m.put("Delete dashboard", "ダッシュボードを削除");m.put("Delete from branch {0}", "ブランチ {0} から削除");m.put("Delete this", "これを削除");@@ -1191,6 +1199,11 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Enter description here", "ここに説明を入力してください");m.put("Enter your details to login to your account", "アカウントにログインするための詳細を入力してください");m.put("Enter your user name or email to reset password", "パスワードをリセットするには、ユーザー名またはメールを入力してください");+ m.put("Entitled Groups", "権限を持つグループ");+ m.put("Entitled Projects", "権限を持つプロジェクト");+ m.put("Entitled Users", "権限を持つユーザー");+ m.put("Entitlement", "権限");+ m.put("Entitlement Edit Bean", "権限編集ビーン");m.put("Entries", "エントリ");m.put("Entry", "エントリ");m.put("Enumeration", "列挙");@@ -1997,6 +2010,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Minimum length of the password", "パスワードの最小長");m.put("Missing Commit", "不足しているコミット");m.put("Missing Commits", "不足しているコミット");+ m.put("Model", "モデル");m.put("Month", "月");m.put("Months", "月");m.put("Months to Display", "表示する月数");@@ -2018,6 +2032,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Multiple Lines", "複数行");m.put("Multiple On the Other Side", "反対側に複数");m.put("Must not be empty", "空であってはなりません");+ m.put("My AI Settings", "私のAI設定");m.put("My Access Tokens", "私のアクセストークン");m.put("My Basic Settings", "私の基本設定");m.put("My Email Addresses", "私のメールアドレス");@@ -2074,6 +2089,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("New State", "新しい状態");m.put("New User Bean", "新しいユーザーBean");m.put("New Value", "新しい値");+ m.put("New chat", "新しいチャット");m.put("New issue board created", "新しい課題ボードが作成されました");m.put("New project created", "新しいプロジェクトが作成されました");m.put("New user created", "新しいユーザーが作成されました");@@ -2539,6 +2555,9 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Order Subscription", "サブスクリプションを注文");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("Osv License Scanner", "Osvライセンススキャナー");m.put("Osv Vulnerability Scanner", "Osv脆弱性スキャナー");m.put("Other", "その他");@@ -3171,6 +3190,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","データベースの自動バックアップ失敗やクラスターノードの到達不能などのイベント時にアラートメールを送信するユーザーを選択");m.put("Select workspace to import from", "インポート元のワークスペースを選択");+ m.put("Send", "送信");m.put("Send Notifications", "通知を送信");m.put("Send Pull Request", "プルリクエストを送信");m.put("Send notification", "通知を送信");@@ -3192,7 +3212,6 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Server is Starting...", "サーバーを起動中...");m.put("Server url", "サーバーURL");m.put("Service", "サービス");- m.put("Service Account", "サービスアカウント");m.put("Service Desk", "サービスデスク");m.put("Service Desk Email Address", "サービスデスクメールアドレス");m.put("Service Desk Issue Open Failed", "サービスデスク課題のオープンに失敗しました");@@ -3204,9 +3223,9 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Service Desk Settings", "サービスデスク設定");m.put("Service Locator", "サービスロケーター");m.put("Service Locators", "サービスロケーター");- m.put("Service account not allowed to login", "サービスアカウントはログインできません");m.put("Service desk setting", "サービスデスク設定");m.put("Service desk settings have been saved", "サービスデスク設定が保存されました");+ m.put("Service or AI account not allowed to login", "サービスまたはAIアカウントはログインできません");m.put("Services", "サービス");m.put("Session Timeout", "セッションタイムアウト");m.put("Set", "設定");@@ -3355,6 +3374,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "上記のマネージャー DN のパスワードを指定します");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("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",@@ -3737,6 +3757,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Steps", "ステップ");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","ステップは同じノード上で直列に実行され、同じ<a href='https://docs.onedev.io/concepts#job-workspace'>ジョブワークスペース</a>を共有します。");+ m.put("Stop", "停止");m.put("Stop work", "作業を停止");m.put("Stopwatch Overdue", "ストップウォッチ期限切れ");m.put("Storage Settings", "ストレージ設定");@@ -3919,10 +3940,12 @@ public class Translation_ja extends TranslationResourceBundle {"このインストールのサブスクリプションは期限切れで、現在コミュニティエディションとして実行されています");m.put("This is a Git LFS object, but the storage file is missing", "これはGit LFSオブジェクトですが、ストレージファイルがありません");m.put("This is a built-in role and can not be deleted", "これは組み込みのロールであり、削除することはできません");+ m.put("This is a disabled AI account", "これは無効なAIアカウントです");m.put("This is a disabled service account", "これは無効化されたサービスアカウントです");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","これはレイヤーキャッシュです。キャッシュを使用するには、以下のオプションをDocker buildxコマンドに追加してください");m.put("This is a service account for task automation purpose", "これはタスク自動化目的のサービスアカウントです");+ m.put("This is an AI account", "これはAIアカウントです");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","これはエンタープライズ機能です。<a href='https://onedev.io/pricing' target='_blank'>30日間無料でお試しください</a>");m.put("This key has already been used by another project", "このキーは別のプロジェクトで既に使用されています");@@ -4113,6 +4136,7 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Type password here", "ここにパスワードを入力してください");m.put("Type to filter", "フィルターするために入力してください");m.put("Type to filter...", "フィルターするために入力してください...");+ m.put("Type your message here", "ここにメッセージを入力してください");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "今すぐ削除/無効化できません");m.put("Unable to apply change as otherwise you will not be able to manage this project", "このプロジェクトを管理できなくなるため、変更を適用できません");@@ -4339,10 +4363,6 @@ public class Translation_ja extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","コンテナを実行したりイメージをビルドしたりするときに常にイメージをプルするかどうか。このオプションを有効にすると、同じノードで実行される悪意のあるジョブによってイメージが置き換えられるのを防ぐことができます");m.put("Whether or not to be able to access time tracking info of issues", "課題のタイムトラッキング情報にアクセスできるかどうか");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "タスク自動化目的のサービスアカウントとして作成するかどうか。サービスアカウントにはパスワードとメールアドレスがなく、その活動に対する通知は生成されません");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "タスク自動化目的のサービスアカウントとして作成するかどうか。サービスアカウントにはパスワードとメールアドレスがなく、その活動に対する通知は生成されません。<b class='text-warning'>注意:</b>サービスアカウントはエンタープライズ機能です。<a href='https://onedev.io/pricing' target='_blank'>30日間無料で試す</a>");m.put("Whether or not to enable code management for the project", "プロジェクトのコード管理を有効にするかどうか");m.put("Whether or not to enable issue management for the project", "プロジェクトの課題管理を有効にするかどうか");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4661,6 +4681,7 @@ 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("Entitle to All Users", "すべてのユーザーに権限を付与");}@Overridediff --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.javaindex cf3a32a441..6aefaa82b7 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@@ -126,9 +126,10 @@ public class Translation_ko extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "사용자 초대 이메일 본문으로 사용된 {0}");m.put("A {0} used as body of various issue notification emails", "다양한 문제 알림 이메일 본문으로 사용된 {0}");m.put("A {0} used as body of various pull request notification emails", "다양한 풀 리퀘스트 알림 이메일 본문으로 사용된 {0}");- m.put("AI Model Setting", "AI 모델 설정");- m.put("AI Setting", "AI 설정");+ m.put("AI Model Settings", "AI 모델 설정");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("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");@@ -248,6 +249,8 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "'<span wicket:id=\"spentTimeAggregationLink\"></span>'에서 집계됨:");m.put("Aggregation Link", "집계 링크");m.put("Ai", "AI");+ m.put("Ai Model Setting", "AI 모델 설정");+ m.put("Ai Setting", "AI 설정");m.put("Alert", "알림");m.put("Alert Setting", "알림 설정");m.put("Alert Settings", "알림 설정들");@@ -561,7 +564,8 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Can not find issue board: ", "이슈 보드를 찾을 수 없습니다:");m.put("Can not move project \"{0}\" to be under itself or its descendants", "프로젝트 \"{0}\"를 자신 또는 하위 프로젝트 아래로 이동할 수 없습니다");m.put("Can not perform this operation now", "지금 이 작업을 수행할 수 없습니다");- m.put("Can not reset password for service account or disabled user", "서비스 계정 또는 비활성화된 사용자의 비밀번호를 재설정할 수 없습니다");+ m.put("Can not reset password for disabled account", "비활성화된 계정의 비밀번호를 재설정할 수 없습니다");+ m.put("Can not reset password for service or AI account", "서비스 또는 AI 계정의 비밀번호를 재설정할 수 없습니다");m.put("Can not reset password for user authenticating via external system", "외부 시스템을 통해 인증하는 사용자의 비밀번호를 재설정할 수 없습니다");m.put("Can not save malformed query", "잘못된 쿼리를 저장할 수 없습니다");m.put("Can not use current or descendant project as parent", "현재 또는 하위 프로젝트를 부모로 사용할 수 없습니다");@@ -593,6 +597,9 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Changes since this comment", "이 댓글 이후 변경 사항");m.put("Channel Notification", "채널 알림");m.put("Chart Metadata", "차트 메타데이터");+ m.put("Chat deleted", "채팅이 삭제되었습니다");+ m.put("Chat with", "채팅 상대");+ m.put("Chat with AI", "AI와 채팅");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",@@ -946,6 +953,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Delete Selected Users", "선택한 사용자 삭제");m.put("Delete Source Branch", "소스 브랜치 삭제");m.put("Delete Source Branch After Merge", "병합 후 소스 브랜치 삭제");+ m.put("Delete chat", "채팅 삭제");m.put("Delete dashboard", "대시보드 삭제");m.put("Delete from branch {0}", "브랜치 {0}에서 삭제");m.put("Delete this", "이 항목 삭제");@@ -1191,6 +1199,11 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Enter description here", "여기에 설명을 입력하세요");m.put("Enter your details to login to your account", "계정에 로그인하려면 세부 정보를 입력하세요");m.put("Enter your user name or email to reset password", "비밀번호를 재설정하려면 사용자 이름 또는 이메일을 입력하세요");+ m.put("Entitled Groups", "권한이 부여된 그룹");+ m.put("Entitled Projects", "권한이 부여된 프로젝트");+ m.put("Entitled Users", "권한이 부여된 사용자");+ m.put("Entitlement", "권한 부여");+ m.put("Entitlement Edit Bean", "권한 편집 빈");m.put("Entries", "항목들");m.put("Entry", "항목");m.put("Enumeration", "열거형");@@ -1997,6 +2010,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Minimum length of the password", "비밀번호의 최소 길이");m.put("Missing Commit", "누락된 커밋");m.put("Missing Commits", "누락된 커밋들");+ m.put("Model", "모델");m.put("Month", "월");m.put("Months", "개월");m.put("Months to Display", "표시할 개월 수");@@ -2018,6 +2032,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Multiple Lines", "다중 라인");m.put("Multiple On the Other Side", "다른 쪽의 다중");m.put("Must not be empty", "비어 있으면 안 됨");+ m.put("My AI Settings", "내 AI 설정");m.put("My Access Tokens", "내 액세스 토큰");m.put("My Basic Settings", "내 기본 설정");m.put("My Email Addresses", "내 이메일 주소");@@ -2074,6 +2089,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("New State", "새 상태");m.put("New User Bean", "새 사용자 Bean");m.put("New Value", "새 값");+ m.put("New chat", "새 채팅");m.put("New issue board created", "새 이슈 보드 생성됨");m.put("New project created", "새 프로젝트가 생성되었습니다");m.put("New user created", "새 사용자 생성됨");@@ -2539,6 +2555,9 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Order Subscription", "구독 정렬");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("Osv License Scanner", "Osv 라이센스 스캐너");m.put("Osv Vulnerability Scanner", "Osv 취약점 스캐너");m.put("Other", "기타");@@ -3171,6 +3190,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","데이터베이스 자동 백업 실패, 클러스터 노드 연결 불가 등의 이벤트 발생 시 경고 이메일을 보낼 사용자 선택");m.put("Select workspace to import from", "가져올 작업 공간 선택");+ m.put("Send", "보내기");m.put("Send Notifications", "알림 보내기");m.put("Send Pull Request", "풀 리퀘스트 보내기");m.put("Send notification", "알림 보내기");@@ -3192,7 +3212,6 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Server is Starting...", "서버 시작 중...");m.put("Server url", "서버 URL");m.put("Service", "서비스");- m.put("Service Account", "서비스 계정");m.put("Service Desk", "서비스 데스크");m.put("Service Desk Email Address", "서비스 데스크 이메일 주소");m.put("Service Desk Issue Open Failed", "서비스 데스크 이슈 열기 실패");@@ -3204,9 +3223,9 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Service Desk Settings", "서비스 데스크 설정들");m.put("Service Locator", "서비스 로케이터");m.put("Service Locators", "서비스 로케이터들");- m.put("Service account not allowed to login", "서비스 계정은 로그인할 수 없습니다");m.put("Service desk setting", "서비스 데스크 설정");m.put("Service desk settings have been saved", "서비스 데스크 설정이 저장되었습니다");+ m.put("Service or AI account not allowed to login", "서비스 또는 AI 계정은 로그인할 수 없습니다");m.put("Services", "서비스");m.put("Session Timeout", "세션 시간 초과");m.put("Set", "설정");@@ -3355,6 +3374,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "위의 관리자 DN 비밀번호를 지정합니다");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("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",@@ -3737,6 +3757,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Steps", "단계들");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","단계는 동일한 노드에서 직렬로 실행되며 동일한 <a href='https://docs.onedev.io/concepts#job-workspace'>작업 공간</a>을 공유합니다.");+ m.put("Stop", "중지");m.put("Stop work", "작업 중지");m.put("Stopwatch Overdue", "스톱워치 초과");m.put("Storage Settings", "스토리지 설정");@@ -3919,10 +3940,12 @@ public class Translation_ko extends TranslationResourceBundle {"이 설치의 구독이 만료되어 현재 커뮤니티 에디션으로 실행 중입니다");m.put("This is a Git LFS object, but the storage file is missing", "이것은 Git LFS 객체이지만 저장 파일이 누락되었습니다");m.put("This is a built-in role and can not be deleted", "이것은 내장된 역할이며 삭제할 수 없습니다");+ m.put("This is a disabled AI account", "이것은 비활성화된 AI 계정입니다");m.put("This is a disabled service account", "이것은 비활성화된 서비스 계정입니다");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","이것은 레이어 캐시입니다. 캐시를 사용하려면 아래 옵션을 Docker buildx 명령에 추가하세요");m.put("This is a service account for task automation purpose", "이것은 작업 자동화를 위한 서비스 계정입니다");+ m.put("This is an AI account", "이것은 AI 계정입니다");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","이것은 엔터프라이즈 기능입니다. <a href='https://onedev.io/pricing' target='_blank'>30일 무료 체험</a>");m.put("This key has already been used by another project", "이 키는 이미 다른 프로젝트에서 사용되었습니다");@@ -4113,6 +4136,7 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Type password here", "여기에 비밀번호를 입력하세요");m.put("Type to filter", "필터링하려면 입력하세요");m.put("Type to filter...", "필터링하려면 입력하세요...");+ m.put("Type your message here", "여기에 메시지를 입력하세요");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "지금 삭제/비활성화할 수 없습니다");m.put("Unable to apply change as otherwise you will not be able to manage this project", "이 변경을 적용할 수 없습니다. 그렇지 않으면 이 프로젝트를 관리할 수 없게 됩니다");@@ -4339,10 +4363,6 @@ public class Translation_ko extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","컨테이너를 실행하거나 이미지를 빌드할 때 항상 이미지를 가져올지 여부. 이 옵션을 활성화하면 동일한 노드에서 실행되는 악성 작업이 이미지를 교체하는 것을 방지할 수 있습니다");m.put("Whether or not to be able to access time tracking info of issues", "문제의 시간 추적 정보를 액세스할 수 있는지 여부");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "작업 자동화 목적으로 서비스 계정으로 생성할지 여부. 서비스 계정은 비밀번호와 이메일 주소가 없으며, 활동에 대한 알림을 생성하지 않습니다");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "작업 자동화 목적으로 서비스 계정으로 생성할지 여부. 서비스 계정은 비밀번호와 이메일 주소가 없으며, 활동에 대한 알림을 생성하지 않습니다. <b class='text-warning'>참고:</b> 서비스 계정은 엔터프라이즈 기능입니다. <a href='https://onedev.io/pricing' target='_blank'>30일 무료 체험</a>");m.put("Whether or not to enable code management for the project", "프로젝트에 대한 코드 관리를 활성화할지 여부");m.put("Whether or not to enable issue management for the project", "프로젝트에 대한 문제 관리를 활성화할지 여부");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4661,6 +4681,7 @@ 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("Entitle to All Users", "모든 사용자에게 권한 부여");}@Overridediff --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.javaindex fd760b1555..e710a82a18 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@@ -126,9 +126,10 @@ public class Translation_pt extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "Um {0} usado como corpo do e-mail de convite de usuário");m.put("A {0} used as body of various issue notification emails", "Um {0} usado como corpo de vários e-mails de notificação de problema");m.put("A {0} used as body of various pull request notification emails", "Um {0} usado como corpo de vários e-mails de notificação de pull request");- m.put("AI Model Setting", "Configuração do Modelo de IA");- m.put("AI Setting", "Configuração de IA");+ m.put("AI Model Settings", "Configurações do Modelo de IA");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("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>");@@ -248,6 +249,8 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "Agregado de '<span wicket:id=\"spentTimeAggregationLink\"></span>':");m.put("Aggregation Link", "Link de Agregação");m.put("Ai", "IA");+ m.put("Ai Model Setting", "Configuração do Modelo de IA");+ m.put("Ai Setting", "Configuração de IA");m.put("Alert", "Alerta");m.put("Alert Setting", "Configuração de Alerta");m.put("Alert Settings", "Configurações de Alerta");@@ -561,7 +564,8 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Can not find issue board: ", "Não é possível encontrar o quadro de problemas:");m.put("Can not move project \"{0}\" to be under itself or its descendants", "Não é possível mover o projeto \"{0}\" para estar sob ele mesmo ou seus descendentes");m.put("Can not perform this operation now", "Não é possível realizar esta operação agora");- m.put("Can not reset password for service account or disabled user", "Não é possível redefinir a senha para conta de serviço ou usuário desativado");+ m.put("Can not reset password for disabled account", "Não é possível redefinir a senha para conta desativada");+ m.put("Can not reset password for service or AI account", "Não é possível redefinir a senha para conta de serviço ou de IA");m.put("Can not reset password for user authenticating via external system", "Não é possível redefinir a senha para usuário autenticando via sistema externo");m.put("Can not save malformed query", "Não é possível salvar consulta malformada");m.put("Can not use current or descendant project as parent", "Não é possível usar o projeto atual ou descendente como pai");@@ -593,6 +597,9 @@ 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 deleted", "Chat excluído");+ m.put("Chat with", "Conversar com");+ m.put("Chat with AI", "Conversar com IA");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",@@ -946,6 +953,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Delete Selected Users", "Excluir usuários selecionados");m.put("Delete Source Branch", "Excluir branch de origem");m.put("Delete Source Branch After Merge", "Excluir branch de origem após a mesclagem");+ m.put("Delete chat", "Excluir chat");m.put("Delete dashboard", "Excluir painel");m.put("Delete from branch {0}", "Excluir da branch {0}");m.put("Delete this", "Excluir isto");@@ -1191,6 +1199,11 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Enter description here", "Insira a descrição aqui");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("Entitled Groups", "Grupos Autorizados");+ m.put("Entitled Projects", "Projetos Autorizados");+ m.put("Entitled Users", "Usuários Autorizados");+ m.put("Entitlement", "Autorização");+ m.put("Entitlement Edit Bean", "Editar Bean de Autorização");m.put("Entries", "Entradas");m.put("Entry", "Entrada");m.put("Enumeration", "Enumeração");@@ -1997,6 +2010,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Minimum length of the password", "Comprimento mínimo da senha");m.put("Missing Commit", "Commit Ausente");m.put("Missing Commits", "Commits Ausentes");+ m.put("Model", "Modelo");m.put("Month", "Mês");m.put("Months", "Meses");m.put("Months to Display", "Meses para Exibir");@@ -2018,6 +2032,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Multiple Lines", "Linhas Múltiplas");m.put("Multiple On the Other Side", "Múltiplos do Outro Lado");m.put("Must not be empty", "Não deve estar vazio");+ m.put("My AI Settings", "Minhas Configurações de IA");m.put("My Access Tokens", "Meus Tokens de Acesso");m.put("My Basic Settings", "Minhas Configurações Básicas");m.put("My Email Addresses", "Meus Endereços de Email");@@ -2074,6 +2089,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("New State", "Novo Estado");m.put("New User Bean", "Bean de Usuário Novo");m.put("New Value", "Novo Valor");+ m.put("New chat", "Novo chat");m.put("New issue board created", "Novo quadro de issues criado");m.put("New project created", "Novo projeto criado");m.put("New user created", "Novo usuário criado");@@ -2539,6 +2555,9 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Order Subscription", "Ordenar Assinatura");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("Osv License Scanner", "Scanner de Licença Osv");m.put("Osv Vulnerability Scanner", "Scanner de Vulnerabilidade Osv");m.put("Other", "Outro");@@ -3171,6 +3190,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","Selecionar usuários para enviar e-mail de alerta em eventos como falha de backup automático do banco de dados, nó do cluster inacessível, etc.");m.put("Select workspace to import from", "Selecionar espaço de trabalho para importar");+ m.put("Send", "Enviar");m.put("Send Notifications", "Enviar notificações");m.put("Send Pull Request", "Enviar Pull Request");m.put("Send notification", "Enviar notificação");@@ -3192,7 +3212,6 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Server is Starting...", "Servidor está iniciando...");m.put("Server url", "URL do servidor");m.put("Service", "Serviço");- m.put("Service Account", "Conta de serviço");m.put("Service Desk", "Central de atendimento");m.put("Service Desk Email Address", "Endereço de e-mail da central de atendimento");m.put("Service Desk Issue Open Failed", "Falha ao abrir problema na central de atendimento");@@ -3204,9 +3223,9 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Service Desk Settings", "Configurações da central de atendimento");m.put("Service Locator", "Localizador de serviço");m.put("Service Locators", "Localizadores de serviço");- m.put("Service account not allowed to login", "Conta de serviço não permitida para login");m.put("Service desk setting", "Configuração do service desk");m.put("Service desk settings have been saved", "As configurações do service desk foram salvas");+ m.put("Service or AI account not allowed to login", "Conta de serviço ou de IA não permitida para login");m.put("Services", "Serviços");m.put("Session Timeout", "Tempo de Sessão Expirado");m.put("Set", "Definir");@@ -3355,6 +3374,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "Especifica a senha do DN do gerente acima");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("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",@@ -3737,6 +3757,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Steps", "Etapas");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","As etapas serão executadas sequencialmente no mesmo nó, compartilhando o mesmo <a href='https://docs.onedev.io/concepts#job-workspace'>workspace de trabalho</a>");+ m.put("Stop", "Parar");m.put("Stop work", "Parar trabalho");m.put("Stopwatch Overdue", "Cronômetro Atrasado");m.put("Storage Settings", "Configurações de Armazenamento");@@ -3919,10 +3940,12 @@ public class Translation_pt extends TranslationResourceBundle {"A assinatura desta instalação expirou e agora está operando como a edição comunitária");m.put("This is a Git LFS object, but the storage file is missing", "Este é um objeto Git LFS, mas o arquivo de armazenamento está ausente");m.put("This is a built-in role and can not be deleted", "Este é um papel integrado e não pode ser excluído");+ m.put("This is a disabled AI account", "Esta é uma conta de IA desativada");m.put("This is a disabled service account", "Esta é uma conta de serviço desativada");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","Este é um cache de camada. Para usar o cache, adicione a opção abaixo ao seu comando docker buildx");m.put("This is a service account for task automation purpose", "Esta é uma conta de serviço para fins de automação de tarefas");+ m.put("This is an AI account", "Esta é uma conta de IA");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","Este é um recurso enterprise. <a href='https://onedev.io/pricing' target='_blank'>Experimente grátis</a> por 30 dias");m.put("This key has already been used by another project", "Esta chave já foi usada por outro projeto");@@ -4113,6 +4136,7 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Type password here", "Digite a senha aqui");m.put("Type to filter", "Digite para filtrar");m.put("Type to filter...", "Digite para filtrar...");+ m.put("Type your message here", "Digite sua mensagem aqui");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "Incapaz de Excluir/Desativar Agora");m.put("Unable to apply change as otherwise you will not be able to manage this project", "Não foi possível aplicar a alteração, pois você não poderá gerenciar este projeto");@@ -4339,10 +4363,6 @@ public class Translation_pt extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","Se sempre puxar a imagem ao executar o container ou construir imagens ou não. Esta opção deve ser habilitada para evitar que imagens sejam substituídas por jobs maliciosos executados no mesmo nó");m.put("Whether or not to be able to access time tracking info of issues", "Se será possível acessar informações de rastreamento de tempo das issues ou não");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "Se criar como uma conta de serviço para fins de automação de tarefas ou não. Conta de serviço não tem senha e endereços de email, e não gerará notificações para suas atividades");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "Se criar como uma conta de serviço para fins de automação de tarefas ou não. Conta de serviço não tem senha e endereços de email, e não gerará notificações para suas atividades. <b class='text-warning'>NOTA:</b> Conta de serviço é um recurso empresarial. <a href='https://onedev.io/pricing' target='_blank'>Experimente grátis</a> por 30 dias");m.put("Whether or not to enable code management for the project", "Se habilitar gerenciamento de código para o projeto ou não");m.put("Whether or not to enable issue management for the project", "Se habilitar gerenciamento de issues para o projeto ou não");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4661,6 +4681,7 @@ 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("Entitle to All Users", "Conceder a Todos os Usuários");}@Overridediff --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.javaindex 2e9e94d347..c2f6c7e4fe 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@@ -145,9 +145,10 @@ public class Translation_zh extends TranslationResourceBundle {m.put("A {0} used as body of user invitation email", "用作用户邀请邮件正文的 {0}");m.put("A {0} used as body of various issue notification emails", "用作各种工单通知邮件正文的 {0}");m.put("A {0} used as body of various pull request notification emails", "用作各种合并请求通知邮件正文的 {0}");- m.put("AI Model Setting", "AI 模型设置");- m.put("AI Setting", "AI 设置");+ m.put("AI Model Settings", "AI 模型设置");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("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>");@@ -267,6 +268,8 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Aggregated from '<span wicket:id=\"spentTimeAggregationLink\"></span>':", "聚合自 '<span wicket:id=\"spentTimeAggregationLink\"></span>'");m.put("Aggregation Link", "聚合链接");m.put("Ai", "AI");+ m.put("Ai Model Setting", "AI 模型设置");+ m.put("Ai Setting", "AI 设置");m.put("Alert", "警报");m.put("Alert Setting", "警报设置");m.put("Alert Settings", "告警设置");@@ -580,7 +583,8 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Can not find issue board: ", "找不到工单看板:");m.put("Can not move project \"{0}\" to be under itself or its descendants", "不能将项目 \"{0}\" 移动到其自身或其子项目下");m.put("Can not perform this operation now", "当前无法执行此操作");- m.put("Can not reset password for service account or disabled user", "无法重置服务账户或禁用用户的密码");+ m.put("Can not reset password for disabled account", "无法为已禁用账户重置密码");+ m.put("Can not reset password for service or AI account", "无法为服务或 AI 账户重置密码");m.put("Can not reset password for user authenticating via external system", "无法重置通过外部系统认证的用户密码");m.put("Can not save malformed query", "无法保存格式错误的查询");m.put("Can not use current or descendant project as parent", "不能使用当前或子项目作为父项目");@@ -612,6 +616,9 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Changes since this comment", "此评论后的变更");m.put("Channel Notification", "频道通知");m.put("Chart Metadata", "Chart 元数据");+ m.put("Chat deleted", "聊天已删除");+ m.put("Chat with", "聊天对象");+ m.put("Chat with AI", "与 AI 聊天");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",@@ -965,6 +972,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Delete Selected Users", "删除选定的用户");m.put("Delete Source Branch", "删除源分支");m.put("Delete Source Branch After Merge", "合并后删除源分支");+ m.put("Delete chat", "删除聊天");m.put("Delete dashboard", "删除仪表板");m.put("Delete from branch {0}", "从分支 {0} 删除");m.put("Delete this", "删除");@@ -1210,6 +1218,11 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Enter description here", "输入描述");m.put("Enter your details to login to your account", "输入您的详细信息登录到您的账户");m.put("Enter your user name or email to reset password", "输入您的用户名或邮箱以重置密码");+ m.put("Entitled Groups", "授权组");+ m.put("Entitled Projects", "授权项目");+ m.put("Entitled Users", "授权用户");+ m.put("Entitlement", "权限");+ m.put("Entitlement Edit Bean", "权限编辑 Bean");m.put("Entries", "条目");m.put("Entry", "条目");m.put("Enumeration", "枚举");@@ -2016,6 +2029,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Minimum length of the password", "密码的最小长度");m.put("Missing Commit", "缺失提交");m.put("Missing Commits", "缺失提交");+ m.put("Model", "模型");m.put("Month", "月");m.put("Months", "月");m.put("Months to Display", "显示的月数");@@ -2037,6 +2051,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Multiple Lines", "多行");m.put("Multiple On the Other Side", "在另一侧允许链接多个工单");m.put("Must not be empty", "不能为空");+ m.put("My AI Settings", "我的 AI 设置");m.put("My Access Tokens", "我的访问令牌");m.put("My Basic Settings", "我的基本设置");m.put("My Email Addresses", "我的电子邮件地址");@@ -2093,6 +2108,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("New State", "新状态");m.put("New User Bean", "新用户Bean");m.put("New Value", "新值");+ m.put("New chat", "新聊天");m.put("New issue board created", "新建工单看板");m.put("New project created", "新项目已创建");m.put("New user created", "新用户创建成功");@@ -2558,6 +2574,9 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Order Subscription", "购买订阅");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("Osv License Scanner", "OSV 许可证扫描器");m.put("Osv Vulnerability Scanner", "OSV 漏洞扫描器");m.put("Other", "其他");@@ -3190,6 +3209,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Select users to send alert email upon events such as database auto-backup failure, cluster node unreachable etc","选择在数据库自动备份失败、集群节点不可达等事件时发送警报邮件的用户");m.put("Select workspace to import from", "选择要从中导入的工作区");+ m.put("Send", "发送");m.put("Send Notifications", "发送通知");m.put("Send Pull Request", "发送合并请求");m.put("Send notification", "发送通知");@@ -3211,7 +3231,6 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Server is Starting...", "服务器正在启动...");m.put("Server url", "服务器 URL");m.put("Service", "服务");- m.put("Service Account", "服务帐户");m.put("Service Desk", "服务台");m.put("Service Desk Email Address", "服务台电子邮件地址");m.put("Service Desk Issue Open Failed", "服务台工单开启失败");@@ -3223,9 +3242,9 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Service Desk Settings", "服务台设置");m.put("Service Locator", "服务定位器");m.put("Service Locators", "服务定位器");- m.put("Service account not allowed to login", "服务账户不允许登录");m.put("Service desk setting", "服务台设置");m.put("Service desk settings have been saved", "服务台设置已保存");+ m.put("Service or AI account not allowed to login", "服务或 AI 账户不允许登录");m.put("Services", "服务");m.put("Session Timeout", "会话超时");m.put("Set", "设置");@@ -3374,6 +3393,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Specifies password of above manager DN", "指定上述管理员 DN 的密码");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("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",@@ -3756,6 +3776,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Steps", "步骤");m.put("Steps will be executed serially on same node, sharing the same <a href='https://docs.onedev.io/concepts#job-workspace'>job workspace</a>","步骤将在同一节点上按顺序执行,共享同一 <a href='https://docs.onedev.io/concepts#job-workspace'>任务工作区</a>");+ m.put("Stop", "停止");m.put("Stop work", "停止工作");m.put("Stopwatch Overdue", "秒表逾期");m.put("Storage Settings", "存储设置");@@ -3938,10 +3959,12 @@ public class Translation_zh extends TranslationResourceBundle {"此安装的订阅已过期,现在以社区版运行");m.put("This is a Git LFS object, but the storage file is missing", "这是一个 Git LFS 对象,但存储文件缺失");m.put("This is a built-in role and can not be deleted", "这是一个内置角色,无法删除");+ m.put("This is a disabled AI account", "这是一个已禁用的 AI 账户");m.put("This is a disabled service account", "这是一个已禁用的服务账户");m.put("This is a layer cache. To use the cache, add below option to your docker buildx command","这是一个层缓存。要使用缓存,请将以下选项添加到您的 docker buildx 命令中");m.put("This is a service account for task automation purpose", "这是一个用于任务自动化的服务账户");+ m.put("This is an AI account", "这是一个 AI 账户");m.put("This is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days","这是一个企业功能。<a href='https://onedev.io/pricing' target='_blank'>免费试用</a>30天");m.put("This key has already been used by another project", "此键已被其他项目使用");@@ -3958,6 +3981,8 @@ public class Translation_zh extends TranslationResourceBundle {"这可能发生在项目指向错误的 git 仓库,或者这些提交被垃圾回收。");m.put("This might happen when project points to a wrong git repository, or these commits are garbage collected.","这可能发生在项目指向错误的 git 仓库,或者这些提交被垃圾回收。");+ m.put("This model will be used to perform lite tasks including: <ul class=\"mb-0\"> <li>Natural language support for various queries</li> <li>Mark the most likely symbol definition in symbol navigation</li> <li>Suggest pull request title and description if multiple commits are involved</li> </ul> Fast and cost-effective models are recommended, such as <code>Google/gemini-2.5-flash</code> and <code>OpenAI/gpt-4.1-mini</code>",+ "此模型将用于执行轻量级任务,包括:<ul class=\"mb-0\"> <li>支持各种查询的自然语言</li> <li>在符号导航中标记最可能的符号定义</li> <li>如果涉及多个提交,建议合并请求标题和描述</li> </ul> 推荐使用快速且具成本效益的模型,例如 <code>Google/gemini-2.5-flash</code> 和 <code>OpenAI/gpt-4.1-mini</code>。");m.put("This name has already been used by another board", "此名称已被另一个看板使用");m.put("This name has already been used by another group", "此名称已被另一个组使用");m.put("This name has already been used by another issue board in the project", "此名称已被项目中的另一个工单看板使用");@@ -4130,6 +4155,7 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Type password here", "在此输入密码");m.put("Type to filter", "过滤");m.put("Type to filter...", "输入以筛选...");+ m.put("Type your message here", "在此输入您的消息");m.put("URL", "URL");m.put("Unable To Delete/Disable Right Now", "目前无法删除/禁用");m.put("Unable to apply change as otherwise you will not be able to manage this project", "无法应用更改,否则您将无法管理此项目");@@ -4356,10 +4382,6 @@ public class Translation_zh extends TranslationResourceBundle {m.put("Whether or not to always pull image when run container or build images. This option should be enabled to avoid images being replaced by malicious jobs running on same node","是否在运行容器或构建镜像时始终拉取镜像。应启用此选项,以避免同一节点上运行的恶意任务替换镜像");m.put("Whether or not to be able to access time tracking info of issues", "是否能够访问工单的时间跟踪信息");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities",- "是否创建为任务自动化目的的服务账户。服务账户没有密码和电子邮件地址,也不会为其活动生成通知");- m.put("Whether or not to create as a service account for task automation purpose. Service account does not have password and email addresses, and will not generate notifications for its activities. <b class='text-warning'>NOTE:</b> Service account is an enterprise feature. <a href='https://onedev.io/pricing' target='_blank'>Try free</a> for 30 days",- "是否创建为任务自动化目的的服务账户。服务账户没有密码和电子邮件地址,也不会为其活动生成通知。<b class='text-warning'>注意:</b>服务账户是企业版功能。<a href='https://onedev.io/pricing' target='_blank'>免费试用</a> 30 天");m.put("Whether or not to enable code management for the project", "是否为项目启用代码管理");m.put("Whether or not to enable issue management for the project", "是否为项目启用工单管理");m.put("Whether or not to fetch LFS objects if pull request is opened from a different project.",@@ -4678,8 +4700,7 @@ 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("This model will be used to perform lite tasks including: <ul class=\"mb-0\"> <li>Natural language support for various queries</li> <li>Mark the most likely symbol definition in symbol navigation</li> <li>Suggest pull request title and description if multiple commits are involved</li> </ul> Fast and cost-effective models are recommended, such as <code>Google/gemini-2.5-flash</code> and <code>OpenAI/gpt-4.1-mini</code>",- "此模型将用于执行轻量级任务,包括:<ul class=\"mb-0\"> <li>支持各种查询的自然语言</li> <li>在符号导航中标记最可能的符号定义</li> <li>如果涉及多个提交,建议合并请求标题和描述</li> </ul> 推荐使用快速且具成本效益的模型,例如 <code>Google/gemini-2.5-flash</code> 和 <code>OpenAI/gpt-4.1-mini</code>。");+ m.put("Entitle to All Users", "授权给所有用户");}@Overridediff --git a/server-core/src/main/java/io/onedev/server/web/util/editbean/NewUserBean.java b/server-core/src/main/java/io/onedev/server/web/util/editbean/NewUserBean.javaindex db04f7184e..2189a3bc86 100644--- a/server-core/src/main/java/io/onedev/server/web/util/editbean/NewUserBean.java+++ b/server-core/src/main/java/io/onedev/server/web/util/editbean/NewUserBean.java@@ -2,10 +2,12 @@ package io.onedev.server.web.util.editbean;import javax.validation.constraints.Email;import javax.validation.constraints.NotEmpty;+import javax.validation.constraints.NotNull;import io.onedev.server.annotation.DependsOn;import io.onedev.server.annotation.Editable;import io.onedev.server.model.User;+import io.onedev.server.model.support.AiModelSetting;@Editablepublic class NewUserBean extends User {@@ -13,11 +15,15 @@ public class NewUserBean extends User {private static final long serialVersionUID = 1L;public static final String PROP_EMAIL_ADDRESS = "emailAddress";++ public static final String PROP_AI_MODEL_SETTING = "aiModelSetting";private String emailAddress;+ private AiModelSetting aiModelSetting = new AiModelSetting();+@Editable(order=1000)- @DependsOn(property="serviceAccount", value="false")+ @DependsOn(property="type", value="ORDINARY")@NotEmptypublic String getEmailAddress() {@@ -28,4 +34,14 @@ public class NewUserBean extends User {this.emailAddress = emailAddress;}+ @Editable(order=1000, name="AI Model Settings")+ @DependsOn(property="type", value="AI")+ @NotNull+ public AiModelSetting getAiModelSetting() {+ return aiModelSetting;+ }++ public void setAiModelSetting(AiModelSetting aiModelSetting) {+ this.aiModelSetting = aiModelSetting;+ }}diff --git a/server-core/src/main/java/io/onedev/server/web/websocket/DefaultWebSocketService.java b/server-core/src/main/java/io/onedev/server/web/websocket/DefaultWebSocketService.javaindex f9acd7b663..fddfe2adc6 100644--- a/server-core/src/main/java/io/onedev/server/web/websocket/DefaultWebSocketService.java+++ b/server-core/src/main/java/io/onedev/server/web/websocket/DefaultWebSocketService.java@@ -1,19 +1,20 @@package io.onedev.server.web.websocket;-import com.google.common.collect.Sets;-import io.onedev.commons.loader.ManagedSerializedForm;-import io.onedev.commons.utils.StringUtils;-import io.onedev.server.cluster.ClusterService;-import io.onedev.server.cluster.ClusterRunnable;-import io.onedev.server.event.Listen;-import io.onedev.server.event.system.SystemStarted;-import io.onedev.server.event.system.SystemStopping;-import io.onedev.server.persistence.TransactionService;-import io.onedev.server.persistence.annotation.Sessional;-import io.onedev.server.util.Pair;-import io.onedev.server.taskschedule.SchedulableTask;-import io.onedev.server.taskschedule.TaskScheduler;-import io.onedev.server.web.page.base.BasePage;+import static io.onedev.server.web.behavior.ChangeObserver.containsObservable;+import static io.onedev.server.web.behavior.ChangeObserver.filterObservables;++import java.io.ObjectStreamException;+import java.io.Serializable;+import java.util.Collection;+import java.util.Date;+import java.util.HashSet;+import java.util.Map;+import java.util.Set;+import java.util.concurrent.ConcurrentHashMap;++import javax.inject.Inject;+import javax.inject.Singleton;+import org.apache.wicket.Application;import org.apache.wicket.protocol.ws.api.IWebSocketConnection;import org.apache.wicket.protocol.ws.api.registry.IKey;@@ -21,24 +22,31 @@ import org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry;import org.apache.wicket.protocol.ws.api.registry.PageIdKey;import org.apache.wicket.protocol.ws.api.registry.SimpleWebSocketConnectionRegistry;import org.joda.time.DateTime;+import org.jspecify.annotations.Nullable;import org.quartz.ScheduleBuilder;import org.quartz.SimpleScheduleBuilder;import org.slf4j.Logger;import org.slf4j.LoggerFactory;-import org.jspecify.annotations.Nullable;-import javax.inject.Inject;-import javax.inject.Singleton;-import java.io.ObjectStreamException;-import java.io.Serializable;-import java.util.*;-import java.util.concurrent.ConcurrentHashMap;+import com.google.common.collect.Sets;-import static io.onedev.server.web.behavior.ChangeObserver.containsObservable;-import static io.onedev.server.web.behavior.ChangeObserver.filterObservables;+import io.onedev.commons.loader.ManagedSerializedForm;+import io.onedev.commons.utils.StringUtils;+import io.onedev.server.cluster.ClusterRunnable;+import io.onedev.server.cluster.ClusterService;+import io.onedev.server.event.Listen;+import io.onedev.server.event.system.SystemStarted;+import io.onedev.server.event.system.SystemStopping;+import io.onedev.server.persistence.TransactionService;+import io.onedev.server.persistence.annotation.Sessional;+import io.onedev.server.taskschedule.SchedulableTask;+import io.onedev.server.taskschedule.TaskScheduler;+import io.onedev.server.util.Pair;+import io.onedev.server.web.SessionListener;+import io.onedev.server.web.page.base.BasePage;@Singleton-public class DefaultWebSocketService implements WebSocketService, Serializable {+public class DefaultWebSocketService implements WebSocketService, SessionListener, Serializable {private static final long serialVersionUID = 1L;@@ -93,10 +101,14 @@ public class DefaultWebSocketService implements WebSocketService, Serializable {}@Override- public void onDestroySession(String sessionId) {- registeredObservables.remove(sessionId);+ public void sessionCreated(String sessionId) {}+ @Override+ public void sessionDestroyed(String sessionId) {+ registeredObservables.remove(sessionId);+ }+@Nullableprivate Collection<String> getRegisteredObservables(IWebSocketConnection connection) {if (connection.isOpen()) {diff --git a/server-core/src/main/java/io/onedev/server/web/websocket/WebSocketService.java b/server-core/src/main/java/io/onedev/server/web/websocket/WebSocketService.javaindex dad3578985..51111cc33b 100644--- a/server-core/src/main/java/io/onedev/server/web/websocket/WebSocketService.java+++ b/server-core/src/main/java/io/onedev/server/web/websocket/WebSocketService.java@@ -1,18 +1,16 @@package io.onedev.server.web.websocket;+import java.util.Collection;+import org.apache.wicket.protocol.ws.api.IWebSocketConnection;+import org.jspecify.annotations.Nullable;import io.onedev.server.web.page.base.BasePage;-import org.jspecify.annotations.Nullable;-import java.util.Collection;-public interface WebSocketService {void observe(BasePage page);-- void onDestroySession(String sessionId);-+void notifyObservablesChange(Collection<String> observables, @Nullable PageKey sourcePageKey);void notifyObservableChange(String observable, @Nullable PageKey sourcePageKey);diff --git a/server-ee b/server-eeindex 6e38ee0e81..d15eff1e74 160000--- a/server-ee+++ b/server-ee@@ -1 +1 @@-Subproject commit 6e38ee0e81adb8f252982ae2cb07cf7ef7fa19ec+Subproject commit d15eff1e740580b21b74f3d0b19524b3a66b415cdiff --git a/server-product/src/main/java/io/onedev/server/product/ProductServletConfigurator.java b/server-product/src/main/java/io/onedev/server/product/ProductServletConfigurator.javaindex ec1885f7e0..4fc1e1dcdf 100644--- a/server-product/src/main/java/io/onedev/server/product/ProductServletConfigurator.java+++ b/server-product/src/main/java/io/onedev/server/product/ProductServletConfigurator.java@@ -2,6 +2,7 @@ package io.onedev.server.product;import java.io.File;import java.util.EnumSet;+import java.util.Set;import javax.inject.Inject;import javax.servlet.DispatcherType;@@ -30,53 +31,45 @@ import io.onedev.server.jetty.FileAssetServlet;import io.onedev.server.jetty.ServletConfigurator;import io.onedev.server.security.CorsFilter;import io.onedev.server.security.DefaultWebEnvironment;+import io.onedev.server.web.SessionListener;import io.onedev.server.web.asset.icon.IconScope;import io.onedev.server.web.img.ImageScope;-import io.onedev.server.web.websocket.WebSocketService;public class ProductServletConfigurator implements ServletConfigurator {- private final CorsFilter corsFilter;+ @Inject+ private CorsFilter corsFilter;- private final ShiroFilter shiroFilter;+ @Inject+ private ShiroFilter shiroFilter;- private final GitFilter gitFilter;+ @Inject+ private GitFilter gitFilter;- private final GoGetFilter goGetFilter;+ @Inject+ private GoGetFilter goGetFilter;- private final GitLfsFilter gitLfsFilter;+ @Inject+ private GitLfsFilter gitLfsFilter;- private final GitPreReceiveCallback preReceiveServlet;-- private final GitPostReceiveCallback postReceiveServlet;-- private final WicketServlet wicketServlet;-- private final ServletContainer jerseyServlet;-- private final WebSocketService webSocketService;-- private final ServerSocketServlet serverServlet;+ @Inject+ private GitPreReceiveCallback preReceiveServlet;@Inject- public ProductServletConfigurator(ShiroFilter shiroFilter, CorsFilter corsFilter,- GitFilter gitFilter, GitLfsFilter gitLfsFilter, GitPreReceiveCallback preReceiveServlet,- GitPostReceiveCallback postReceiveServlet, WicketServlet wicketServlet,- WebSocketService webSocketService, ServletContainer jerseyServlet,- ServerSocketServlet serverServlet, GoGetFilter goGetFilter) {- this.corsFilter = corsFilter;- this.shiroFilter = shiroFilter;- this.gitFilter = gitFilter;- this.gitLfsFilter = gitLfsFilter;- this.preReceiveServlet = preReceiveServlet;- this.postReceiveServlet = postReceiveServlet;- this.wicketServlet = wicketServlet;- this.webSocketService = webSocketService;- this.jerseyServlet = jerseyServlet;- this.serverServlet = serverServlet;- this.goGetFilter = goGetFilter;- }+ private GitPostReceiveCallback postReceiveServlet;+ @Inject+ private WicketServlet wicketServlet;++ @Inject+ private ServletContainer jerseyServlet;++ @Inject+ private ServerSocketServlet serverServlet;++ @Inject+ private Set<SessionListener> sessionListener;+@Overridepublic void configure(ServletContextHandler context) {context.setContextPath("/");@@ -107,12 +100,17 @@ public class ProductServletConfigurator implements ServletConfigurator {context.getSessionHandler().addEventListener(new HttpSessionListener() {@Override- public void sessionCreated(HttpSessionEvent se) {+ public void sessionCreated(HttpSessionEvent se) {+ for (var listener: sessionListener) {+ listener.sessionCreated(se.getSession().getId());+ }}@Overridepublic void sessionDestroyed(HttpSessionEvent se) {- webSocketService.onDestroySession(se.getSession().getId());+ for (var listener: sessionListener) {+ listener.sessionDestroyed(se.getSession().getId());+ }}});