File tree Expand file tree Collapse file tree 3 files changed +39
-3
lines changed
Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments