Skip to content

Commit

Permalink
added code we are going to work on
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssatownsend committed Nov 10, 2023
1 parent 384c1a6 commit da33ed4
Show file tree
Hide file tree
Showing 101 changed files with 16,745 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "chatgpt" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
349 changes: 349 additions & 0 deletions dist/extension.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/extension.js.map

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

23 changes: 23 additions & 0 deletions documentation/.bin/bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node
const {execSync} = require ('child_process');
const runCommand = command => {
try {
execSync(`${command}`, {stdio: 'inherit'});
} catch (e) {
console.error ('Failed to execute ${command}', e);
return false;
}
return true;
}

const repoName = process.argv [2];
const gitCheckoutCommand = `git clone --depth 1 https://github.com/ApplebaumIan/tu-cis-4398-docs-template.git ${repoName} && cd ${repoName} && rm -rf .git && git init && cd ..`;
const installDepsCommand = `cd ${repoName}/documentation && yarn`;
console.log( `Cloning the repository with name ${repoName}`);
const checkedOut = runCommand (gitCheckoutCommand);
if(!checkedOut) process.exit ( -1);
console.log('Installing dependencies for ${repoName}');
const installedDeps = runCommand (installDepsCommand);
if(!installedDeps) process.exit( -1);
console.log ("Congratulations! You are ready. Follow the following commands to start");
console.log(`cd ${repoName}/documentation && PROJECT_NAME=${repoName} yarn start`)
20 changes: 20 additions & 0 deletions documentation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
../.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions documentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ PROJECT_NAME=your-project-name yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ PROJECT_NAME=your-project-name yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions documentation/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
8 changes: 8 additions & 0 deletions documentation/docs/api-specification/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "API Specification",
"position": 7,
"link": {
"type": "generated-index",
"description": "Please remove and replace examples where necessary."
}
}
61 changes: 61 additions & 0 deletions documentation/docs/api-specification/calculator-model-generated.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
sidebar_position: 3
---

