Skip to content

Commit

Permalink
refactor: make the app an ES Module
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Aug 26, 2024
1 parent c36c702 commit b4e876f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/functions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import OpenAI from "openai";
import { ModelsAPI } from "./models-api";
import { ModelsAPI } from "./models-api.js";

// defaultModel is the model used for internal calls - for tool calling,
// or just for chat completions.
Expand Down
2 changes: 1 addition & 1 deletion src/functions/describe-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import OpenAI from "openai";
import { RunnerResponse, defaultModel, Tool } from "../functions";
import { RunnerResponse, defaultModel, Tool } from "../functions.js";

export class describeModel extends Tool {
static definition = {
Expand Down
2 changes: 1 addition & 1 deletion src/functions/execute-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import OpenAI from "openai";
import { RunnerResponse, Tool } from "../functions";
import { RunnerResponse, Tool } from "../functions.js";

type MessageWithReferences = OpenAI.ChatCompletionMessageParam & {
copilot_references: Reference[];
Expand Down
2 changes: 1 addition & 1 deletion src/functions/list-models.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import OpenAI from "openai";
import { RunnerResponse, defaultModel, Tool } from "../functions";
import { RunnerResponse, defaultModel, Tool } from "../functions.js";

export class listModels extends Tool {
static definition = {
Expand Down
2 changes: 1 addition & 1 deletion src/functions/recommend-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import OpenAI from "openai";
import { RunnerResponse, defaultModel, Tool } from "../functions";
import { RunnerResponse, defaultModel, Tool } from "../functions.js";

export class recommendModel extends Tool {
static definition = {
Expand Down
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import express from "express";
import OpenAI from "openai";
import { verifySignatureMiddleware } from "./validate-signature";
import { describeModel } from "./functions/describe-model";
import { executeModel } from "./functions/execute-model";
import { listModels } from "./functions/list-models";
import { RunnerResponse } from "./functions";
import { recommendModel } from "./functions/recommend-model";
import { ModelsAPI } from "./models-api";
import { verifySignatureMiddleware } from "./validate-signature.js";
import { describeModel } from "./functions/describe-model.js";
import { executeModel } from "./functions/execute-model.js";
import { listModels } from "./functions/list-models.js";
import { RunnerResponse } from "./functions.js";
import { recommendModel } from "./functions/recommend-model.js";
import { ModelsAPI } from "./models-api.js";
const app = express();

app.post("/", verifySignatureMiddleware, express.json(), async (req, res) => {
Expand Down
9 changes: 5 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"target": "ES2020",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": "./src",
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}
}

0 comments on commit b4e876f

Please sign in to comment.