Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
petemill committed Dec 10, 2024
1 parent 7f157d8 commit 35edabb
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
6 changes: 3 additions & 3 deletions browser/ai_chat/ai_chat_throttle_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ INSTANTIATE_TEST_SUITE_P(
TEST_P(AiChatThrottleUnitTest, CancelNavigationFromTab) {
content::MockNavigationHandle test_handle(web_contents());

test_handle.set_url(GURL(kAIChatUIURL)());
test_handle.set_url(GURL(kAIChatUIURL));

#if BUILDFLAG(IS_ANDROID)
ui::PageTransition transition = ui::PageTransitionFromInt(
Expand Down Expand Up @@ -105,7 +105,7 @@ TEST_P(AiChatThrottleUnitTest, CancelNavigationFromTab) {
TEST_P(AiChatThrottleUnitTest, CancelNavigationToFrame) {
content::MockNavigationHandle test_handle(web_contents());

test_handle.set_url(GURL(kAIChatUntrustedConversationUIURL)());
test_handle.set_url(GURL(kAIChatUntrustedConversationUIURL));

#if BUILDFLAG(IS_ANDROID)
ui::PageTransition transition = ui::PageTransitionFromInt(
Expand All @@ -128,7 +128,7 @@ TEST_P(AiChatThrottleUnitTest, CancelNavigationToFrame) {
TEST_P(AiChatThrottleUnitTest, AllowNavigationFromPanel) {
content::MockNavigationHandle test_handle(web_contents());

test_handle.set_url(GURL(kAIChatUIURL)());
test_handle.set_url(GURL(kAIChatUIURL));

#if BUILDFLAG(IS_ANDROID)
ui::PageTransition transition =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ AIChatUntrustedConversationUI::AIChatUntrustedConversationUI(
"img-src 'self' blob: chrome-untrusted://resources;");
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::FontSrc,
"font-src 'self' data: chrome-untrusted://resources;");
"font-src 'self' chrome-untrusted://resources;");
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::FrameAncestors,
base::StringPrintf("frame-ancestors %s;", kAIChatUIURL));
Expand Down
4 changes: 2 additions & 2 deletions ios/brave-ios/Sources/AIChat/Components/AIChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public struct AIChatView: View {
icon: Image(braveSystemName: "leo.thumb.up"),
onSelected: {
Task { @MainActor in
let ratingId = await model.rateConversation(isLiked: true, turnId: UInt(turnIndex))
let ratingId = await model.rateConversation(isLiked: true, turnId: turn.uuid)
if ratingId != nil {
feedbackToast = .success(isLiked: true)
} else {
Expand All @@ -522,7 +522,7 @@ public struct AIChatView: View {
icon: Image(braveSystemName: "leo.thumb.down"),
onSelected: {
Task { @MainActor in
let ratingId = await model.rateConversation(isLiked: false, turnId: UInt(turnIndex))
let ratingId = await model.rateConversation(isLiked: false, turnId: turn.uuid)
if let ratingId = ratingId {
feedbackToast = .success(
isLiked: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public class AIChatViewModel: NSObject, ObservableObject {
}

@MainActor
func rateConversation(isLiked: Bool, turnId: UInt) async -> String? {
func rateConversation(isLiked: Bool, turnId: String) async -> String? {
return await api.rateMessage(isLiked, turnId: turnId)
}

Expand Down
13 changes: 9 additions & 4 deletions ios/browser/api/ai_chat/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,23 @@ source_set("ai_chat") {

ios_objc_mojom_wrappers("ai_chat_mojom_wrappers") {
mojom_target = "//brave/components/ai_chat/core/common/mojom"
sources = [ "//brave/components/ai_chat/core/common/mojom/ai_chat.mojom" ]
sources = [
"//brave/components/ai_chat/core/common/mojom/ai_chat.mojom",
"//brave/components/ai_chat/core/common/mojom/untrusted_frame.mojom",
]
output_dir = "$root_gen_dir/brave/components/ai_chat/core/common/mojom/ios"

generate_namespace = false
# These types have pending_receiver arguments which aren't
# supported in objc_mojom_wrappers, but should be refactored to support
# binding to them for iOS.
exclude_types = [
"AIChatUIHandler",
"ChatUI",
"ConversationEntriesState",
"ParentUIFrame",
"Service",
"UntrustedConversationHandler",
"UntrustedConversationUI",
"ConversationEntriesState",
"ChatUI",
"UntrustedUIHandler",
]
}
2 changes: 1 addition & 1 deletion ios/browser/api/ai_chat/ai_chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ OBJC_EXPORT
actionType:(AiChatActionType)actionType;

- (void)rateMessage:(bool)isLiked
turnId:(NSUInteger)turnId
turnId:(NSString*)turnId
completion:
(void (^_Nullable)(NSString* _Nullable identifier))completion;

Expand Down
4 changes: 2 additions & 2 deletions ios/browser/api/ai_chat/ai_chat.mm
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ - (void)submitSelectedText:(NSString*)selectedText
}

- (void)rateMessage:(bool)isLiked
turnId:(NSUInteger)turnId
turnId:(NSString*)turnId
completion:(void (^)(NSString* identifier))completion {
current_conversation_->RateMessage(
isLiked, turnId,
isLiked, base::SysNSStringToUTF8(turnId),
base::BindOnce(
[](void (^completion)(NSString*),
const std::optional<std::string>& identifier) {
Expand Down

0 comments on commit 35edabb

Please sign in to comment.