Skip to content

Commit 60922e8

Browse files
committed
refactor: merge staging
1 parent 4f8312c commit 60922e8

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

internal/api/chat/create_conversation_message_stream_v2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func (s *ChatServerV2) CreateConversationMessageStream(
347347
}
348348
}
349349

350-
openaiChatHistory, inappChatHistory, _, err := s.aiClientV2.ChatCompletionStreamV2(ctx, stream, conversation.UserID, conversation.ProjectID, conversation.ID.Hex(), modelSlug, conversation.OpenaiChatHistoryCompletion, llmProvider)
350+
openaiChatHistory, inappChatHistory, _, err := s.aiClientV2.ChatCompletionStreamV2(ctx, stream, conversation.UserID, conversation.ProjectID, conversation.ID.Hex(), modelSlug, conversation.OpenaiChatHistoryCompletion, llmProvider, customModel)
351351
if err != nil {
352352
return s.sendStreamError(stream, err)
353353
}
@@ -373,7 +373,7 @@ func (s *ChatServerV2) CreateConversationMessageStream(
373373
for i, bsonMsg := range conversation.InappChatHistory {
374374
protoMessages[i] = mapper.BSONToChatMessageV2(bsonMsg)
375375
}
376-
title, err := s.aiClientV2.GetConversationTitleV2(ctx, conversation.UserID, conversation.ProjectID, protoMessages, llmProvider, modelSlug)
376+
title, err := s.aiClientV2.GetConversationTitleV2(ctx, conversation.UserID, conversation.ProjectID, protoMessages, llmProvider, modelSlug, customModel)
377377
if err != nil {
378378
s.logger.Error("Failed to get conversation title", "error", err, "conversationID", conversation.ID.Hex())
379379
return

internal/services/toolkit/client/completion_v2.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ type UsageCost struct {
3434
// 2. The incremental chat history visible to the user (including tool call results and assistant responses).
3535
// 3. Cost information (in USD).
3636
// 4. An error, if any occurred during the process.
37-
func (a *AIClientV2) ChatCompletionV2(ctx context.Context, userID bson.ObjectID, projectID string, modelSlug string, messages OpenAIChatHistory, llmProvider *models.LLMProviderConfig) (OpenAIChatHistory, AppChatHistory, UsageCost, error) {
38-
openaiChatHistory, inappChatHistory, usage, err := a.ChatCompletionStreamV2(ctx, nil, userID, projectID, "", modelSlug, messages, llmProvider)
37+
func (a *AIClientV2) ChatCompletionV2(ctx context.Context, userID bson.ObjectID, projectID string, modelSlug string, messages OpenAIChatHistory, llmProvider *models.LLMProviderConfig, customModel *models.CustomModel) (OpenAIChatHistory, AppChatHistory, UsageCost, error) {
38+
openaiChatHistory, inappChatHistory, usage, err := a.ChatCompletionStreamV2(ctx, nil, userID, projectID, "", modelSlug, messages, llmProvider, customModel)
3939
if err != nil {
4040
return nil, nil, usage, err
4141
}
@@ -64,7 +64,7 @@ func (a *AIClientV2) ChatCompletionV2(ctx context.Context, userID bson.ObjectID,
6464
// - If tool calls are required, it handles them and appends the results to the chat history, then continues the loop.
6565
// - If no tool calls are needed, it appends the assistant's response and exits the loop.
6666
// - Finally, it returns the updated chat histories, accumulated cost, and any error encountered.
67-
func (a *AIClientV2) ChatCompletionStreamV2(ctx context.Context, callbackStream chatv2.ChatService_CreateConversationMessageStreamServer, userID bson.ObjectID, projectID string, conversationId string, modelSlug string, messages OpenAIChatHistory, llmProvider *models.LLMProviderConfig) (OpenAIChatHistory, AppChatHistory, UsageCost, error) {
67+
func (a *AIClientV2) ChatCompletionStreamV2(ctx context.Context, callbackStream chatv2.ChatService_CreateConversationMessageStreamServer, userID bson.ObjectID, projectID string, conversationId string, modelSlug string, messages OpenAIChatHistory, llmProvider *models.LLMProviderConfig, customModel *models.CustomModel) (OpenAIChatHistory, AppChatHistory, UsageCost, error) {
6868
openaiChatHistory := messages
6969
inappChatHistory := AppChatHistory{}
7070
usage := UsageCost{}

internal/services/toolkit/client/get_conversation_title_v2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"go.mongodb.org/mongo-driver/v2/bson"
1515
)
1616

17-
func (a *AIClientV2) GetConversationTitleV2(ctx context.Context, userID bson.ObjectID, projectID string, inappChatHistory []*chatv2.Message, llmProvider *models.LLMProviderConfig, modelSlug string) (string, error) {
17+
func (a *AIClientV2) GetConversationTitleV2(ctx context.Context, userID bson.ObjectID, projectID string, inappChatHistory []*chatv2.Message, llmProvider *models.LLMProviderConfig, modelSlug string, customModel *models.CustomModel) (string, error) {
1818
messages := lo.Map(inappChatHistory, func(message *chatv2.Message, _ int) string {
1919
if _, ok := message.Payload.MessageType.(*chatv2.MessagePayload_Assistant); ok {
2020
return fmt.Sprintf("Assistant: %s", message.Payload.GetAssistant().GetContent())

0 commit comments

Comments
 (0)