Skip to content

Commit c6ecaa0

Browse files
committed
WIP
1 parent 0ecd3f8 commit c6ecaa0

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

Core/Sources/ChatTab/ChatTab.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,18 @@ open class BaseChatTab: Equatable {
6262

6363
@ViewBuilder
6464
public var body: some View {
65+
let id = "BaseChatTab\(info.id)"
6566
if let tab = self as? ChatTabType {
66-
ContentView(info: info, buildView: tab.buildView).id(info.id)
67+
ContentView(info: info, buildView: tab.buildView).id(id)
6768
} else {
68-
EmptyView().id(info.id)
69+
EmptyView().id(id)
6970
}
7071
}
72+
73+
@ViewBuilder
74+
public var menu: some View {
75+
EmptyView()
76+
}
7177

7278
public static func == (lhs: BaseChatTab, rhs: BaseChatTab) -> Bool {
7379
lhs.id == rhs.id

Tool/Sources/LangChain/Chain.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public extension Chain {
1313
return parseOutput(output)
1414
}
1515

16-
func call(_ input: Input, callbackManagers: [ChainCallbackManager]) async throws -> Output {
16+
func call(_ input: Input, callbackManagers: [ChainCallbackManager] = []) async throws -> Output {
1717
for callbackManager in callbackManagers {
1818
callbackManager.onChainStart(type: Self.self, input: input)
1919
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Foundation
2+
3+
final class RetrievalQA: Chain {
4+
let vectorStore: VectorStore
5+
let embedding: Embeddings
6+
7+
struct Output {
8+
var answer: String
9+
var sourceDocuments: [Document]
10+
}
11+
12+
init(vectorStore: VectorStore, embedding: Embeddings) {
13+
self.vectorStore = vectorStore
14+
self.embedding = embedding
15+
}
16+
17+
func callLogic(
18+
_ input: String,
19+
callbackManagers: [ChainCallbackManager]
20+
) async throws -> Output {
21+
let embeddedQuestion = try awa
22+
23+
return .init(answer: "", sourceDocuments: [])
24+
}
25+
26+
func parseOutput(_ output: Output) -> String {
27+
return output.answer
28+
}
29+
}
30+

0 commit comments

Comments
 (0)