Skip to content

Commit

Permalink
Merge pull request #201 from blenderskool/fix-models-type-issues
Browse files Browse the repository at this point in the history
Fix incorrect type issues in conversation models methods
  • Loading branch information
jasonbosco authored Apr 24, 2024
2 parents 678a55e + 491b3b1 commit 36dd89f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/typesense.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/typesense.min.js.map

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions lib/Typesense/ConversationModels.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import ApiCall from "./ApiCall";
import { ConversationModelCreateSchema, ConversationModelSchema } from "./ConversationModel";
export interface ConversationModelsRetrieveSchema {
models: ConversationModelSchema[];
}
export default class ConversationModels {
private readonly apiCall;
constructor(apiCall: ApiCall);
create(params: ConversationModelCreateSchema): Promise<ConversationModelCreateSchema>;
retrieve(): Promise<ConversationModelsRetrieveSchema>;
retrieve(): Promise<ConversationModelSchema[]>;
private endpointPath;
static get RESOURCEPATH(): string;
}
2 changes: 1 addition & 1 deletion lib/Typesense/ConversationModels.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/Typesense/Conversations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class Conversations {
private readonly individualConversationModels;
constructor(apiCall: ApiCall);
retrieve(): Promise<ConversationsRetrieveSchema>;
models(id?: string): ConversationModels | ConversationModel;
models(): ConversationModels;
models(id: string): ConversationModel;
static get RESOURCEPATH(): string;
}
2 changes: 1 addition & 1 deletion lib/Typesense/Conversations.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/Typesense/ConversationModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import {
ConversationModelSchema,
} from "./ConversationModel";

export interface ConversationModelsRetrieveSchema {
models: ConversationModelSchema[];
}

const RESOURCEPATH = "/conversations/models";

export default class ConversationModels {
Expand All @@ -24,8 +20,8 @@ export default class ConversationModels {
);
}

async retrieve(): Promise<ConversationModelsRetrieveSchema> {
return this.apiCall.get<ConversationModelsRetrieveSchema>(
async retrieve(): Promise<ConversationModelSchema[]> {
return this.apiCall.get<ConversationModelSchema[]>(
this.endpointPath(),
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Typesense/Conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export default class Conversations {
return this.apiCall.get<ConversationsRetrieveSchema>(RESOURCEPATH);
}

models(): ConversationModels;
models(id: string): ConversationModel;
models(id?: string): ConversationModels | ConversationModel {
if (id === undefined) {
return this._conversationsModels;
Expand Down

0 comments on commit 36dd89f

Please sign in to comment.