|
|
@ -62,6 +62,7 @@ class AgentServiceImpl: NSObject { |
|
|
private let agentId = "default_agent" |
|
|
private let agentId = "default_agent" |
|
|
//工具调用提示 |
|
|
//工具调用提示 |
|
|
public var callingTool = "" |
|
|
public var callingTool = "" |
|
|
|
|
|
private var navigationMode = "" |
|
|
|
|
|
|
|
|
private var isInitialized: Bool = false |
|
|
private var isInitialized: Bool = false |
|
|
private var isRecognizing: Bool = false |
|
|
private var isRecognizing: Bool = false |
|
|
@ -165,6 +166,10 @@ class AgentServiceImpl: NSObject { |
|
|
|
|
|
|
|
|
self.config = config |
|
|
self.config = config |
|
|
|
|
|
|
|
|
|
|
|
if let navigationMode = config["navigationMode"] as? String { |
|
|
|
|
|
self.navigationMode = navigationMode |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if let callingTool = config["callingTool"] as? String { |
|
|
if let callingTool = config["callingTool"] as? String { |
|
|
self.callingTool = callingTool |
|
|
self.callingTool = callingTool |
|
|
} |
|
|
} |
|
|
@ -215,6 +220,7 @@ class AgentServiceImpl: NSObject { |
|
|
sendError("Azure语音区域缺失", code: "CONFIG_ERROR") |
|
|
sendError("Azure语音区域缺失", code: "CONFIG_ERROR") |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//启动定位服务 |
|
|
//启动定位服务 |
|
|
NotificationCenter.default.post(name: .locationstartEvent, object: nil) |
|
|
NotificationCenter.default.post(name: .locationstartEvent, object: nil) |
|
|
// addlocationmonitor() |
|
|
// addlocationmonitor() |
|
|
@ -1020,7 +1026,7 @@ private func jsonToString(_ json: [String: Any]) -> String? { |
|
|
|
|
|
|
|
|
// 应用在前台时的原有逻辑 |
|
|
// 应用在前台时的原有逻辑 |
|
|
// 根据导航模式选择不同的导航方式 |
|
|
// 根据导航模式选择不同的导航方式 |
|
|
switch mode { |
|
|
switch self.navigationMode { |
|
|
case "internal_gaode": |
|
|
case "internal_gaode": |
|
|
// 使用内置高德导航 |
|
|
// 使用内置高德导航 |
|
|
// startInternalNavigation(start: start, destination: destination, |
|
|
// startInternalNavigation(start: start, destination: destination, |
|
|
@ -1706,7 +1712,7 @@ class ChatApiStreamCallback: StreamCallback { |
|
|
do { |
|
|
do { |
|
|
guard let agentService = try agentService else { return } |
|
|
guard let agentService = try agentService else { return } |
|
|
|
|
|
|
|
|
if sessionid == agentService.currsessionId { |
|
|
if sessionid == agentService.currsessionId { |
|
|
// 停止等待音效 |
|
|
// 停止等待音效 |
|
|
agentService.audioPlayer?.stopAwaitSound() |
|
|
agentService.audioPlayer?.stopAwaitSound() |
|
|
} |
|
|
} |
|
|
@ -1762,7 +1768,7 @@ class ChatApiStreamCallback: StreamCallback { |
|
|
}catch{ |
|
|
}catch{ |
|
|
print("liwei--------------- AI Call onFunctionCall 异常: \(error)") |
|
|
print("liwei--------------- AI Call onFunctionCall 异常: \(error)") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func onFunctionCallResult(_ sessionid:String,_ functionCall: [String: Any], _ functionCallResult: [String: Any]) { |
|
|
func onFunctionCallResult(_ sessionid:String,_ functionCall: [String: Any], _ functionCallResult: [String: Any]) { |
|
|
|