Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
[docs] Add API Reference links
Browse files Browse the repository at this point in the history
  • Loading branch information
maxijonson committed Aug 15, 2023
1 parent e93ffe0 commit 389789f
Show file tree
Hide file tree
Showing 25 changed files with 45 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/docs/contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const Doc = defineDocumentType(() => {
type: "number",
required: false,
},
api: {
type: "string",
required: false,
},
},
computedFields: {
slug: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Doc } from ".contentlayer/generated";
import { Stack, Group, Anchor } from "@mantine/core";
import { BiLogoGithub } from "react-icons/bi";
import { BiCodeAlt, BiLogoGithub } from "react-icons/bi";
import DocHeaderItem from "../DocHeaderItem/DocHeaderItem";
import { API_BASEURL } from "../../../../../../../config/constants";

interface DocHeaderItemsProps {
doc: Doc;
}

const DocHeaderItems = ({ doc }: DocHeaderItemsProps) => {
return (
<Stack mt="md">
<Stack mt="md" gap="xs">
<DocHeaderItem label="Docs">
<Group>
<BiLogoGithub />
Expand All @@ -21,6 +22,19 @@ const DocHeaderItems = ({ doc }: DocHeaderItemsProps) => {
</Anchor>
</Group>
</DocHeaderItem>
{doc.api && (
<DocHeaderItem label="API">
<Group>
<BiCodeAlt />
<Anchor
target="_blank"
href={`${API_BASEURL}${doc.api}`}
>
Go to API Reference
</Anchor>
</Group>
</DocHeaderItem>
)}
</Stack>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Alert, Anchor } from "@mantine/core";
import { API_BASEURL } from "../../../config/constants";

interface MdxUnderConstructionProps {
path?: string;
Expand All @@ -8,7 +9,7 @@ const MdxUnderConstruction = ({ path }: MdxUnderConstructionProps) => {
if (!path) throw new Error("MdxUnderConstruction: path is required");

const cleanPath = path.startsWith("/") ? path.slice(1) : path;
const href = `https://maxijonson.github.io/gpt-turbo/${cleanPath}`;
const href = `${API_BASEURL}${cleanPath}`;

return (
<Alert color="yellow" title="Under construction" icon="🚧">
Expand Down
2 changes: 2 additions & 0 deletions packages/docs/src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export const SHELLNAVBAR_WIDTH = 280;
export const SHELLASIDE_WIDTH = 260;

export const MDX_ROOT_ID = "__mdx_root__";

export const API_BASEURL = "https://maxijonson.github.io/gpt-turbo/";
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionArray
description: Represents an array parameter for a callable function.
order: 5
api: classes/CallableFunctionArray.html
---

<UnderConstruction path="classes/CallableFunctionArray.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionBoolean
description: Represents a boolean parameter for a callable function.
order: 4
api: classes/CallableFunctionBoolean.html
---

<UnderConstruction path="classes/CallableFunctionBoolean.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionConst
description: Represents a const parameter for a callable function.
order: 9
api: classes/CallableFunctionConst.html
---

<UnderConstruction path="classes/CallableFunctionConst.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionEnum
description: Represents an enum parameter for a callable function.
order: 7
api: classes/CallableFunctionEnum.html
---

<UnderConstruction path="classes/CallableFunctionEnum.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionNull
description: Represents a null parameter for a callable function.
order: 8
api: classes/CallableFunctionNull.html
---

<UnderConstruction path="classes/CallableFunctionNull.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionNumber
description: Represents a number parameter for a callable function.
order: 3
api: classes/CallableFunctionNumber.html
---

<UnderConstruction path="classes/CallableFunctionNumber.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionObject
description: Represents an object parameter for a callable function.
order: 6
api: classes/CallableFunctionObject.html
---

<UnderConstruction path="classes/CallableFunctionObject.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionParameterFactory
description: Creates the appropriate CallableFunctionParameter based on the json schema passed in.
order: 10
api: classes/CallableFunctionParameterFactory.html
---

<UnderConstruction path="classes/CallableFunctionParameterFactory.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionParameter
description: The base class for all callable function parameters.
order: 1
api: classes/CallableFunctionParameter.html
---

<UnderConstruction path="classes/CallableFunctionParameter.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunctionString
description: Represents a string parameter for a callable function.
order: 2
api: classes/CallableFunctionString.html
---

<UnderConstruction path="classes/CallableFunctionString.html" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: CallableFunction
description: Represents a callable function for the Chat Completion API's "functions" parameter
order: 0
api: classes/CallableFunction.html
---

> Callable functions have no effect for conversations in dry mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Authoring Conversation Plugins
description: Create your own conversation plugins for project use or to publish on NPM.
order: 1
api: interfaces/ConversationPlugin.html
---

Creating plugins can help you (or others) extend the functionnality of a conversation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ChatCompletionService
description: Exposes methods to interact with the Chat Completion API.
order: 6
api: classes/ChatCompletionService.html
---

> This is an internal class. You can interact with it when authoring plugins, but you shouldn't need to instantiate it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ConversationCallableFunctions
description: Manages the callable functions available to a conversation.
order: 4
api: classes/ConversationCallableFunctions.html
---

> This is an internal class. You'll interact with it and configure it through the `Conversation` class, but you shouldn't need to instantiate it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ConversationConfig
description: Configures the Chat Completion API parameters and Conversation options
order: 1
api: classes/ConversationConfig.html
---

> This is an internal class. You'll interact with it and configure it through the `Conversation` class, but you shouldn't need to instantiate it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ConversationHistory
description: Manages the message history of a conversation.
order: 3
api: classes/ConversationHistory.html
---

> This is an internal class. You'll interact with it and configure it through the `Conversation` class, but you shouldn't need to instantiate it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ConversationPluginService
description: Exposes methods to interact with a conversation's plugins.
order: 7
api: classes/ConversationPluginService.html
---

> This is an internal class. You can interact with it when authoring plugins, but you shouldn't need to instantiate it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ConversationPlugins
description: Manages the plugins of a conversation.
order: 5
api: classes/ConversationPlugins.html
---

> This is an internal class. You'll interact with it and configure it through the `Conversation` class, but you shouldn't need to instantiate it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ConversationRequestOptions
description: Configures request options to use when sending HTTP requests to OpenAI's API.
order: 2
api: classes/ConversationRequestOptions.html
---

> This is an internal class. You'll interact with it and configure it through the `Conversation` class, but you shouldn't need to instantiate it.
Expand Down
1 change: 1 addition & 0 deletions packages/docs/src/mdx/docs/conversation/conversation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Conversation
description: GPT Turbo's main class for interacting with the Chat Completion API
order: 0
api: classes/Conversation.html
---

The `Conversation` class is the main class you'll be interacting with.
Expand Down
1 change: 1 addition & 0 deletions packages/docs/src/mdx/docs/message/message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Message
description: Represents a single message in a conversation.
order: 0
api: classes/Message.html
---

In order to have conversation continuity, every message in the conversation must be (re-)sent to the API when prompting for a new response.
Expand Down

0 comments on commit 389789f

Please sign in to comment.