kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
old-agentic
rodzic
b741ac908b
commit
e7c4528d3b
|
@ -4,8 +4,7 @@ import 'dotenv/config'
|
||||||
import { gracefulExit } from 'exit-hook'
|
import { gracefulExit } from 'exit-hook'
|
||||||
import restoreCursor from 'restore-cursor'
|
import restoreCursor from 'restore-cursor'
|
||||||
|
|
||||||
import { SearxngClient } from '../src/services/searxng-client.js'
|
// import { SearxngClient } from '../src/services/searxng-client.js'
|
||||||
|
|
||||||
// import { ClearbitClient } from '../src/index.js'
|
// import { ClearbitClient } from '../src/index.js'
|
||||||
// import { ProxycurlClient } from '../src/services/proxycurl-client.js'
|
// import { ProxycurlClient } from '../src/services/proxycurl-client.js'
|
||||||
// import { WikipediaClient } from '../src/services/wikipedia-client.js'
|
// import { WikipediaClient } from '../src/services/wikipedia-client.js'
|
||||||
|
@ -25,7 +24,6 @@ async function main() {
|
||||||
// const proxycurl = new ProxycurlClient()
|
// const proxycurl = new ProxycurlClient()
|
||||||
// const res = await proxycurl.getLinkedInPerson({
|
// const res = await proxycurl.getLinkedInPerson({
|
||||||
// linkedin_profile_url: 'https://linkedin.com/in/fisch2'
|
// linkedin_profile_url: 'https://linkedin.com/in/fisch2'
|
||||||
// // personal_email: 'fisch0920@gmail.com'
|
|
||||||
// })
|
// })
|
||||||
// console.log(JSON.stringify(res, null, 2))
|
// console.log(JSON.stringify(res, null, 2))
|
||||||
|
|
||||||
|
@ -35,12 +33,12 @@ async function main() {
|
||||||
// })
|
// })
|
||||||
// console.log(JSON.stringify(res, null, 2))
|
// console.log(JSON.stringify(res, null, 2))
|
||||||
|
|
||||||
const searxng = new SearxngClient()
|
// const searxng = new SearxngClient()
|
||||||
const res = await searxng.search({
|
// const res = await searxng.search({
|
||||||
query: '4 + 2 * 10'
|
// query: 'golden gate bridge',
|
||||||
// engines: ['google']
|
// engines: ['reddit']
|
||||||
})
|
// })
|
||||||
console.log(JSON.stringify(res, null, 2))
|
// console.log(JSON.stringify(res, null, 2))
|
||||||
|
|
||||||
return gracefulExit(0)
|
return gracefulExit(0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,63 +101,66 @@ export namespace perigon {
|
||||||
export type ArticlesResponse = {
|
export type ArticlesResponse = {
|
||||||
status: number
|
status: number
|
||||||
numResults: number
|
numResults: number
|
||||||
articles: {
|
articles: Article[]
|
||||||
url: string
|
}
|
||||||
authorsByline: string
|
|
||||||
articleId: string
|
export type Article = {
|
||||||
clusterId: string
|
url: string
|
||||||
source: {
|
authorsByline: string
|
||||||
domain: string
|
articleId: string
|
||||||
}
|
clusterId: string
|
||||||
imageUrl: string
|
source: {
|
||||||
country: string
|
domain: string
|
||||||
language: string
|
}
|
||||||
pubDate: string
|
imageUrl: string
|
||||||
addDate: string
|
country: string
|
||||||
refreshDate: string
|
language: string
|
||||||
score: number
|
pubDate: string
|
||||||
title: string
|
addDate: string
|
||||||
description: string
|
refreshDate: string
|
||||||
content: string
|
score: number
|
||||||
medium: string
|
title: string
|
||||||
links: string[]
|
description: string
|
||||||
labels: string[]
|
content: string
|
||||||
matchedAuthors: string[]
|
medium: string
|
||||||
claim: string
|
links: string[]
|
||||||
verdict: string
|
labels: string[]
|
||||||
keywords: {
|
matchedAuthors: string[]
|
||||||
name: string
|
claim: string
|
||||||
weight: number
|
verdict: string
|
||||||
}[]
|
keywords: {
|
||||||
topics: {
|
name: string
|
||||||
name: string
|
weight: number
|
||||||
}[]
|
|
||||||
categories: {
|
|
||||||
name: string
|
|
||||||
}[]
|
|
||||||
entities: {
|
|
||||||
data: string
|
|
||||||
type: string
|
|
||||||
mentions: number
|
|
||||||
}[]
|
|
||||||
sentiment: {
|
|
||||||
positive: number
|
|
||||||
negative: number
|
|
||||||
neutral: number
|
|
||||||
}
|
|
||||||
summary: string
|
|
||||||
translation: string
|
|
||||||
locations: string[]
|
|
||||||
reprint: boolean
|
|
||||||
reprintGroupId: string
|
|
||||||
places: null
|
|
||||||
}[]
|
}[]
|
||||||
|
topics: {
|
||||||
|
name: string
|
||||||
|
}[]
|
||||||
|
categories: {
|
||||||
|
name: string
|
||||||
|
}[]
|
||||||
|
entities: {
|
||||||
|
data: string
|
||||||
|
type: string
|
||||||
|
mentions: number
|
||||||
|
}[]
|
||||||
|
sentiment: {
|
||||||
|
positive: number
|
||||||
|
negative: number
|
||||||
|
neutral: number
|
||||||
|
}
|
||||||
|
summary: string
|
||||||
|
translation: string
|
||||||
|
locations: string[]
|
||||||
|
reprint: boolean
|
||||||
|
reprintGroupId: string
|
||||||
|
places: null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type StoriesOptions = {
|
export type StoriesOptions = {
|
||||||
clusterId?: string
|
clusterId?: string
|
||||||
topic?: string
|
topic?: string
|
||||||
category?: Categories
|
category?: Categories
|
||||||
|
q?: string
|
||||||
name?: string
|
name?: string
|
||||||
nameExists?: boolean
|
nameExists?: boolean
|
||||||
from?: string
|
from?: string
|
||||||
|
@ -180,73 +183,78 @@ export namespace perigon {
|
||||||
export type StoriesResponse = {
|
export type StoriesResponse = {
|
||||||
status: number
|
status: number
|
||||||
numResults: number
|
numResults: number
|
||||||
results: Array<{
|
results: Story[]
|
||||||
createdAt: string
|
}
|
||||||
updatedAt: string
|
|
||||||
initializedAt: string
|
export type Story = {
|
||||||
|
createdAt: string
|
||||||
|
updatedAt: string
|
||||||
|
initializedAt: string
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
summary: string
|
||||||
|
summaryReferences: Array<any>
|
||||||
|
keyPoints: Array<{
|
||||||
|
point: string
|
||||||
|
references: Array<string>
|
||||||
|
}>
|
||||||
|
sentiment: {
|
||||||
|
positive: number
|
||||||
|
negative: number
|
||||||
|
neutral: number
|
||||||
|
}
|
||||||
|
uniqueCount: number
|
||||||
|
reprintCount: number
|
||||||
|
totalCount: number
|
||||||
|
countries: Array<{
|
||||||
|
name: string
|
||||||
|
count: number
|
||||||
|
}>
|
||||||
|
topCountries: Array<string>
|
||||||
|
topics: Array<{
|
||||||
|
name: string
|
||||||
|
count: number
|
||||||
|
}>
|
||||||
|
topTopics: Array<{ name: string }>
|
||||||
|
categories: Array<{
|
||||||
|
name: string
|
||||||
|
count: number
|
||||||
|
}>
|
||||||
|
topCategories: Array<{ name: string }>
|
||||||
|
people: Array<{ wikidataId: string; name: string; count: number }>
|
||||||
|
topPeople: Array<{ wikidataId: string; name: string }>
|
||||||
|
companies: Array<{
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
summary: string
|
domains: Array<string>
|
||||||
summaryReferences: Array<any>
|
symbols: Array<string>
|
||||||
keyPoints: Array<{
|
count: number
|
||||||
point: string
|
}>
|
||||||
references: Array<string>
|
topCompanies: Array<{
|
||||||
}>
|
id: string
|
||||||
sentiment: {
|
name: string
|
||||||
positive: number
|
domains: Array<string>
|
||||||
negative: number
|
symbols: Array<string>
|
||||||
neutral: number
|
}>
|
||||||
}
|
locations: Array<{
|
||||||
uniqueCount: number
|
state: string
|
||||||
reprintCount: number
|
city?: string
|
||||||
totalCount: number
|
area?: string
|
||||||
countries: Array<{
|
county?: string
|
||||||
name: string
|
count: number
|
||||||
count: number
|
}>
|
||||||
}>
|
topLocations: Array<{
|
||||||
topCountries: Array<string>
|
state: string
|
||||||
topics: Array<{
|
city?: string
|
||||||
name: string
|
area?: string
|
||||||
count: number
|
county?: string
|
||||||
}>
|
|
||||||
topTopics: Array<{ name: string }>
|
|
||||||
categories: Array<{
|
|
||||||
name: string
|
|
||||||
count: number
|
|
||||||
}>
|
|
||||||
topCategories: Array<{ name: string }>
|
|
||||||
people: Array<{ wikidataId: string; name: string; count: number }>
|
|
||||||
topPeople: Array<{ wikidataId: string; name: string }>
|
|
||||||
companies: Array<{
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
domains: Array<string>
|
|
||||||
symbols: Array<string>
|
|
||||||
count: number
|
|
||||||
}>
|
|
||||||
topCompanies: Array<{
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
domains: Array<string>
|
|
||||||
symbols: Array<string>
|
|
||||||
}>
|
|
||||||
locations: Array<{
|
|
||||||
state: string
|
|
||||||
city?: string
|
|
||||||
area?: string
|
|
||||||
county?: string
|
|
||||||
count: number
|
|
||||||
}>
|
|
||||||
topLocations: Array<{
|
|
||||||
state: string
|
|
||||||
city?: string
|
|
||||||
area?: string
|
|
||||||
county?: string
|
|
||||||
}>
|
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see https://www.goperigon.com
|
||||||
|
*/
|
||||||
export class PerigonClient {
|
export class PerigonClient {
|
||||||
readonly ky: KyInstance
|
readonly ky: KyInstance
|
||||||
readonly apiKey: string
|
readonly apiKey: string
|
||||||
|
@ -264,7 +272,7 @@ export class PerigonClient {
|
||||||
timeoutMs?: number
|
timeoutMs?: number
|
||||||
ky?: KyInstance
|
ky?: KyInstance
|
||||||
} = {}) {
|
} = {}) {
|
||||||
assert(apiKey, 'Error perigon client missing required "apiKey"')
|
assert(apiKey, 'Error PerigonClient missing required "apiKey"')
|
||||||
|
|
||||||
this.apiKey = apiKey
|
this.apiKey = apiKey
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,10 @@ export namespace searxng {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://docs.searxng.org
|
* @see https://docs.searxng.org
|
||||||
|
*
|
||||||
|
* NOTE: You'll need to run a local instance of Searxng to use this client.
|
||||||
|
*
|
||||||
|
* See [perplexica](https://github.com/ItzCrazyKns/Perplexica/blob/master/docker-compose.yaml) for an example.
|
||||||
*/
|
*/
|
||||||
export class SearxngClient {
|
export class SearxngClient {
|
||||||
readonly ky: KyInstance
|
readonly ky: KyInstance
|
||||||
|
|
Ładowanie…
Reference in New Issue