-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: remove some files * chore: update package json
- Loading branch information
Showing
6 changed files
with
47 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## 1.1.0 | ||
|
||
### Added | ||
|
||
- some adjustments to the contract with the client (#001) | ||
|
||
## 1.0.0 | ||
|
||
- Released!! |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
import OpenAI from 'openai' | ||
|
||
import { Message } from '../../@types/message.js' | ||
import { callOpenAiService } from './callOpenAiService.js' | ||
|
||
export async function guessAnimeService(messages: Message[]) { | ||
return await callOpenAiService(messages) | ||
const apiKey = process.env.OPEN_AI_KEY | ||
|
||
const openai = new OpenAI({ | ||
apiKey, | ||
}) | ||
|
||
export async function guessAnimeService(incomingMessages: Message[]) { | ||
const defaultMessage: Message = { | ||
role: 'assistant', | ||
content: 'Your objective is guess an anime name based on description', | ||
} | ||
|
||
const messages = [defaultMessage, ...incomingMessages] | ||
|
||
const { choices } = await openai.chat.completions.create({ | ||
messages, | ||
model: 'gpt-4-turbo', | ||
}) | ||
|
||
const response: Message = { | ||
role: 'assistant', | ||
content: choices[0].message.content, | ||
} | ||
|
||
return [...messages, response] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters