summaryrefslogtreecommitdiff
path: root/backend/instance/api-defs.ts
blob: a655b167a535430c530450a74a2aa17684b08162 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
export interface ServerStatus {
  lastUpdate: number,
  loadedModel: string,
  isBusy: boolean,
  domain: string,
  msg?: string
};

export interface ModelInfo {
  name: string,
  modelname: string,
  capabilities: any,
  system: string,
  description: string,
  short_description: string,
  free: number,
};

export interface ToolCall {
  name: string,
  parameters: any
};

export interface ToolNote {
  content: string,
  id: string
};

export interface ChatMsg {
  timestamp: string,
  role: string,
  content: string,
  toolCall?: ToolCall,
  /** valid when: passing from model backend to ollama
    * null when: passing from client to api or from api to model backend */
  images?: string[],
  /** valid when: when passing from client to api and from api to model backend
    * null when: passing from model backend to ollama */
  files?: {
    name: string,
    type: string,
    content: string
  }[],

  /** only valid when title is generated for the first response */
  title?: string
};

/** chat options while passing from api to model instance */
export interface ChatOptions {
  system?: {
    model?: string,
    user?: string
  },
  model: ModelInfo,
  uuid: string,
  generateTitle: boolean,
  chatfile?: string
};

export interface ChatStream {
  response?: string,
  status: string,
  done: boolean,
  finalMsg?: string,
  tool?: boolean
}