Skip to content

Commit 01946ab

Browse files
Merge remote-tracking branch 'origin/endgame-202401' into develop.next
2 parents 65f066e + 6e50fcc commit 01946ab

File tree

36 files changed

+86
-51
lines changed

36 files changed

+86
-51
lines changed

PluginsAndFeatures/AddLibrary/AzureLibraries/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>com.microsoft.azuretools</groupId>
2929
<artifactId>utils</artifactId>
30-
<version>3.85.0-SNAPSHOT</version>
30+
<version>3.85.0</version>
3131
</parent>
3232
<groupId>com.microsoft.azuretools</groupId>
3333
<artifactId>com.microsoft.azuretools.sdk.lib</artifactId>
@@ -39,9 +39,9 @@
3939
</organization>
4040

4141
<properties>
42-
<azuretool.version>3.85.0-SNAPSHOT</azuretool.version>
42+
<azuretool.version>3.85.0</azuretool.version>
4343
<azuretool.sdk.version>3.32.0.qualifier</azuretool.sdk.version>
44-
<azure.toolkit-lib.version>0.41.0-SNAPSHOT</azure.toolkit-lib.version>
44+
<azure.toolkit-lib.version>0.41.0</azure.toolkit-lib.version>
4545
</properties>
4646
<dependencyManagement>
4747
<dependencies>

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.appservice/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ Export-Package: com.microsoft.azuretools.appservice,
4343
com.microsoft.azuretools.appservice.handlers,
4444
com.microsoft.azuretools.appservice.ui
4545
Bundle-ClassPath: .,
46-
target/lib/azure-toolkit-ide-appservice-lib-0.41.0-SNAPSHOT.jar
46+
target/lib/azure-toolkit-ide-appservice-lib-0.41.0.jar

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.appservice/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<dependency>
1414
<groupId>com.microsoft.azure</groupId>
1515
<artifactId>azure-toolkit-ide-appservice-lib</artifactId>
16-
<version>0.41.0-SNAPSHOT</version>
16+
<version>0.41.0</version>
1717
</dependency>
1818
</dependencies>
1919
<repositories>

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.springcloud/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Require-Bundle: org.eclipse.ui,
2323
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
2424
Bundle-ActivationPolicy: lazy
2525
Bundle-ClassPath: .,
26-
target/lib/azure-toolkit-ide-springcloud-lib-0.41.0-SNAPSHOT.jar
26+
target/lib/azure-toolkit-ide-springcloud-lib-0.41.0.jar
2727
Import-Package: com.microsoft.azuretools.core.actions,
2828
org.eclipse.core.expressions,
2929
org.eclipse.jface.text.hyperlink,

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.springcloud/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<dependency>
1414
<groupId>com.microsoft.azure</groupId>
1515
<artifactId>azure-toolkit-ide-springcloud-lib</artifactId>
16-
<version>0.41.0-SNAPSHOT</version>
16+
<version>0.41.0</version>
1717
</dependency>
1818
</dependencies>
1919
<build>

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-base/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ allprojects {
4242
}
4343

4444
ext {
45-
azureToolkitLibsVersion = "0.41.0-SNAPSHOT"
46-
azureToolkitIdeLibsVersion = "0.41.0-SNAPSHOT"
45+
azureToolkitLibsVersion = "0.41.0"
46+
azureToolkitIdeLibsVersion = "0.41.0"
4747
}
4848

4949
dependencyManagement {

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-base/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pluginVersion=3.85.0-SNAPSHOT
1+
pluginVersion=3.85.0
22
intellijDisplayVersion=2023.3
33
intellij_version=IU-2023.3.2
44
dep_plugins=org.intellij.scala:2023.3.3

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-base/src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xmlns:xi="http://www.w3.org/2001/XInclude">
33
<id>com.microsoft.tooling.msservices.intellij.azure</id>
44
<name>Azure Toolkit</name>
5-
<version>3.85.0-SNAPSHOT</version>
5+
<version>3.85.0</version>
66
<vendor email="[email protected]" url="http://www.microsoft.com">Microsoft</vendor>
77

88
<description>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*/
5+
6+
package com.azure.ai.openai.models;
7+
8+
import lombok.Getter;
9+
import lombok.RequiredArgsConstructor;
10+
import lombok.extern.slf4j.Slf4j;
11+
12+
import javax.annotation.Nullable;
13+
14+
@Getter
15+
@RequiredArgsConstructor
16+
@Slf4j
17+
public class ChatMessage {
18+
private final ChatRole role;
19+
private final String content;
20+
21+
public static ChatMessage fromResponse(ChatResponseMessage response) {
22+
return new ChatMessage(response.getRole(), response.getContent());
23+
}
24+
25+
@Nullable
26+
public ChatRequestMessage toRequest() {
27+
if (this.role == ChatRole.SYSTEM) return new ChatRequestSystemMessage(this.content);
28+
if (this.role == ChatRole.USER) return new ChatRequestUserMessage(this.content);
29+
if (this.role == ChatRole.ASSISTANT) return new ChatRequestAssistantMessage(this.content);
30+
log.warn("Unknown role: {}", this.role);
31+
return null;
32+
}
33+
}

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-cognitiveservices/src/main/java/com/microsoft/azure/toolkit/intellij/cognitiveservices/chatbox/ChatBot.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
import com.azure.ai.openai.OpenAIClient;
44
import com.azure.ai.openai.OpenAIClientBuilder;
5-
import com.azure.ai.openai.models.ChatChoice;
6-
import com.azure.ai.openai.models.ChatCompletions;
7-
import com.azure.ai.openai.models.ChatCompletionsOptions;
8-
import com.azure.ai.openai.models.ChatMessage;
9-
import com.azure.ai.openai.models.ChatRole;
5+
import com.azure.ai.openai.models.*;
106
import com.azure.core.credential.AzureKeyCredential;
117
import com.microsoft.azure.toolkit.intellij.cognitiveservices.model.Configuration;
128
import com.microsoft.azure.toolkit.intellij.cognitiveservices.model.SystemMessage;
@@ -18,6 +14,7 @@
1814
import java.util.Objects;
1915
import java.util.Optional;
2016
import java.util.Stack;
17+
import java.util.stream.Collectors;
2118

2219
public class ChatBot {
2320
@Getter
@@ -71,12 +68,12 @@ public ChatChoice send(String message) {
7168
final String deploymentName = this.deployment.getName();
7269
final ChatCompletions chatCompletions = this.client.getChatCompletions(deploymentName, buildChatOptions());
7370
final ChatChoice chatChoice = chatCompletions.getChoices().get(0);
74-
this.chatMessages.push(chatChoice.getMessage());
71+
this.chatMessages.push(ChatMessage.fromResponse(chatChoice.getMessage()));
7572
return chatChoice;
7673
}
7774

7875
private ChatCompletionsOptions buildChatOptions() {
79-
final ChatCompletionsOptions result = new ChatCompletionsOptions(this.chatMessages);
76+
final ChatCompletionsOptions result = new ChatCompletionsOptions(this.chatMessages.stream().map(ChatMessage::toRequest).filter(Objects::nonNull).collect(Collectors.toList()));
8077
Optional.ofNullable(configuration).ifPresent(c -> {
8178
result.setFrequencyPenalty(c.getFrequencyPenalty());
8279
result.setPresencePenalty(c.getPresencePenalty());

0 commit comments

Comments
 (0)