# CalculatorModel.java
(generated using [Javadoc to Markdown](https://delight-im.github.io/Javadoc-to-Markdown/))

## `public class CalculatorModel`

This is the model of this MVC implementation of a calculator. It performs the functions of the calculator and keeps track of what the user has entered.

* **Author:** Tom Bylander

## `private double displayValue`

This is the numeric value of the number the user is entering, or the number that was just calculated.

## `private double internalValue`

This is the previous value entered or calculated.

## `private String displayString`

This is the String corresponding to what the user. is entering

## `private String operation`

This is the last operation entered by the user.

## `private boolean start`

This is true if the next digit entered starts a new value.

## `private boolean dot`

This is true if a decimal dot has been entered for the current value.

## `public CalculatorModel()`

Initializes the instance variables.

## `public String getValue()`

* **Returns:** the String value of what was just calculated

or what the user is entering

## `public void update(String text)`

Updates the values maintained by the calculator based on the button that the user has just clicked.

* **Parameters:** `text` — is the name of the button that the user has just clicked

## `public double operationAdd(double rhs, double lhs)`

Operation to add two numbers. <pre> operationAdd(3,2); // should equal 5.0 </pre>

* **Parameters:**
* `rhs``double` representing the right hand side of the operator
* `lhs``double` representing the left hand side of the operator
* **Returns:** `double`
41 changes: 41 additions & 0 deletions documentation/docs/api-specification/design-api-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
sidebar_position: 1
description: What should be in this section.
---

Design Document - Part II API
=============================

**Purpose**

This Design Document gives the complete design of the software implementation. This information should be in structured comments (e.g. Javadoc) in the source files. We encourage the use of a documentation generation tool to generate a draft of your API that you can augment to include the following details.

**Requirements**

In addition to the general documentation requirements the Design Document - Part II API will contain:

General review of the software architecture for each module specified in Design Document - Part I Architecture. Please include your class diagram as an important reference.

**For each class define the data fields, methods.**

The purpose of the class.

The purpose of each data field.

The purpose of each method

Pre-conditions if any.

Post-conditions if any.

Parameters and data types

Return value and output variables

Exceptions thrown\* (PLEASE see note below for details).

An example of an auto-generated and then augmented API specification is here ([Fiscal Design Document 2\_API.docx](https://templeu.instructure.com/courses/106563/files/16928898?wrap=1 "Fiscal Design Document 2_API.docx") )

This group developed their API documentation by hand ([Design Document Part 2 API-1\_MovieMatch.docx](https://templeu.instructure.com/courses/106563/files/16928899?wrap=1 "Design Document Part 2 API-1_MovieMatch.docx") )

\*At the top level, or where appropriate, all exceptions should be caught and an error message that is meaningful to the user generated. It is not OK to say ("xxxx has encountered a problem and will now close (OK?)". Error messages and recovery procedures should be documented in the User’s Manual.
10 changes: 10 additions & 0 deletions documentation/docs/api-specification/openapi-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: API 1 - Swagger Petstore
description: API Specification from openapi.yml
hide_table_of_contents: true
sidebar_position: 2
---

import ApiDocMdx from '@theme/ApiDocMdx';

<ApiDocMdx id="using-single-yaml" />
69 changes: 69 additions & 0 deletions documentation/docs/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
sidebar_position: 6
---

# System Architecture

## Extension Architecture
:::tip Microsoft's Extension Anatomy Documentation
Go check out Microsoft's [extension anatomy](https://code.visualstudio.com/api/get-started/extension-anatomy) documentation for details on the basic structure and definitions of VSCode Extension written in TypeScript.
:::

```mermaid
classDiagram
class activate ~Function~{
const vscode.WorkspaceConfiguration config = 'chatgpt'
const ChatGPTViewProvider provider = context.extensionUri
commandHandler(command:string)
}
class AuthInfo ~type~{
string? apiKey
}
class Settings ~type~{
boolean? selectedInsideCodeblock
boolean? codeblockWithLanguageId
boolean? pasteOnClick
boolean? keepConversation
number? timeoutLength
string? model
string? apiUrl
}
class `src/extension.ts` {
const BASE_URL = 'https://api.openai.com/v1'
activate(context: vscode.ExtensionContext)
deactivate()
}
class vscode
class chatgpt
`src/extension.ts` --> activate
class ChatGPTViewProvider {
+ChatGPTViewProviderViewType viewType$
- vscode.WebviewView? _view
- ChatGPTAPI? _chatGPTAPI
- any? _conversation
- string? _response
- string? _prompt
- string? _fullPrompt
-_currentMessageNumber = 0
- Settings _settings
- AuthInfo _authInfo
constructor(private readonly _extensionUri: vscode.Uri)
+setAuthenticationInfo(authInfo: AuthInfo)
+setSettings(settings: Settings)
+getSettings()
-_newAPI()
-resolveWebviewView(webviewView: vscode.WebviewView, context: vscode.WebviewViewResolveContext, _token: vscode.CancellationToken)
+ async resetConversation() Promise<void>
+ async search(prompt?:string) Promise<void>
- _getHtmlForWebview(webview: vscode.Webview) string
}
ChatGPTViewProvider --|> `vscode.WebviewViewProvider`
ChatGPTViewProvider ..> chatgpt
ChatGPTViewProvider --> Settings
ChatGPTViewProvider --> AuthInfo
`vscode.WebviewViewProvider` --> vscode
activate ..> ChatGPTViewProvider
```
**Figure 1. VSCode Extension UML class diagram**
Representing the current structure of the VSCode extension is a bit messy and difficult. However, it is worth it to highlight that extension.ts `activate()` registers the view provider `ChatGPTViewProvider`. The provider makes all of the calls to the ChatGPT library from the `search()` function which also updates the `webview`.
8 changes: 8 additions & 0 deletions documentation/docs/development-plan/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Software Development Plan",
"position": 5,
"link": {
"type": "generated-index",
"description": "Document Overview goes here."
}
}
5 changes: 5 additions & 0 deletions documentation/docs/development-plan/activities.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 1
---

# Activities
Loading

0 comments on commit da33ed4

Please sign in to comment.