Skip to content

Commit

Permalink
fix: lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaa committed Jan 22, 2025
1 parent 8c3f590 commit 4d60993
Show file tree
Hide file tree
Showing 37 changed files with 115 additions and 115 deletions.
2 changes: 1 addition & 1 deletion cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.2"
version: '0.2'
ignorePaths: []
dictionaryDefinitions: []
dictionaries: []
Expand Down
12 changes: 6 additions & 6 deletions docs/components/ui/hover-border-gradient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export function HoverBorderGradient({
= 'radial-gradient(75% 181.15942028985506% at 50% 50%, #3275F8 0%, rgba(255, 255, 255, 0) 100%)'

useEffect(() => {
if (!hovered) {
const interval = setInterval(() => {
setDirection(prevState => rotateDirection(prevState))
}, duration * 1000)
return () => clearInterval(interval)
}
if (hovered)
return
const interval = setInterval(() => {
setDirection(prevState => rotateDirection(prevState))
}, duration * 1000)
return () => clearInterval(interval)
}, [hovered])
return (
<Tag
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@xsai/docs",
"version": "0.0.29",
"type": "module",
"version": "0.0.29",
"private": true,
"scripts": {
"build": "tsx generate-files.ts && next build",
Expand Down Expand Up @@ -37,11 +37,11 @@
"@xsai/generate-speech": "workspace:^",
"@xsai/generate-text": "workspace:^",
"@xsai/generate-transcription": "workspace:^",
"@xsai/stream-object": "workspace:^",
"@xsai/model": "workspace:^",
"@xsai/providers": "workspace:^",
"@xsai/shared": "workspace:^",
"@xsai/shared-chat": "workspace:^",
"@xsai/stream-object": "workspace:^",
"@xsai/stream-text": "workspace:^",
"@xsai/tool": "workspace:^",
"autoprefixer": "^10.4.20",
Expand Down
10 changes: 5 additions & 5 deletions packages/embed/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@xsai/embed",
"version": "0.0.29",
"type": "module",
"version": "0.0.29",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"author": "Moeru AI",
"license": "MIT",
"homepage": "https://xsai.js.org",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"keywords": ["xsai", "openai", "ai"],
"repository": {
"type": "git",
"url": "git+https://github.com/moeru-ai/xsai.git",
"directory": "packages/embed"
},
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": ["xsai", "openai", "ai"],
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/src/utils/embed-many.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface EmbedManyResult {
}

export const embedMany = async (options: EmbedManyOptions): Promise<EmbedManyResult> =>
await (options.fetch ?? globalThis.fetch)(requestURL('embeddings', options.baseURL), {
(options.fetch ?? globalThis.fetch)(requestURL('embeddings', options.baseURL), {
body: requestBody(options),
headers: requestHeaders({
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/src/utils/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface EmbedResult {
}

export const embed = async (options: EmbedOptions): Promise<EmbedResult> =>
await (options.fetch ?? globalThis.fetch)(requestURL('embeddings', options.baseURL), {
(options.fetch ?? globalThis.fetch)(requestURL('embeddings', options.baseURL), {
body: requestBody(options),
headers: requestHeaders({
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "@importantimport/tsconfig/app.json",
"include": ["src"]
"include": ["src", "test"]
}
10 changes: 5 additions & 5 deletions packages/generate-object/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@xsai/generate-object",
"version": "0.0.29",
"type": "module",
"version": "0.0.29",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"author": "Moeru AI",
"license": "MIT",
"homepage": "https://xsai.js.org",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"keywords": ["xsai", "openai", "ai"],
"repository": {
"type": "git",
"url": "git+https://github.com/moeru-ai/xsai.git",
"directory": "packages/generate-object"
},
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": ["xsai", "openai", "ai"],
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/generate-object/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface GenerateObjectResult<T extends Schema> extends Omit<GenerateTex

/** @experimental WIP */
export const generateObject = async <T extends Schema>(options: GenerateObjectOptions<T>): Promise<GenerateObjectResult<T>> =>
await generateText({
generateText({
...options,
response_format: {
json_schema: {
Expand Down
2 changes: 1 addition & 1 deletion packages/generate-object/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "@importantimport/tsconfig/app.json",
"include": ["src"]
"include": ["src", "test"]
}
10 changes: 5 additions & 5 deletions packages/generate-speech/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@xsai/generate-speech",
"version": "0.0.29",
"type": "module",
"version": "0.0.29",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"author": "Moeru AI",
"license": "MIT",
"homepage": "https://xsai.js.org",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"keywords": ["xsai", "openai", "ai"],
"repository": {
"type": "git",
"url": "git+https://github.com/moeru-ai/xsai.git",
"directory": "packages/generate-speech"
},
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": ["xsai", "openai", "ai"],
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
4 changes: 2 additions & 2 deletions packages/generate-speech/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface GenerateSpeechOptions extends CommonRequestOptions {
* @returns audio array buffer
*/
export const generateSpeech = async (options: GenerateSpeechOptions): Promise<ArrayBuffer> =>
await (options.fetch ?? globalThis.fetch)(requestURL('audio/speech', options.baseURL), {
(options.fetch ?? globalThis.fetch)(requestURL('audio/speech', options.baseURL), {
body: requestBody(options),
headers: requestHeaders({
'Content-Type': 'application/json',
Expand All @@ -26,6 +26,6 @@ export const generateSpeech = async (options: GenerateSpeechOptions): Promise<Ar
signal: options.abortSignal,
})
.then(responseCatch)
.then(res => res.arrayBuffer())
.then(async res => res.arrayBuffer())

export default generateSpeech
2 changes: 1 addition & 1 deletion packages/generate-speech/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "@importantimport/tsconfig/app.json",
"include": ["src"]
"include": ["src", "test"]
}
10 changes: 5 additions & 5 deletions packages/generate-text/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@xsai/generate-text",
"version": "0.0.29",
"type": "module",
"version": "0.0.29",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"author": "Moeru AI",
"license": "MIT",
"homepage": "https://xsai.js.org",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"keywords": ["xsai", "openai", "ai"],
"repository": {
"type": "git",
"url": "git+https://github.com/moeru-ai/xsai.git",
"directory": "packages/generate-text"
},
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": ["xsai", "openai", "ai"],
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
8 changes: 4 additions & 4 deletions packages/generate-text/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ type RawGenerateTextTrampoline<T> = Promise<(() => RawGenerateTextTrampoline<T>)

/** @internal */
const rawGenerateText: RawGenerateText = async (options: GenerateTextOptions) =>
await chat({
chat({
...options,
maxSteps: undefined,
messages: options.messages,
steps: undefined,
stream: false,
})
.then(res => res.json() as Promise<GenerateTextResponse>)
.then(async res => res.json() as Promise<GenerateTextResponse>)
.then(async ({ choices, usage }) => {
const messages: Message[] = options.messages
const steps: StepResult[] = options.steps ?? []
Expand Down Expand Up @@ -152,7 +152,7 @@ const rawGenerateText: RawGenerateText = async (options: GenerateTextOptions) =>
if (options.onStepFinish)
await options.onStepFinish(step)

return async () => await rawGenerateText({
return async () => rawGenerateText({
...options,
messages,
steps,
Expand All @@ -162,7 +162,7 @@ const rawGenerateText: RawGenerateText = async (options: GenerateTextOptions) =>
export const generateText = async (options: GenerateTextOptions): Promise<GenerateTextResult> => {
let result = await rawGenerateText(options)

while (result instanceof Function)
while (typeof result === 'function')
result = await result()

return result
Expand Down
2 changes: 1 addition & 1 deletion packages/generate-text/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "@importantimport/tsconfig/app.json",
"include": ["src"]
"include": ["src", "test"]
}
18 changes: 9 additions & 9 deletions packages/generate-transcription/package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"name": "@xsai/generate-transcription",
"version": "0.0.29",
"type": "module",
"version": "0.0.29",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"author": "Moeru AI",
"license": "MIT",
"homepage": "https://xsai.js.org",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"keywords": [
"xsai",
"openai",
"ai"
],
"repository": {
"type": "git",
"url": "git+https://github.com/moeru-ai/xsai.git",
"directory": "packages/generate-transcription"
},
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": [
"xsai",
"openai",
"ai"
],
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/generate-transcription/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const generateTranscription = async (options: GenerateTranscriptionOption
body.append('model', options.model)
body.append('file', options.file, options.fileName)

return await (options.fetch ?? globalThis.fetch)(requestURL('audio/transcriptions', options.baseURL), {
return (options.fetch ?? globalThis.fetch)(requestURL('audio/transcriptions', options.baseURL), {
body,
headers: requestHeaders(options.headers, options.apiKey),
method: 'POST',
Expand Down
2 changes: 1 addition & 1 deletion packages/generate-transcription/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "@importantimport/tsconfig/app.json",
"include": ["src"]
"include": ["src", "test"]
}
10 changes: 5 additions & 5 deletions packages/model/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@xsai/model",
"version": "0.0.29",
"type": "module",
"version": "0.0.29",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"author": "Moeru AI",
"license": "MIT",
"homepage": "https://xsai.js.org",
"description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
"keywords": ["xsai", "openai", "ai"],
"repository": {
"type": "git",
"url": "git+https://github.com/moeru-ai/xsai.git",
"directory": "packages/model"
},
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": ["xsai", "openai", "ai"],
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/model/src/utils/list-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ListModelsResponse {
}

export const listModels = async (options: ListModelsOptions): Promise<Model[]> =>
await (options.fetch ?? globalThis.fetch)(requestURL('models', options.baseURL), {
(options.fetch ?? globalThis.fetch)(requestURL('models', options.baseURL), {
headers: requestHeaders({
'Content-Type': 'application/json',
...options.headers,
Expand Down
2 changes: 1 addition & 1 deletion packages/model/src/utils/retrieve-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Model } from '../types/model'
export interface RetrieveModelOptions extends CommonRequestOptions {}

export const retrieveModel = async (options: RetrieveModelOptions): Promise<Model> =>
await (options.fetch ?? globalThis.fetch)(requestURL(`models/${options.model}`, options.baseURL), {
(options.fetch ?? globalThis.fetch)(requestURL(`models/${options.model}`, options.baseURL), {
headers: requestHeaders({
'Content-Type': 'application/json',
...options.headers,
Expand Down
2 changes: 1 addition & 1 deletion packages/model/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "@importantimport/tsconfig/app.json",
"include": ["src"]
"include": ["src", "test"]
}
Loading

0 comments on commit 4d60993

Please sign in to comment.