Skip to content

Commit 100f92b

Browse files
committed
add parameters for conversation
Signed-off-by: trangevi <trangevi@microsoft.com>
1 parent ba3a9ca commit 100f92b

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

cli/azd/extensions/azure.ai.agents/internal/cmd/helpers.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,13 @@ func resolveSessionID(ctx context.Context, azdClient *azdext.AzdClient, agentNam
108108
return sid, nil
109109
}
110110

111-
// resolveConversationID resolves or creates a Foundry conversation ID.
112-
// Returns empty string if no existing conversation is found or on error.
113-
func resolveConversationID(ctx context.Context, azdClient *azdext.AzdClient, agentName string, forceNew bool) (string, error) {
111+
// resolveConversationID resolves a Foundry conversation ID.
112+
// When explicit is provided, it is returned directly.
113+
// Returns empty string if no existing conversation is found.
114+
func resolveConversationID(ctx context.Context, azdClient *azdext.AzdClient, agentName string, explicit string, forceNew bool) (string, error) {
115+
if explicit != "" {
116+
return explicit, nil
117+
}
114118
configPath, err := resolveConfigPath(ctx, azdClient)
115119
if err != nil {
116120
return "", err

cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ import (
2020
)
2121

2222
type invokeFlags struct {
23-
message string
24-
local bool
25-
name string
26-
port int
27-
timeout int
28-
session string
29-
newSession bool
23+
message string
24+
local bool
25+
name string
26+
port int
27+
timeout int
28+
session string
29+
newSession bool
30+
conversation string
31+
newConversation bool
3032
}
3133

3234
type InvokeAction struct {
@@ -88,6 +90,8 @@ session automatically. Pass --new-session to force a reset.`,
8890
cmd.Flags().IntVarP(&flags.timeout, "timeout", "t", 120, "Request timeout in seconds (0 for no timeout)")
8991
cmd.Flags().StringVarP(&flags.session, "session", "s", "", "Explicit session ID override")
9092
cmd.Flags().BoolVar(&flags.newSession, "new-session", false, "Force a new session (discard saved one)")
93+
cmd.Flags().StringVar(&flags.conversation, "conversation", "", "Explicit conversation ID override")
94+
cmd.Flags().BoolVar(&flags.newConversation, "new-conversation", false, "Force a new conversation (discard saved one)")
9195

9296
return cmd
9397
}
@@ -219,7 +223,7 @@ func (a *InvokeAction) invokeRemote(ctx context.Context) error {
219223
}
220224

221225
// Conversation ID — enables multi-turn memory via Foundry Conversations API
222-
convID, err := resolveConversationID(ctx, azdClient, name, a.flags.newSession)
226+
convID, err := resolveConversationID(ctx, azdClient, name, a.flags.conversation, a.flags.newConversation)
223227
if err != nil {
224228
return err
225229
}

0 commit comments

Comments
 (0)